Author Topic: ESP32-WROOM and Arduino IDE, my first encounter.  (Read 1365 times)

0 Members and 1 Guest are viewing this topic.

Offline pcprogrammerTopic starter

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
ESP32-WROOM and Arduino IDE, my first encounter.
« on: December 05, 2024, 03:06:16 pm »
I ordered some ESP32-WROOM development boards on Aliexpress via the 3 for not much option (1,88 euro per board :)  https://nl.aliexpress.com/item/1005005623725652.html) and they arrived today.

Always test these kind of things when they arrive to make sure all is good, so connected them to my computer (USB-A to USB-C cable) and a LED was lit. The CH340 connected without problems, but no blinking LED, which I mostly find enough proof of working. So decided to test it with an example sketch in the Arduino IDE.

But that turned out to be not so simple and straight forward. I had no ESP boards installed, which was not a big problem. Open the boards manager and install the ESP boards. Version 3.07 was the newest available. This adds a ton of new boards and brings stress of choice.  :o

A search on the net showed that "ESP32 Dev Module" was the most likely choice for the 30 pin WROOM board. Selected a simple example sketch and pressed upload. No dice, it complained about the module serial not existing.

Code: [Select]
Traceback (most recent call last):
  File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool.py", line 34, in <module>
    import esptool
  File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/_init_.py", line 41, in <module>
    from esptool.cmds import (
  File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/cmds.py", line 14, in <module>
    from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage
  File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/bin_image.py", line 14, in <module>
    from .loader import ESPLoader
  File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/loader.py", line 30, in <module>
    import serial
ModuleNotFoundError: No module named 'serial'
exit status 1

Compilation error: exit status 1

I knew that a friend of mine had already played with the ESP32-WROOM boards in combination with the Arduino IDE, and he told me that the boards library he had installed for the ESP devices was version 3.1.0-RC3. Unfortunately that was not in my list of versions.  :palm:

After a bit of looking through his setup it became clear that one has to add additional boards to the preferences.

2454055-0

He had the following two in his list:
Code: [Select]
https://dl.espressif.com/dl/package_esp32_index.json
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json

Not sure which one does the trick, but after adding them I got the new versions in my list and selected the latest version. After this action the sketch (Examples->WiFi->WiFiScan) compiled just fine, but uploading failed.

Code: [Select]
Sketch uses 913680 bytes (69%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45476 bytes (13%) of dynamic memory, leaving 282204 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.8.1
Serial port /dev/ttyUSB0
Connecting...........
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 8c:4f:00:36:95:90
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.

A fatal error occurred: Unable to verify flash chip connection (Invalid head of packet (0xE0): Possible serial noise or corruption.).
Failed uploading: uploading error: exit status 2

Tried it via another USB port on the computer, but still the same problem. I have some other older ESP32 boards (USB-micro) in my collection, that I never tried loading code into before, and these worked just fine. Code uploaded and started without problems.

My friend suggested to try different boards and when I selected "AI Thinker ESP32-CAM" it also worked without problems.

Clearly the ESP32 world on Arduino is a bit mysterious and with boards from unknown origin it can be a bit of a hassle to get things running.

Hope this post can help others when they run into ESP32 problems.
« Last Edit: December 05, 2024, 03:07:54 pm by pcprogrammer »
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2713
  • Country: fr
    • kripton2035 schematics repository
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #1 on: December 05, 2024, 04:28:39 pm »
I'm on macos, but with some esp32 boards, I have two usb serial ports... one named as chusbserial000 and the other as wchusbserial000
only the wchusbserial works to upload to the board.
 

Offline pcprogrammerTopic starter

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #2 on: December 05, 2024, 05:53:56 pm »
I'm running under Linux Mint and there the naming of the serial port depends on the connected device. The CH340 shows up as /dev/ttyUSBx (x can be 0 - ... Depends on if there are more devices of the same kind connected).

In the Arduino IDE it shows /dev/ttyS0 as a default device and when connected to a board another one is shown, like /dev/ttyUSB0 for my ESP32 boards.

It might be that on macos it uses a similar setup, but with the names you mentioned.

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4350
  • Country: us
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #3 on: December 06, 2024, 01:59:40 am »
Quote
ModuleNotFoundError: No module named 'serial'

Espressif hasn't been particularly careful WRT reducing dependencies on "stuff" that needs to be installed on your system.  Particularly Python stuff.   It looks to me like you're missing the Python "Serial" library; try something like "pip install serial" and/or "pip3 install serial" off in a shell somewhere...

Quote
stress of choice.
Yeah; ESP and STM are particularly "complete" in their installation of board names.  Annoying.  I went so far as to work on a program to insert appropriate "boardname.hide=true" in the boards.txt file(s), but I got hung up on GUIs and "fear-of-deploy." (https://github.com/WestfW/Duino-hacks/tree/master/BoardListManager if you're adventuresome)
You can manually edit the boards.txt file if you want.
 

Offline pcprogrammerTopic starter

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #4 on: December 06, 2024, 07:01:13 am »
Quote
ModuleNotFoundError: No module named 'serial'

Espressif hasn't been particularly careful WRT reducing dependencies on "stuff" that needs to be installed on your system.  Particularly Python stuff.   It looks to me like you're missing the Python "Serial" library; try something like "pip install serial" and/or "pip3 install serial" off in a shell somewhere...

It might have been that, but luckily the solution was included in the newer version of the boards library. If not this would have been the next on the list to resolve the problem.

Quote
stress of choice.
Yeah; ESP and STM are particularly "complete" in their installation of board names.  Annoying.  I went so far as to work on a program to insert appropriate "boardname.hide=true" in the boards.txt file(s), but I got hung up on GUIs and "fear-of-deploy." (https://github.com/WestfW/Duino-hacks/tree/master/BoardListManager if you're adventuresome)
You can manually edit the boards.txt file if you want.

I'm not using the Arduino IDE that much, so I don't care about it.

What intrigues me is why the old boards I have lying around work with more than one of the available board types, while the new ones failed with all but one that I tried.

I did notice that the new boards tried to load with just shy of 1Mbit/s when testing with the board types that did not work, but I did not check what speed was used when it succeeded. The old boards used about 0.5Mbit/s. So maybe the serial speed is the problem.

The new boards are using the CH340 for USB to serial, where the old boards use a chip with the markings removed.  :palm:

Offline tooki

  • Super Contributor
  • ***
  • Posts: 13160
  • Country: ch
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #5 on: December 06, 2024, 12:28:05 pm »
FWIW, I used the CP2102N (the chip espressif uses) when making custom ESP32 boards, and they then work the same as original espressif DEVKIT-C boards.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4350
  • Country: us
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #6 on: December 07, 2024, 08:07:55 am »
Quote
why the old boards I have lying around work with more than one of the available board types
Well, a whole lot of them use the same ESP32 processor, so the only practical differences between boards is flash memory size and pinout (much of which is semi-fixed, anyway, and not visible to simple programs.  Perhaps LED_BUILTIN changes.)

The "newer" boards include some new CPU variants, including RISCV...
 
The following users thanked this post: tooki

Offline pcprogrammerTopic starter

  • Super Contributor
  • ***
  • Posts: 4670
  • Country: nl
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #7 on: December 07, 2024, 08:55:04 am »
Quote
why the old boards I have lying around work with more than one of the available board types
Well, a whole lot of them use the same ESP32 processor, so the only practical differences between boards is flash memory size and pinout (much of which is semi-fixed, anyway, and not visible to simple programs.  Perhaps LED_BUILTIN changes.)

The "newer" boards include some new CPU variants, including RISCV...

I'm a bit of a MCU dev board hoarder.  :-DD

I have several different ESP32 boards like the C3, S2F, 38 pin ESP32 module boards and now 30 pin ESP32-WROOM-32 module boards.

The C3 and S2F seem to be actual MCU's in QFN packages, which I still have to start to play with, but the other ones have these modules with a metal can over them. See picture. No idea if any of these are already RISC-V based.

When I have a real project for them I will find out.

Offline tooki

  • Super Contributor
  • ***
  • Posts: 13160
  • Country: ch
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #8 on: December 07, 2024, 09:32:56 am »
The C3 and S2F seem to be actual MCU's in QFN packages, which I still have to start to play with, but the other ones have these modules with a metal can over them.
The others are also a QFN under the can. Here’s a picture of an ESP32-WROOM with the shield removed: https://commons.wikimedia.org/wiki/File:Espressif_ESP-WROOM-32_Wi-Fi_%26_Bluetooth_Module.jpg


No idea if any of these are already RISC-V based.
The C2, C3, C6, and H2 are RISC-V.

As I understand it, all future ESP32 models will be RISC-V.
 
The following users thanked this post: pcprogrammer

Offline djsb

  • Frequent Contributor
  • **
  • Posts: 988
  • Country: gb
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #9 on: December 07, 2024, 10:29:51 am »
I've been using this one and have had no problems so far

https://www.mouser.co.uk/ProductDetail/Espressif-Systems/ESP32-DevKitC-32E?qs=GedFDFLaBXFpgD0kAZWDrQ%3D%3D

I also tried the DFROBOT Firebeetle and could not get it to program at all. It seems the USB chip used is the culprit. I've not bothered to investigate further.
David
Hertfordshire, UK
University Electronics Technician, London, PIC16/18, CCS PCM C, Arduino UNO, NANO,ESP32, KiCad V8+, Altium Designer 21.4.1, Alibre Design Expert 28 & FreeCAD beginner. LPKF S103,S62 PCB router Operator, Electronics instructor. Credited KiCad French to English translator
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 13160
  • Country: ch
Re: ESP32-WROOM and Arduino IDE, my first encounter.
« Reply #10 on: December 07, 2024, 12:32:11 pm »
I've been using this one and have had no problems so far

https://www.mouser.co.uk/ProductDetail/Espressif-Systems/ESP32-DevKitC-32E?qs=GedFDFLaBXFpgD0kAZWDrQ%3D%3D

I also tried the DFROBOT Firebeetle and could not get it to program at all. It seems the USB chip used is the culprit. I've not bothered to investigate further.
The original boards from Espressif use the CP2102N USB-serial bridge. Many third party ones, like the DFROBOT ones and many no-name ones, use the CH340. It’s very possible that other chips are used by other boards. Depending on the chip and the OS, one may need to install drivers.

Newer ESP32 chips (including the S and C series) have native USB, and those shouldn’t need a driver. Many such boards actually have two USB ports, one being the native port, the other being via a bridge chip.

The DFROBOT Beetle ESP32-C3 I just used for a project is an example of a tiny board using only the native USB. Worked perfectly.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf