=====Erste Schritte mit dem ESP32 und MicroPython==== Umgebung Windows 10 / PowerShell Mehr zum ESP32 =>http://esp32.net/ Mehr zu MicroPython => https://docs.micropython.org/en/latest/index.html ---- ====Python Setup==== Python 3.8 installieren (z.b. nach C:\python38) cd C:\python38 -- upgrade pip C:\python38> .\python.exe -m pip install --upgrade pip -- ESP Tools installieren C:\python38> .\python.exe -m pip install --upgrade esptool ---- ====ESP Tool Setup==== Clone von https://github.com/espressif/esptool.git cd c:\entwicklung\esp32 mkdir esptool cd esptool # über Git Bash falls nicht im Pfad git clone https://github.com/espressif/esptool.git Chip ID auslesen: cd c:\enttwicklung\esp32 C:\Python38\python.exe .\esptool.py chip_id esptool.py v3.1-dev Found 2 serial ports Serial port COM4 Connecting........_____... Detecting chip type... ESP32 Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 24:0a:c4:30:f7:ec Uploading stub... Running stub... Stub running... Warning: ESP32 has no Chip ID. Reading MAC instead. MAC: 24:0a:c4:30:f7:ec Hard resetting via RTS pin... ---- === Image auf den Controller schreiben === Altes Image zuvor löschen: C:\Python38\python.exe .\esptool.py --chip esp32 -p COM4 erase_flash Download des Images über => https://micropython.org/download/#esp32 z.b. das esp32-idf3-20200902-v1.13.bin Nun den das Firmware Image auf den Kontroller schreiben mit "esptool.py --chip esp32 -p write_flash -z 0x1000 " C:\Python38\python.exe .\esptool.py --chip esp32 -p COM4 write_flash -z 0x1000 .\esp32-idf3-20200902-v1.13.bin esptool.py v3.1-dev Serial port COM4 Connecting........_ Chip is ESP32-D0WDQ6 (revision 1) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 24:0a:c4:30:f7:ec Uploading stub... Running stub... Stub running... Configuring flash size... Compressed 1448768 bytes to 926007... Wrote 1448768 bytes (926007 compressed) at 0x00001000 in 82.6 seconds (effective 140.4 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... ---- ==== Per Console auf den Controller zugreifen ==== Abstecken und neu anstecken. Boud Rate: 115200 Mit "putty" https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html) Console auf dem Kontroller anmelden. Probleme ... Mehrfach an und abgesteckt, mal kann eine Console geöffnet werden und es werden Daten ausgegeben aber es kann nicht eingegeben werden mal geht es wieder nicht . Nach 3-4 Versuchen ist ein Login möglich. ... I (314) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. MicroPython v1.13 on 2020-09-02; ESP32 module with ESP32 Type "help()" for more information. >>> help() Welcome to MicroPython on the ESP32! .. Testprogramm vom Sparkfun für das erste Blinken: from machine import Pin led = Pin(5, Pin.OUT) led.value(1) ---- ====Problem mit "billigen" USB Kabel ==== Das Problem: PS C:\entwicklung\nodeMCU\esptool> C:\Python38\python.exe .\esptool.py --chip esp32 chip_id esptool.py v3.1-dev Found 2 serial ports Serial port COM4 Connecting....... COM4 failed to connect: Cannot configure port, something went wrong. Original message: OSError(22, 'A device which does not exist was specified.', None, 433) Mein Board hat einen CP2102 Chip Statz siehe => http://esp32.net/usb-uart/, daher Treiber Für Windows über https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers neu installiert, aber gleiches Problem. **Lösung:** Kabel getauscht, funktioniert ...! Das neue Kabel ist ein Textil Kabel von IKEA für ein paar Euro, das alte Kabel hat zurvor mit einem ESP8266 einwandfrei funktioniert! ---- ---- ==== Das erste Programm ==== siehe => https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/ === BMP280 === siehe => https://randomnerdtutorials.com/micropython-bme280-esp32-esp8266/ ---- ---- ====Quellen==== http://esp32.net/ Beispiele: * https://awesome-micropython.com/ Web: * https://learn.sparkfun.com/tutorials/how-to-load-micropython-on-a-microcontroller-board/esp32-thing * https://randomnerdtutorials.com/flashing-micropython-firmware-esptool-py-esp32-esp8266/