Hi, I am working with an ESP32s3,
this Espressif MSC code - https://github.com/espressif/esp-idf/tr ... e/tusb_msc
and this Espressif Composite CDC+MSC code - https://github.com/espressif/esp-idf/tr ... rialdevice
(there is more documentation relating to this code here - https://docs.espressif.com/projects/esp ... evice.html).
I want to use my ESP32s3 as a mass storage device, where I can access the files written in the ESP32s3 via the USB port. Using this single USB port, I also want to be able to re-flash new programs onto the ESP32s3 (ideally without having to use the buttons on the ESP32s3). Basically, dual use of the USB port on the ESP32s3 (this same dual use of the UART port would be great too, although I don't think it's possible).
Right now, I am able to access the files written to the ESP32s3 as a part of the mass storage device. However, once I am able to do that after initially flashing the ESP32s3 as an MSC via the USB port, I am unable to flash a new program onto the ESP32s3 via the USB port again (I have to switch to the UART port to flash the device with new code & the USB port is basically only usable as a way to look at the files stored as an MSC).
Flashing new Code to an ESP32s3 While it is Acting as a MSC
-
- Posts: 4
- Joined: Fri Jul 19, 2024 11:27 pm
-
- Posts: 9766
- Joined: Thu Nov 26, 2015 4:08 am
Re: Flashing new Code to an ESP32s3 While it is Acting as a MSC
Its possible in theory: you'd have to make a composite device with a MSC plus a CDC-ACM serial port, then hook up the DTR/RTS signals of the serial port to call something that resets the chip into bootloader mode. Not sure if anyone implemented that already, though.
Re: Flashing new Code to an ESP32s3 While it is Acting as a MSC
Yes, it should be possible with composite USB device, and without hardware DTR/RTS.
As far as i remember espressif arduino team implemented this some time ago.
Espressif is using "special pattern" to switch esp32 into download mode. Its some mix of software DTR/RTS and uart speed set to 1200bps.
When software detects this pattern we can set some registers, dont know which one, and restart esp32. After restart esp32 will be in download mode.
I see its now implemented 2 different ways in arduino:
https://github.com/espressif/arduino-es ... #L195-L230
https://github.com/espressif/arduino-es ... #L252-L253
Switch to rom jtag mode before restart:
https://github.com/espressif/arduino-es ... usb.c#L481
As far as i remember espressif arduino team implemented this some time ago.
Espressif is using "special pattern" to switch esp32 into download mode. Its some mix of software DTR/RTS and uart speed set to 1200bps.
When software detects this pattern we can set some registers, dont know which one, and restart esp32. After restart esp32 will be in download mode.
I see its now implemented 2 different ways in arduino:
https://github.com/espressif/arduino-es ... #L195-L230
https://github.com/espressif/arduino-es ... #L252-L253
Switch to rom jtag mode before restart:
https://github.com/espressif/arduino-es ... usb.c#L481
-
- Posts: 4
- Joined: Fri Jul 19, 2024 11:27 pm
Re: Flashing new Code to an ESP32s3 While it is Acting as a MSC
Do you know if there is anything like those implementation done through the ESP-IDF? Or how to do something like that with ESP-IDF?
All of my work so far that I am integrating this MSC into is with ESP-IDF so unfortunately I can't use the Arduino code. I'm also new to the MSC and CDC stuff so I'm not fully sure how I would go about converting that code to work for the ESP-IDF.
All of my work so far that I am integrating this MSC into is with ESP-IDF so unfortunately I can't use the Arduino code. I'm also new to the MSC and CDC stuff so I'm not fully sure how I would go about converting that code to work for the ESP-IDF.
Re: Flashing new Code to an ESP32s3 While it is Acting as a MSC
When you device is acting as an MSC and plugged into your PC why dont you just copy over you firmware's bin file to it and have it read that and flash itself?
Who is online
Users browsing this forum: Bing [Bot] and 170 guests