ESP32 flash issue

The problem started while I was able to program and flash my ESP32Devkitc_v4 with no issues at all but I was trying to programm another board that is ESP32-S2-Solo and was not able to upload any thing to it I kept trying and installing drivers for it (CP210x from silicone lab) which I have no luck with it what so ever so I decided to use the original one for my new project but when I try to connect it and test upload program to it I found that it is always failing to upload with different errors each time.

Also I am not able to connect to the USB port through the serial monitor for more than few seconds then it stops showing any messages on the terminal.

I tried to uninstall the driver and revert back all the changes with no luck.

I am using IDE v2.3.2 on a mac pro running Sonoma and the CP210x is version 6.0

Please help me I am stuck

Hi @samyamer12.

I'm going to ask you to provide the full verbose output from an upload attempt.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Uncheck the box next to Show verbose output during: compile in the "Preferences" dialog.
  3. Check the box next to Show verbose output during: ☐ upload.
  4. Click the "OK" button.
    The "Preferences" dialog will close.
  5. Attempt an upload, as you did before.
  6. Wait for the upload to fail.
  7. You will see an "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
  8. Open a forum reply here by clicking the "Reply" button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code block icon on toolbar
  10. Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code block markup before you add any additional text to your reply.
  12. Click the "Reply" button to post the output.
