Esp32 MicroPython developmentát hồng đỗ trọng
Search terms: calibrate esp32 adc
Timer interrupt

Timer on ESP32

Kelvin nghỉ từ 03/24, thầy cô không tính tiền chở Kelvin đi học trong tháng trước nữa

1. –chip esp32 –port COM9 erase_flash
2. –chip esp32 –port COM9 –baud 921600 –before default_reset –after no_reset write_flash -z –flash_mode dio –flash_freq 40m –flash_size detect 0x1000 bootloader.bin 0xf000 phy_init_data.bin 0x10000 MicroPython.bin 0x8000 partitions_mpy.bin
3. ampy –port COM9 –baud 115200 put
4. frame bufer

import pygame
image = pygame.image.load(“1bit-logo.png”)
buffer = bytearray((image.get_height() // 8) * image.get_width())
i = 0
for y in range(image.get_height() // 8):
for x in range(image.get_width()):
byte = 0
for bit in range(8):
pixel = image.get_at((x, y * 8 + bit))
if pixel[0] != 255:
byte |= (1 << bit) buffer[i] = byte i += 1 print(repr(buffer)) --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after no_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader.bin 0xf000 phy_init_data.bin 0x10000 MicroPython.bin 0x8000 partitions_mpy.bin 1. VuzeScript. 2. wkhtmltopdf upgrade. 3. DrawIO. 4. Drone hardware test and support. 5. Rebuild MicroPython from source to enable extension of Xtensa instructions and drone software. Test the following features of the implementation. Teensy (Arm-Cortex), Linux (testing), and Esp32 (Xtensa) ESP32 is a series of low cost, low power system on a chip microcontrollers with integrated Wi-Fi & dual-mode Bluetooth. The ESP32 series employs a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese company, and is manufactured by TSMC using their 40nm process. Preparation for drone development. MicroPython development for Esp32 in 6 steps: Install a 10 uF electrolytic capacitor between GND (short pin) and EN pin to avoid packet error when uploading. The built-in OLED version does not seem to have this issue (4 MB flash). 1. Download Python 3.7 Choose the installer on Windows 10 to install Python at Users\ldao\AppData\Local\Programs\Python\Python37-32 2. At the terminal prompt, install the flash eraser tool (esptool) python -m pip install esptool python -m pip install --upgrade pip (this is optional to upgrade pip) 3. The esptool is installed at the subdirectory Scripts\, erase the chip (8 sec). Scripts\ --chip esp32 erase_flash 4. Download the MicroPython firmware binarỵ *Need how to rebuild this firmware to access all 4 MB of flash. 5. Upload the firmware to the Esp32 (9 sec). cd Scripts --chip esp32 --port COM17 --baud 460800 write_flash -z 0x1000 esp32-20190529-v1.11.bin 6. MicroPython IDE (probably not needed, see 7): type help() at the prompt. 7. SSH terminal (serial interface). This eliminates the need for an IDE. import os os.listdir() to see all uploaded .py files 8. gfx and oled ssd1306 driver. git clone git clone 9. Download the ampy tool to manage test scripts (ls, rm, get option). python -m pip install adafruit-ampy 10. gfx and oled ssd1306 driver. ampy --port COM9 --baud 115200 put ampy --port COM9 --baud 115200 put 11. Add delay time in to avoid "could not enter raw repl". #Added 10.2.2019 time.sleep(2) Users\ldao\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\ampy\ 12. Pinout differences between Heltec and Esp-Wroom-32D 13. Documentation folder for Heltec. 14. ESP-IDF toolchain for C development (no OS). Rebuild this on .88 and .90 dnf install git wget ncurses-devel flex bison gperf python pyserial python-pyelftools cmake ninja-build ccache 15. PsRAM expansion for additional free memory. 16. There is a git repository that can build the custom Esp32 image with psRAM support. *In-line Xtensa assembly test. *Custom C module import test. *Documentation of build procedure for additional Python packages (formatting tools). 15. Zephyr os. Installation of the RTOS. dnf upgrade dnf group install "Development Tools" dnf install git make gcc glibc-static libstdc++-static ncurses-devel doxygen dfu-util dtc python3-pip python3-ply python3-yaml dfu-util dtc python3-pykwalify dnf search pykwali [root@kimberly ldao]# du -hs zephyr/ 425M zephyr/ du -hs zephyr-sdk/ 1.4G zephyr-sdk source export ZEPHYR_GCC_VARIANT="espressif" export ZEPHYR_SDK_INSTALL_DIR=/home/ldao/zephyr-sdk/ Installation of the esp32 toolchain. Works on .85 (kimberly), needs to build on odroid (*not working). Build example blink using build. export ESP_IDF_PATH="/home/ldao/esp/esp-idf" export ESPRESSIF_TOOLCHAIN_PATH="/home/ldao/esp/xtensa-esp32-elf/" cd ~/esp/esp-idf/ source rm -rdf blink/ cp -r $IDF_PATH/examples/get-started/blink/ . cd ~/esp/blink build (approximately 115 MB with 835 components) Copy to Windows Scripts\ To flash the Esp32 chip (retest with only 3 files) --after hard_reset write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x1000 blink/build/bootloader/bootloader.bin 0x8000 blink/build/partition_table/partition-table.bin 0x10000 blink/build/blink.bin #export ZEPHYR_GCC_VARIANT=zephyr #export ZEPHYR_SDK_INSTALL_DIR=/home/ldao/zephyr-sdk/ export ZEPHYR_GCC_VARIANT="espressif" export ESP_IDF_PATH="/home/ldao/esp/esp-idf" export ESPRESSIF_TOOLCHAIN_PATH="/home/ldao/xtensa-esp32-elf/" 16. Larger display and E-ink screens. 17. Custom instruction set development for Tensilica Xtensa LX6. MicroPython suuports only inline ARM assembly instructions. There are GNU toolchain for Xtensa and TIE development. 18. Customization and tests. 1. Test gfx and ssd1306 graphics, scrolling, switch buttons (pin 2), and two LEDs (pins 16 and 2). import blink (see the definition of run in has issues with pin 4, 5, and 25. Solved: The OLED display uses pins 4 (SDA) and 5 (SCL) to communicate on the I2C bus with the ESP32. 2. Font control (see Arduino projects). 3. d/a converter for analog fading. 4. Serial to parallel. 5. Voltage regulator for 3.3 and 5-volt power supply from 18650 batteries. 6. Temperature sensor (both digital & analog). 7. Neopixels RGB LEDs. 8. RGB LEDs (Common cathode & anode). 9. esp32 MicroPython. import esp esp.flash_size() to see 4 MB (4,194,304 bytes) import gc (garbage collector, need to expand free_mem to 4 MB) gc.mem_free() 115712 bytes 19. Blue tooth wireless protocols. 20. Drone software development. Test the gyroscope on the evaluation board. Check to see if anything is fried (battery issue). JTAG debugging. One of the ESP-32 chip is fried (brownout detected). 4-inch hi-speed LCD. 21. Windows restore point to restore after update damage. Firefox key3.db, key4.db, cert8.sqlite, cert9.sqlite, places.sqlite to restore bookmarks & passwords. Create a new profile (about:profiles), close Firefox before copying to the new profile. 22. Esp32 assembly language (xtensa). 23.