Upload of code over USB/Serial fails because of erroneous code
Issue #1375
In case you messed up your code and cannot program your ESP32 anymore over USB, e.g. you used Serial0 and assigned it to pins that are not connected to the Serial/USB bridge there are two ways to get the ESP32 into download mode
- If you have buttons for reset and gpio0, you can hold down gpio0 and then press reset. This will put the esp32 in a “waiting for download” state and you can then upload good code.
- Run
python esptool.py erase_flash
from the command line. This will wipe all code from the device (including the nvs partition).
Credits to Ibernstone for posting the answer.