ESP32-WROOM and Arduino IDE, my first encounter. - Page 1
Forum section: electronics / general

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 05, 2024, 03:06:16 pm
content: I ordered some ESP32-WROOM development boards on Aliexpress via the 3 for not much option (1,88 euro per boardhttps://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.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:Traceback (most recent call last):File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool.py", line 34, in <module>import esptoolFile "/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, LoadFirmwareImageFile "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/bin_image.py", line 14, in <module>from .loader import ESPLoaderFile "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/loader.py", line 30, in <module>import serialModuleNotFoundError: No module named 'serial'exit status 1Compilation error: exit status 1I 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.After a bit of looking through his setup it became clear that one has to add additional boards to the preferences.He had the following two in his list:Code:https://dl.espressif.com/dl/package_esp32_index.jsonhttps://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.jsonNot 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: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.1Serial port /dev/ttyUSB0Connecting...........Chip is ESP32-D0WD-V3 (revision v3.1)Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme NoneCrystal is 40MHzMAC: 8c:4f:00:36:95:90Uploading stub...Running stub...Stub running...Changing baud rate to 921600Changed.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 2Tried 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.

author: kripton2035
author_rank: Super Contributor
timestamp: December 05, 2024, 04:28:39 pm
content: I'm on macos, but with some esp32 boards, I have two usb serial ports... one named as chusbserial000 and the other as wchusbserial000only the wchusbserial works to upload to the board.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 05, 2024, 05:53:56 pm
content: 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.

author: westfw
author_rank: Super Contributor
timestamp: December 06, 2024, 01:59:40 am
content: QuoteEspressif 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...QuoteYeah; 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/BoardListManagerif you're adventuresome)You can manually edit the boards.txt file if you want.

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 06, 2024, 07:01:13 am
content: Quote from: westfw on December 06, 2024, 01:59:40 amIt 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 from: westfw on December 06, 2024, 01:59:40 amI'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.

author: tooki
author_rank: Super Contributor
timestamp: December 06, 2024, 12:28:05 pm
content: 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.

author: westfw
author_rank: Super Contributor
timestamp: December 07, 2024, 08:07:55 am
content: QuoteWell, 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...

author: pcprogrammer
author_rank: Super Contributor
timestamp: December 07, 2024, 08:55:04 am
content: Quote from: westfw on December 07, 2024, 08:07:55 amI'm a bit of a MCU dev board hoarder.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.

author: tooki
author_rank: Super Contributor
timestamp: December 07, 2024, 09:32:56 am
content: Quote from: pcprogrammer on December 07, 2024, 08:55:04 amThe 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.jpgQuote from: pcprogrammer on December 07, 2024, 08:55:04 amThe C2, C3, C6, and H2 are RISC-V.As I understand it, all future ESP32 models will be RISC-V.

author: djsb
author_rank: Super Contributor
timestamp: December 07, 2024, 10:29:51 am
content: I've been using this one and have had no problems so farhttps://www.mouser.co.uk/ProductDetail/Espressif-Systems/ESP32-DevKitC-32E?qs=GedFDFLaBXFpgD0kAZWDrQ%3D%3DI 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.

author: tooki
author_rank: Super Contributor
timestamp: December 07, 2024, 12:32:11 pm
content: Quote from: djsb on December 07, 2024, 10:29:51 amThe 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.