Page 1 of 1
Update esp32s2 via USB drive
Posted: Wed Jun 29, 2022 12:26 pm
by _Rens_
Hi all,
For a project i need to update the esp32s2 via a usb drive, (data pins connected to pin 19 and 20). For this i need to read a file from the usb drive and use this to update the code of the esp32s2.
I have tried the usb host examples from the esptinyusb library, but all fail to compile. Also the examples look like they have been writing for the espressif ide.
Does anybody have an example for the arduino ide that i can test and modify for the usb (drive) update?
Re: Update esp32s2 via USB drive
Posted: Sun Jul 03, 2022 7:04 am
by zyghom
all USB examples on my Arduino compile ok - check the settings again of your Arduino
Re: Update esp32s2 via USB drive
Posted: Tue Jul 05, 2022 9:52 am
by chegewara
I can confirm. With arduino-esp32 v2.0.3 host msc example can buid for both, S2 and S3.
Re: Update esp32s2 via USB drive
Posted: Wed Jul 06, 2022 3:12 pm
by _Rens_
chegewara wrote: ↑Tue Jul 05, 2022 9:52 am
I can confirm. With arduino-esp32 v2.0.3 host msc example can buid for both, S2 and S3.
The msc example works for me to on the arduino-esp32 v2.0.3 after changing all LOGI to printf.
Which variant of the ota did you use for the updating?
I am currently testing with a mixture of the msc and sd_update example from arduino, but the update.h library can't use the fopen. I'll be looking into that later today.
Re: Update esp32s2 via USB drive
Posted: Thu Jul 07, 2022 1:41 am
by chegewara
Since i dont know ArduinoOTA library and even with arduino i prefer to use esp-idf API whenever i can, i made PoC app with esp-idf ota API.
It is simple code, with no error handling etc, but works good.
Re: Update esp32s2 via USB drive
Posted: Wed Jul 13, 2022 2:43 pm
by _Rens_
I managed to get the code to begin and write the update to the partition, but no matter how i write it or what i do it keeps failing with the validation when calling esp_ota_end();
Anybody who knows what could be wrong? The update.bin file is created in the arduino ide by exporting it as a bin file. Reading the file works without any issue, but updating turned out to be more difficult.
The code i got until now:
https://pastebin.com/q7yyES0v
Arduino esp32 v2.0.4
tinyusb v2.0.1
Re: Update esp32s2 via USB drive
Posted: Thu Jul 14, 2022 12:46 am
by ESP_Sprite
fgets() is used for strings and handles null bytes as the end of those. OTA files are binary; use fread() instead.
Re: Update esp32s2 via USB drive
Posted: Thu Jul 14, 2022 12:18 pm
by _Rens_
Yes the code works now, i can update the esp32s2 now. The problem was indeed with fgets().
Re: Update esp32s2 via USB drive
Posted: Thu Jan 12, 2023 6:56 pm
by doctorsnap
The link seems to be out of date. Any chance for an update?
On the same problem now and getting all kinds of strange errors.
ESP32-S3-DevKitC-1 v1.1
Arduino esp32 v2.0.4
Tinyusb v2.0.1
_Rens_ wrote: ↑Wed Jul 13, 2022 2:43 pm
I managed to get the code to begin and write the update to the partition, but no matter how i write it or what i do it keeps failing with the validation when calling esp_ota_end();
Anybody who knows what could be wrong? The update.bin file is created in the arduino ide by exporting it as a bin file. Reading the file works without any issue, but updating turned out to be more difficult.
The code i got until now:
https://pastebin.com/q7yyES0v
Arduino esp32 v2.0.4
tinyusb v2.0.1