Unable to program Arduino Nano ESP32-S3

Hi everyone, i am relatively new to the arduino IDE. I have been an embedded programmer for more than 20 years but never really used systematically arduinos but instead i (almost) always designed my own custom boards.

I downloaded the latest Arduino IDE 2.2.1 in my linux box (linux mint 20.x). The IDE worked fine. I tried the pre-compiled and appimage options and both worked w/o any abnormal behavior.

I ordered two Arduino Nano ESP32 boards from TME and received them today.

I plugged in the type-c cable and noticed that after some short blinking of the leds, the rgb was blinking every 1 sec in the following sequence R->G->B->R...

I got a message in the IDE that the "Arduino ESP32 Boards [v 2.0.13]" core has to be installed. I clicked on Yes button and noticed in the output tab the progress of installed dependencies as follows:

Downloading packages
esp32:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0
esp32:xtensa-esp-elf-gdb@11.2_20220823
esp32:openocd-esp32@v0.11.0-esp32-20221026
esp32:esptool_py@4.5.1
esp32:mkspiffs@0.2.3
esp32:mklittlefs@3.0.0-gnu12-dc7f933
arduino:dfu-util@0.11.0-arduino5
arduino:esp32@2.0.13
Installing esp32:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0
Configuring tool.
esp32:xtensa-esp32s3-elf-gcc@esp-2021r2-patch5-8.4.0 installed
Installing esp32:xtensa-esp-elf-gdb@11.2_20220823
Configuring tool.
esp32:xtensa-esp-elf-gdb@11.2_20220823 installed
Installing esp32:openocd-esp32@v0.11.0-esp32-20221026
Configuring tool.
esp32:openocd-esp32@v0.11.0-esp32-20221026 installed
Installing esp32:esptool_py@4.5.1
Configuring tool.
esp32:esptool_py@4.5.1 installed
Installing esp32:mkspiffs@0.2.3
Configuring tool.
esp32:mkspiffs@0.2.3 installed
Installing esp32:mklittlefs@3.0.0-gnu12-dc7f933
Configuring tool.
esp32:mklittlefs@3.0.0-gnu12-dc7f933 installed
Installing arduino:dfu-util@0.11.0-arduino5
Configuring tool.
arduino:dfu-util@0.11.0-arduino5 installed
Installing platform arduino:esp32@2.0.13
Configuring platform.
Platform arduino:esp32@2.0.13 installed

No abnormal behavior was observed.

I then clicked on the tick button (compile) and i got the following in the output tab:

Traceback (most recent call last):
  File "/home/manos/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool.py", line 31, in <module>
    import esptool
  File "/home/manos/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/__init__.py", line 41, in <module>
    from esptool.cmds import (
  File "/home/manos/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/cmds.py", line 14, in <module>
    from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage
  File "/home/manos/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/bin_image.py", line 14, in <module>
    from .loader import ESPLoader
  File "/home/manos/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool/loader.py", line 30, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'

exit status 1

Compilation error: exit status 1

I know that this board can run micro-python but i was surprised to see these messages without having done anything to the board. Then i tried a second and i got the same behavior.

So i was not able to compile or upload an empty sketch's code to the board.

I googled and found the "Reinstalling the C++ Arduino Bootloader" in this page: https://dronebotworkshop.com/nano-esp32/ and tried short-circuiting B1 to GND, then pressing/releasing the RST button on the board and finally removing the short between B1 & GND. I got the expected purple-like led indicating that the board is in bootloader mode. I did exactly what the page says:

  1. Selected the Arduino board (Menu Tools->Board) - It was already selected as "Arduino Nano ESP32".
  2. Selected the programmer by using menu Tools->Programmer - "Esptool" was already selected.
  3. Tried to upload the bootloader & sketch code by using menu Sketch->Upload using programmer.

I ended up getting the exact same error message no matter what i did. I re-did the entire process from scratch a few times and always got the same error message.

I even tried a second usb-c cable but i got the same results.

I have no idea what is going on.

Any help will be highly appreciated.

Regards to all.

Manos

Hi @paradigmshift. The Linux version of the "Arduino ESP32 Boards" platform uses a Python script named esptool when compiling sketches. That esptool script has a dependency on the pyserial Python package. The "No module named 'serial'" error occurs because that package dependency is not installed on your computer.

We are accustomed to all the dependencies of Arduino boards platforms being automatically installed along with the platform by the Arduino "Boards Manager", but the ESP32 platform developers didn't make their project that way. You are expected to manually install this pyserial Python package if you don't have it installed already. So the solution to the error is to use pip to install the pyserial package.

Try this:

  1. Open a command line terminal on your computer.
  2. Type the following command:
    python3 -m pip install pyserial
    
  3. Press the Enter key.
  4. Wait for the command to complete successfully.

Now try compiling your sketch again. Hopefully the "No module named 'serial'" error will no longer occur.

These messages are not related to MicroPython, which is used to create firmware that runs on your Arduino board using the Python language, but instead are related to a Python script that runs on your computer.

The sketches you write in Arduino IDE are compiled as C++ code, not MicroPython. As you mentioned, it is possible to write firmware for the board in Python as well, but a completely different IDE is used for that purpose.

Hi there and thanks for the super fast response.

Your suggestion fixed the issue.

I have another udev issue but i m guessing this will be easily fixed.

Regards
Manos

You are welcome. I'm glad if I was able to be of assistance.

Regards,
Per