Sketch uses 740853 bytes (56%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45912 bytes (14%) of dynamic memory, leaving 281768 bytes for local variables. Maximum is 327680 bytes.
"/Users/ahmedamer/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool" --chip esp32 --port "/dev/cu.usbserial-0001" --baud 115200  --before default_reset --after hard_reset write_flash  -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bootloader.bin" 0x8000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.partitions.bin" 0xe000 "/Users/ahmedamer/Library/Arduino15/packages/esp32/hardware/esp32/2.0.16/tools/partitions/boot_app0.bin" 0x10000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bin" 
Traceback (most recent call last):
  File "esptool.py", line 34, in <module>
  File "esptool/__init__.py", line 1032, in _main
  File "esptool/__init__.py", line 674, in main
  File "esptool/__init__.py", line 920, in get_default_connected_device
  File "esptool/loader.py", line 312, in __init__
  File "esptool/loader.py", line 328, in _set_port_baudrate
  File "serial/serialutil.py", line 299, in baudrate
  File "serial/serialposix.py", line 517, in _reconfigure_port
termios.error: (22, 'Invalid argument')
[1609] Failed to execute script 'esptool' due to unhandled exception!
esptool.py v4.5.1
Serial port /dev/cu.usbserial-0001
Failed uploading: uploading error: exit status 1
Sketch uses 740853 bytes (56%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45912 bytes (14%) of dynamic memory, leaving 281768 bytes for local variables. Maximum is 327680 bytes.
"/Users/ahmedamer/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool" --chip esp32 --port "/dev/cu.SLAB_USBtoUART" --baud 115200  --before default_reset --after hard_reset write_flash  -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bootloader.bin" 0x8000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.partitions.bin" 0xe000 "/Users/ahmedamer/Library/Arduino15/packages/esp32/hardware/esp32/2.0.16/tools/partitions/boot_app0.bin" 0x10000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bin" 
Traceback (most recent call last):
  File "esptool.py", line 34, in <module>
  File "esptool/__init__.py", line 1032, in _main
  File "esptool/__init__.py", line 674, in main
  File "esptool/__init__.py", line 920, in get_default_connected_device
  File "esptool/loader.py", line 302, in __init__
  File "serial/__init__.py", line 90, in serial_for_url
  File "serial/serialposix.py", line 332, in open
  File "serial/serialposix.py", line 517, in _reconfigure_port
termios.error: (22, 'Invalid argument')
[1753] Failed to execute script 'esptool' due to unhandled exception!
esptool.py v4.5.1
Serial port /dev/cu.SLAB_USBtoUART
Failed uploading: uploading error: exit status 1

Thank you so much for your reply, I sent two outputs trying both interfaces that showed up

Both were trying using ESP32 Dev Module

Thanks again

This is while changing the flash mode to be QIO

Sketch uses 740853 bytes (56%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45912 bytes (14%) of dynamic memory, leaving 281768 bytes for local variables. Maximum is 327680 bytes.
"/Users/ahmedamer/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool" --chip esp32 --port "/dev/cu.SLAB_USBtoUART" --baud 115200  --before default_reset --after hard_reset write_flash  -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bootloader.bin" 0x8000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.partitions.bin" 0xe000 "/Users/ahmedamer/Library/Arduino15/packages/esp32/hardware/esp32/2.0.16/tools/partitions/boot_app0.bin" 0x10000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bin" 
esptool.py v4.5.1
Serial port /dev/cu.SLAB_USBtoUART
Connecting.....
Chip is ESP32-D0WDQ6 (revision v1.0)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz

A fatal error occurred: Packet content transfer stopped (received 0 bytes)
Failed uploading: uploading error: exit status 2

The other interface

Sketch uses 740853 bytes (56%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45912 bytes (14%) of dynamic memory, leaving 281768 bytes for local variables. Maximum is 327680 bytes.
"/Users/ahmedamer/Library/Arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool" --chip esp32 --port "/dev/cu.usbserial-0001" --baud 115200  --before default_reset --after hard_reset write_flash  -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bootloader.bin" 0x8000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.partitions.bin" 0xe000 "/Users/ahmedamer/Library/Arduino15/packages/esp32/hardware/esp32/2.0.16/tools/partitions/boot_app0.bin" 0x10000 "/private/var/folders/hd/km_q9fr123d0m47pvv5f5ln40000gn/T/arduino/sketches/CFD734F8D5278FB592ADB907126AD9D2/SimpleTime.ino.bin" 
esptool.py v4.5.1
Serial port /dev/cu.usbserial-0001
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 2

Hi @ptillisch I did some changes to the IDE (removed libraries and boards and reinstalled all again) then now I am able to upload the program to the board however program does not run correctly I am getting the below output

19:45:52.478 -> Rebooting...
19:45:52.478 -> ets Jun  8 2016 00:22:57
19:45:52.478 -> 
19:45:52.478 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
19:45:52.478 -> configsip: 0, SPIWP:0xee
19:45:52.478 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:45:52.478 -> mode:DIO, clock div:1
19:45:52.478 -> load:0x3fff0030,len:1448
19:45:52.478 -> load:0x40078000,len:14844
19:45:52.478 -> ho 0 tail 12 room 4
19:45:52.478 -> load:0x40080400,len:4
19:45:52.478 -> load:0x40080404,len:3356
19:45:52.478 -> entry 0x4008059c
19:45:52.808 -> 
19:45:52.808 -> assert failed: tcpip_callback /IDF/components/lwip/lwip/src/api/tcpip.c:313 (Invalid mbox)
19:45:52.808 -> 
19:45:52.808 -> 
19:45:52.808 -> Backtrace: 0x40082465:0x3ffb20b0 0x4008d94d:0x3ffb20d0 0x40092e06:0x3ffb20f0 0x400e6297:0x3ffb2220 0x400e4305:0x3ffb2240 0x400d2938:0x3ffb2260 0x400d71bb:0x3ffb2290
19:45:52.839 -> 
19:45:52.839 -> 
19:45:52.839 -> 
19:45:52.839 -> 
19:45:52.839 -> ELF file SHA256: 74f607499b3732a5
19:45:52.839 -> 
19:45:52.839 -> Rebooting...
19:45:52.839 -> ets Jun  8 2016 00:22:57

Congratulations on finding a solution! I'm glad you are able to upload now. Thank you for taking the time to post an update.

Unfortunately, although I have sometimes been able to help people with upload problems, I'm not at all knowledgeable on the subject matter of this new problem you are experiencing. So I don't know that I'll be able to advise you on this. Fortunately some of the other forum helpers are more knowledgeable so they might be able to provide assistance.

Since it is surely unrelated to the original subject of this forum topic, my recommendation is for you to create a forum topic about the problem. That will ensure it will be noticed by the forum helpers who are knowledgeable in the subject area.

Thank you for your help and taking the time to reply,

hopefully some will be able to help in the new issue

1 Like

Great, thanks too.

@ptillisch & @jennifer2024 , Just let you know My issue has been resolved,

I tried a lot of solution I found on the internet where I found all of them are already applied in my case then finally I installed the IDE on a windows machine that I have and tested the board from there and it worked flawlessly after several comparisons the only difference I noticed is the version of the ESP32 board manager on the mac it was 3.0.0 and on widows it was 2.0.16 I uninstalled version 3.0.0 and installed 2.0.16 and viola every thing started working with no issues.

Hope this may help some one else that experience similar issue.

Thank you

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.