PlatformIO Community

Unable to upload to ESP32-EVB


#1

Hello !
I’ve been trying to upload a simple sketch into the ESP32-EVB but it doesn’t work.

This also doesn’t work with Arduino IDE.

Here’s what’s in the platformio.ini:

[env:esp32-evb]
platform = https://github.com/platformio/platform-espressif32.git#feature/stage
board = esp32-evb
framework = arduino
board_build.flash_mode = qio
upload_port = /dev/ttyUSB0
monitor_port = /dev/ttyUSB0
monitor_speed = 115200
upload_speed = 115200

Here’s the output:

CURRENT: upload_protocol = esptool
Looking for upload port...
Use manually specified: /dev/ttyUSB0
Uploading .pioenvs/esp32-evb/firmware.bin
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2

What do you think happened ?


#2

DOes the board have some kind of “Boot” or “Flash” button? On some Esp32 boards you have to hold down the right button while trying to flash it, not doing so could cause the error you are expiriencing.
If there is such a (or a similar) button on your board, try holding it down as soon as the output says “Serial port /dev/ttyUSB…” and hold it until it starts flashing.


#3

I thought that I don’t have to mention this. I am holding down the boot button.

I’ve also tried Holding down the boot button, then, without releasing it, pressing the Reset button and then release the boot button, which works on Arduino IDE and uploads the code, but it doesn’t on PlatformIO IDE.


#4

You may try to go into your PIO folder under C:\Users\<user>\.platformio\platforms\espressif32\builder\main.py and in line 266 "--before", "default_reset", change the default_reset to no_reset. You should then manually enter the board into bootloader mode as you have done previously (hold down flash-button, press reset, release flash-button) and then upload. If this suddenly works there is a problem with esptool.py being unable to reboot the ESP32 into bootloader mode by controlling DTR/RTS lines of the CH340T chip (schematics), which may indicate a wrong hardware design of the board or a driver problem.


#5

Thank you for your answer !

I’ve replaced default_reset' withno_reset` and now I, randomly get the following error:

Looking for upload port...
Use manually specified: /dev/ttyUSB0
Uploading .pioenvs/esp32-evb/firmware.bin
esptool.py v2.6
Traceback (most recent call last):
File "/home/george/.platformio/packages/tool-esptoolpy/esptool.py", line 2959, in <module>
_main()
File "/home/george/.platformio/packages/tool-esptoolpy/esptool.py", line 2952, in _main
main()
File "/home/george/.platformio/packages/tool-esptoolpy/esptool.py", line 2652, in main
esp = chip_class(each_port, initial_baud, args.trace)
File "/home/george/.platformio/packages/tool-esptoolpy/esptool.py", line 222, in __init__
self._port = serial.serial_for_url(port)
File "/home/george/.platformio/penv/local/lib/python2.7/site-packages/serial/__init__.py", line 88, in serial_for_url
instance.open()
File "/home/george/.platformio/penv/local/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
Serial port /dev/ttyUSB0
*** [upload] Error 1

When I don’t get this error, I still can’t upload sketches to the ESP from PlatformIO.