ESP32-S2 USB-CDC Flashing (Arduino)

ozgbostan
Posts: 16
Joined: Sat Oct 31, 2020 7:19 am

ESP32-S2 USB-CDC Flashing (Arduino)

Postby ozgbostan » Thu Feb 11, 2021 8:19 am

Hi All,

I have tried and used successfully the esp-idf version of USB CDC by enabling "USB Console" feature to upload the firmwares. Besides, it's possible to read and write from/to any serial terminal as well. However, there is a problem on Arduino IDE side, how could it be possible to use native USB (with the help of CDC) for uploading the sketches with auto-boot and auto-reset feature? I mean, without having any intervention or any manipulation with boot and reset buttons.

Thanks in advance for your support and interest.

Miraculix
Posts: 15
Joined: Wed Sep 16, 2020 9:43 am

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby Miraculix » Thu Feb 11, 2021 8:03 pm

I don't think that's natively possible with the S2. If I remember correctly it will be possible with the S3 (or was it C3?)

Maybe it's possible to write something like the OTA update. Code which accepts uploading of the compiled binaryover USB serial and then flashes it. Won't be easy to make it work with the IDE however.

ozgbostan
Posts: 16
Joined: Sat Oct 31, 2020 7:19 am

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby ozgbostan » Thu Feb 11, 2021 8:44 pm

Miraculix wrote:
Thu Feb 11, 2021 8:03 pm
I don't think that's natively possible with the S2. If I remember correctly it will be possible with the S3 (or was it C3?)

Maybe it's possible to write something like the OTA update. Code which accepts uploading of the compiled binaryover USB serial and then flashes it. Won't be easy to make it work with the IDE however.
No, it's absolutely possible and I had succeeded with esp-idf. You can have the link below.

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

The problem is the implementation of that feature on Arduino side. It's working properly with esp-idf.

On Ardunio, "tinyusb stack" is used, but it was not possible for me to use the usb cdc feature, it does not get active.

The simplest solution might be the implementation of "USB Console" feature of ROM bootloader to the Arduino Core.

Is not there anyone who got that solution or any idea how to solve it?

It is a "must have feature" though, it is not acceptable to use Arduino IDE without USB CDC (DFU) option for uploading the sketches. If you have a built-in USB peripheral, then you must have that option on your IDE.

Waiting for your valuable considerations and help...

chegewara
Posts: 1393
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby chegewara » Thu Feb 11, 2021 9:35 pm

Maybe you will provide more info about your setup. There is no issue to flash esp32 S2 over native USB as long as there is already installed CDC, because arduino IDE has to recognize device and USB port. The only issue i have, dont remember if always, is the reset after flashing.

ozgbostan
Posts: 16
Joined: Sat Oct 31, 2020 7:19 am

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby ozgbostan » Thu Feb 11, 2021 10:15 pm

chegewara wrote:
Thu Feb 11, 2021 9:35 pm
Maybe you will provide more info about your setup. There is no issue to flash esp32 S2 over native USB as long as there is already installed CDC, because arduino IDE has to recognize device and USB port. The only issue i have, dont remember if always, is the reset after flashing.
It's not possible, I mean I cannot succeed, to install CDC feature. It's OK while using download mode with reset and boot button. However, as the CDC does not installed properly, there is no port available after uploading finished and pushed reset button. No auto boot, no auto reset due to not having properly installed CDC.

How could it possible to install CDC feature to have a proper operation?

chegewara
Posts: 1393
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby chegewara » Thu Feb 11, 2021 11:41 pm

The easiest way is to install empty sketch with "Serial connected to: USB CDC" and then all your builds with that option will flash without using boot button.

ozgbostan
Posts: 16
Joined: Sat Oct 31, 2020 7:19 am

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby ozgbostan » Fri Feb 12, 2021 6:51 am

chegewara wrote:
Thu Feb 11, 2021 11:41 pm
The easiest way is to install empty sketch with "Serial connected to: USB CDC" and then all your builds with that option will flash without using boot button.
I have tried different sketches with "Serial connected to USB CDC" option, but unfortunately no success.

I am using ESP32-S2 Saola board and the OS is Win 10, could be a problem related to OS?

chegewara
Posts: 1393
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby chegewara » Fri Feb 12, 2021 10:17 pm

I have to apology, looks like it is not working now for some reason, but it was before. Here you can find discussion and confirmation it has been added to arduino (maybe it will help):
https://github.com/espressif/arduino-es ... -633761259

ozgbostan
Posts: 16
Joined: Sat Oct 31, 2020 7:19 am

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby ozgbostan » Fri Feb 12, 2021 11:29 pm

chegewara wrote:
Fri Feb 12, 2021 10:17 pm
I have to apology, looks like it is not working now for some reason, but it was before. Here you can find discussion and confirmation it has been added to arduino (maybe it will help):
https://github.com/espressif/arduino-es ... -633761259
Thanks for the discussion. You have anything in your mind to recommend as a solution?

chegewara
Posts: 1393
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32-S2 USB-CDC Flashing (Arduino)

Postby chegewara » Sun Feb 21, 2021 8:08 pm

ozgbostan wrote:
Fri Feb 12, 2021 11:29 pm
Thanks for the discussion. You have anything in your mind to recommend as a solution?
I investigated it a bit today and there is something changed in tinyusb library which is in idf-release/v4.2, since branch esp32s2 works good, and by works good i mean if you have flashed USBSerial example from branch esp32s2, then you can flash anything over native USB from any branch. Currentlu USBSerial example cant be installed, due some issue in tinyusb and misconfiguration.

Who is online

Users browsing this forum: No registered users and 24 guests