-
-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32-S2 Upload via USB CDC without Manually Entering Bootloader #591
Comments
I am having the same issue on a Mac (so not windows specific). Pretty sure PIO doesn't do this step Is there a way we can force that? https://docs.platformio.org/en/latest/platforms/espressif8266.html#reset-method |
Note that you may still want to have a boot/reset button (or other method, like a header) on your board, as the DTR/RTS implementation is in software: the USB driver emulates a CDC-ACM serial port and looks at the 'virtual' DTR/RTS lines on that to reset the chip into download mode. If the software crashes the board, or if the user wants to re-purpose the USB peripheral or GPIO pins for something else, there is no way to get into download mode using purely USB anymore. (Also indeed because depending on the software in flash, the first download still needs to have a manual reset, as mentioned above.) |
@Jason2866 understood and agreed, but development is a real pain if you have to go to bootloader mode manually every time you change something. I don't need to do that with Arduino, but I do with PIO |
@calcut yeah, thats why i use for development S2 boards with hardware USB-serial chips on the PCB. |
I am facing the same issue. I am using |
This sucks, what is the solution for this? @valeros How is this fixed? |
@tablatronix This is fixed with the commit mentioned. |
We have found that we are not able to upload a sketch to an ESP32-S2 via USB CDC without first manually putting the ESP into bootloader mode using PIO. This works as expected in Arduino IDE, but the behaviour is different in PIO.
I've done some investigating and found that the following workaround allows PIO to upload without manually entering bootloader, and I think I can see what's going wrong. First the workaround:
Why does this work? There are a couple of things happening, I believe starting from the fact that as we know, the ESP is being put into bootloader mode by pulsing the DTR and RTS serial lines. When the ESP goes into bootloader mode, it often enumerates with a different COM port number to what it is on when running CDC in the user's sketch. The PIO implementation (using ESPTool.py) wants you to select a single COM port for upload, so when you run the upload it pulses the DTR and RTS lines and the ESP reboots, but then reappears on a different COM port. Therefore when ESPTool.py tries to find the defined COM port to transfer the .bins it fails.
It appears that Arduino IDE does it slightly differently to get around this. It first pulses the DTS and RTS lines on the chosen CDC COM Port, then actively looks for the new COM port number of the ESP, then launches ESPTool.py upload with that new COM port.
Verbose upload in Arduino IDE gives this output, showing the active search for the new COM port:
I realise that this might be unique to the Windows environment due to the way Windows deals with serial ports.
Having, I believe, identified the problem; I have no idea how to go about resolving it. Please can you help?
This investigation came about after an issue was raised on the ESPTinyUSB repo, but we then realised it isn't specifically related to that library.
The text was updated successfully, but these errors were encountered: