Page 1 of 1

ESP32-S2 flashing with built in USB

Posted: Mon Nov 09, 2020 5:29 am
by becorey
The ESP32-S2 has built in USB, and the docs say it can be used to flash the device with esptool. To me it seems like a nice cost savings and space savings to be able to go without a usb to uart chip like CP2104 or CH340.

https://docs.espressif.com/projects/esp ... nsole.html

The adafruit S2 feather does not have a uart chip, but it does have a button for boot loading (no auto flash).
The ESP32-S2-SAOLA-1MI used a CP2104 for usb.

The usb to uart chip gives you DTR and RTS, that's how the standard auto flash circuit toggles EN while holding GPIO0 low. But the docs on usb just say to connect D+ and D- to GPIO19 and 20. If there were any signal like DTR and RTS it would be within the ESP32-S2.

Any chance it could work to use the built in USB for flashing, but still get the auto reset feature? I'd really like to make a dev board that can flash over usb and doesn't require pressing any buttons.

Re: ESP32-S2 flashing with built in USB

Posted: Tue Nov 17, 2020 2:50 pm
by felmue
Hello becorey

interesting feature, I did not know the ESP32-S2 can be flashed and monitored like this. Anyhow, having an ESP32-S2 Kaluga-1 board at hand I figured I give it a try. Works like a charm.

Re auto flash: that actually works without additonal connections. Downloading the application the first time requires setting the board into download mode manually. After that, starting the download happens automatically. Really nice.

Thanks
Felix

Re: ESP32-S2 flashing with built in USB

Posted: Wed Nov 18, 2020 1:55 am
by ESP_Sprite
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.)

Re: ESP32-S2 flashing with built in USB

Posted: Wed Nov 18, 2020 3:05 am
by becorey
OK, on my board I'll take out the usb to serial chip but keep a BOOT button. That's still a nice cost savings, and roughly the same for pcb area.
Thanks!