ESP32-S2 flashing with built in USB

becorey
Posts: 92
Joined: Sat Mar 28, 2020 4:18 pm

ESP32-S2 flashing with built in USB

Postby becorey » Mon Nov 09, 2020 5:29 am

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.

felmue
Posts: 69
Joined: Mon Nov 16, 2020 2:55 pm

Re: ESP32-S2 flashing with built in USB

Postby felmue » Tue Nov 17, 2020 2:50 pm

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

ESP_Sprite
Posts: 9040
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-S2 flashing with built in USB

Postby ESP_Sprite » Wed Nov 18, 2020 1:55 am

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.)

becorey
Posts: 92
Joined: Sat Mar 28, 2020 4:18 pm

Re: ESP32-S2 flashing with built in USB

Postby becorey » Wed Nov 18, 2020 3:05 am

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!

Who is online

Users browsing this forum: No registered users and 63 guests