MicroPythonではESP32C3をサポートしているが、公式サポートはespressifのDevKitであり、SeeedStudio xiao esp32c3はサポート外である。MicroPythonのGENERIC版が動くのだが、まぁ公式サポートのファームを使う方がいいかと思い、CircuitPythonを使ってみる。以下のコマンドでファームを焼く
esptool.py --port <serial_port> erase_flash esptool.py --port <serial_port> write_flash -z 0x0 <firmware_file>
実行例
$ esptool.py --port /dev/ttyACM0 write_flash -z 0x0 adafruit-circuitpython-seeed_xiao_esp32c3-en_US-8.0.3.bin esptool.py v4.5.1 Serial port /dev/ttyACM0 Connecting... Detecting chip type... ESP32-C3 Chip is ESP32-C3 (revision v0.3) Features: WiFi, BLE Crystal is 40MHz MAC: 58:cf:79:f3:6a:24 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00000000 to 0x0016bfff... Compressed 1488672 bytes to 923325... Wrote 1488672 bytes (923325 compressed) at 0x00000000 in 11.8 seconds (effective 1010.5 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. Code done running. Press any key to enter the REPL. Use CTRL-D to reload. Adafruit CircuitPython 8.0.3 on 2023-02-23; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4
>>> help('modules') __future__ collections neopixel_write terminalio __main__ digitalio nvm time _asyncio displayio onewireio touchio _bleio dualbank os traceback _pixelmap errno ps2io ulab adafruit_bus_device espidf pulseio ulab.numpy adafruit_bus_device.i2c_device fontio pwmio ulab.numpy.fft adafruit_bus_device.spi_device framebufferio rainbowio ulab.numpy.linalg adafruit_pixelbuf gc random ulab.scipy aesio getpass re ulab.scipy.linalg analogio hashlib rgbmatrix ulab.scipy.optimize array i2cperipheral rtc ulab.scipy.signal atexit i2ctarget sdcardio ulab.scipy.special audiocore io select ulab.utils audiomixer ipaddress sharpdisplay uselect binascii json socketpool vectorio bitbangio keypad ssl watchdog bitmaptools math storage wifi board mdns struct zlib builtins microcontroller supervisor busio micropython synthio canio msgpack sys Plus any modules on the filesystem
CircuitPython — Adafruit CircuitPython 8.1.0-beta.0 documentation
ESP32 WROOM 32EにMicroPythonを焼く場合は以下(開始アドレスが異なる)
$ esptool.py -p /dev/ttyUSB0 erase_flash esptool.py v4.5.1 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting..... Detecting chip type... ESP32 Chip is ESP32-D0WD-V3 (revision v3.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: b8:d6:1a:bd:14:e8 Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)... Chip erase completed successfully in 13.7s Hard resetting via RTS pin... $ esptool.py -p /dev/ttyUSB0 write_flash -z 0x1000 esp32-20220618-v1.19.1.bin esptool.py v4.5.1 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting...... Detecting chip type... ESP32 Chip is ESP32-D0WD-V3 (revision v3.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: b8:d6:1a:bd:14:e8 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00001000 to 0x0017efff... Compressed 1560976 bytes to 1029132... Wrote 1560976 bytes (1029132 compressed) at 0x00001000 in 90.9 seconds (effective 137.3 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
MPY: soft reboot MicroPython v1.19.1 on 2022-06-18; ESP32 module with ESP32 Type "help()" for more information. >>> help('modules') __main__ gc ubluetooth upysh _boot inisetup ucollections urandom _onewire math ucryptolib ure _thread micropython uctypes urequests _uasyncio neopixel uerrno uselect _webrepl network uhashlib usocket apa106 ntptime uheapq ussl btree onewire uio ustruct builtins uarray ujson usys cmath uasyncio/__init__ umachine utime dht uasyncio/core umqtt/robust utimeq ds18x20 uasyncio/event umqtt/simple uwebsocket esp uasyncio/funcs uos uzlib esp32 uasyncio/lock upip webrepl flashbdev uasyncio/stream upip_utarfile webrepl_setup framebuf ubinascii uplatform websocket_helper