Monday, November 23, 2020

Install CircuitPython to nanoESP32-S2, on Raspberry Pi.

 


MuseLab nanoESP32-S2 is a dev. board with a ESP32-S2 module. This board has 2 USB-C connector, one for Serial (ch340) and one for Native USB (esp32), is supported running CircuitPython.

Currently, nanoESP32-S2 support 4 module:

  • ESP32-S2-WROOM: PCB Antenna, no PSRAM.
  • ESP32-S2-WROOM-I: IPEX Antenna, no PSRAM.
  • ESP32-S2-WROVER: PCB Antenna, with PSRAM.
  • ESP32-S2-WROVER-I: IPEX Antenna, with PSRAM.

My sample is ESP32-S2-WROVER-I.

This video show the steps to flash CircuitPython (latest unstable release CircuitPython 6.1.0-beta.1) on museLab nanoESP32-S2, using Raspberry Pi 4B/8G running Raspberry Pi OS (32 bit).


Install esptool:
$ sudo pip install esptool
Download CircuitPython:
Visit https://circuitpython.org/board/muselab_nanoesp32_s2/ to download CircuitPython (.BIN) for nanoESP32-S2.

The full path of the downloaded file in my case is:
/home/pi/Downloads/adafruit-circuitpython-muselab_nanoesp32_s2-en_US-6.1.0-beta.1.bin

Identify the COM port to attached to ESP32-S2 board, using dmesg:

Before connect to ESP32-S2 board:

Enter the command to clear dmesg buffer:
$ sudo dmesg -c

Connect ESP32-S2 USB marked "ch340".

Enter the command to check the latest attached port:
$ dmesg

found:
ch341-uart converter now attached to ttyUSB0

The COM port is: /dev/ttyUSB0

Erase and Flash ESP32-S2:

Erase:
$ esptool.py --chip auto --port <COM PORT> erase_flash
Flash with downloaded CircuitPython:
$ esptool.py --chip auto --port <COM PORT> -b 460800 --before=default_reset \
--after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 4MB 0x0000 \
<DOWNLOADED FILE>
Done!
After flashed with CircuitPython, you can now disconnect and reconnect the ESP32-S2 board to the another USB connector marked "esp32".

A new driver name "CIRCUITPY" is attached.


Install Mu:

Mu is a Python Editor, and is suggested to program CircuitPython.

To install Mu on Raspberry Pi OS:
Click the Menu >> Preferences >> Recommmended Software
>> Programing >> Mu

With Mu installed, you can try something with CircuitPython REPL. Refer to the video.


For more exercise related to CircuitPython/ESP32-S2, refer to my another blog posts Embedded things > Hello nanoESP32-S2/CircuitPython

No comments: