Reading/Writing to a USB Flash Drive with DFR1145 firebeetle 2 ESP32-S3 as USB host

Hi ! I have been working on a project for the past month on Arduino IDE. I have to now implement a feature that lets me use my MCU (ESP32 -S3 - DFR1145 FireBeetle 2 ) as a USB host to connect a mass storage device (most likely a USB Flash drive or a SD card reader ).

I wish to transfer all the log files I have on an SD card connected to my MCU, to a Flash Drive. My problem is, I cannot seem to find anything useful in the arduino core to help me use my esp32-s3 as a USB-CDC Host device.

The closest I have come is through this library : GitHub - chegewara/EspTinyUSB: ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update). . It still fails to compile and says hal/usb_hal.h is missing, which I figured was because of me using arduino-esp32 v3.x., instead of v2.x. I downgraded to 2.0.17, yet I haven't achieved any success.

Digging around, I have been led to believe that the Arduino Core for ESP32 has limited native USB Host support, so ESP-IDF is recommended for direct access to USB Host libraries. The thing is, I am fairly new to embedded programming, totally out of my depth when it comes to ESP-IDF. I am trying but have not gotten any success at all.

Can someone please point me to the right direction ? Any example of reading/writing to a mass storage device as a USB host. Any teeny-tiny implementation that I can leverage to make further progress. Thanks a lot, in advance.

First read the pinned post re 'How to get the most from the forum'.
Tell us OS, show a schematic, photo of hand drawn well labelled is ok. Post all the code in code tags, post any error logs also in code tags. Also look at last picture of your board, see anything to do with USB there?
Does your board have two USB-C ports? One is for USB one is for xxxx. Also what are your settings (see pic) do you think any of those might have a bearing on what you are doing?


Sorry for not paying attention to forum rules. I have been running really overworked, my bad. I went through the post you recommended. Thank You.

So, my board is a DFR-1145 FireBeetle2 ESP32-S3 (N4) - DFR-1145 wiki.

It has one USB-C port that I have been using to flash and monitor serial on (Hardware CDC & JTAG ?). The second I believe are the USB OTG pinouts ? IO19/D- & IO20/D+

I have been trying to make use of chegewara's ESPTinyUSB to implement the USB Host funtionality. I am trying to run
EspTinyUSB/examples/host
/msc/ example.

I have connected a female USB-A breakout board to the MCU

Initially, the sketch didn't compile as the library is not compatible with arduino-esp32 v3.x because of the header changes in ESP-IDF 5.X. Relevant Issue Thread
So, I rolled-back to arduino-esp-32 v2.0.10. Now, the code does compile, but gives me a warning -

warning: alignment 1 of symbol `ff_raw_handles' in ..\libraries\ESP32TinyUSB\host\msc\vfs\diskio_rawmsc.cpp.o is smaller than 4 in ..\Arduino15\packages\esp32\hardware\esp32\2.0.10/tools/sdk/esp32s3/lib\libfatfs.a(diskio_rawflash.c.obj)

Also, nothing happens. Here's a screenshot of my settings

Am I even partially on the right trajectory ? Any pointers ? I am completely lost.

Here's the host/msc sketch that I've been trying to run.

Try changing the first setting USB CDC On Boot to Disabled

Tried disabling USB CDC on Boot, doesn't work either.

Try reaching out to DFRobot, it's their board.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.