EspTinyUSB icon indicating copy to clipboard operation
EspTinyUSB copied to clipboard

msc flashdisk compile error on Platformio with ESP32-S2

Open PaffAngryDragon opened this issue 1 year ago • 1 comments

When compiling on VSC+Platformio with ArduinoEspressif 4.1.0 I get errors for missing FS.h and SD.h, which could be fixed by simply adding #include <...> lines. Next error is trickier: Compiling .pio\build\esp32-s2-saola-1\liba36\ESP32TinyUSB\host\msc\vfs\diskio_rawmsc.cpp.o .pio/libdeps/esp32-s2-saola-1/ESP32TinyUSB/src/host/common/usb_host.cpp: In member function 'bool USBhost::init(bool)': .pio/libdeps/esp32-s2-saola-1/ESP32TinyUSB/src/host/common/usb_host.cpp:72:5: error: 'const usb_host_client_config_t' has no non-static data member named 'is_synchronous' }; ^ *** [.pio\build\esp32-s2-saola-1\liba36\ESP32TinyUSB\host\common\usb_host.cpp.o] Error 1

It is because the struct declared is: const usb_host_client_config_t client_config = { .is_synchronous = false, .max_num_event_msg = 5, .async = { .client_event_callback = _client_event_callback, .callback_arg = this } }; but the defined usb_host_client_config_t declared in in esp32-s2 tools/sdk looks like this: ` /**

  • @brief USB Host Library Client configuration
  • Configuration structure for a USB Host Library client. Provided in usb_host_client_register() */ typedef struct { usb_host_client_event_cb_t client_event_callback; /< Client's event callback function */ void *callback_arg; /< Event callback function argument */ int max_num_event_msg; /**< Maximum number of event messages that can be stored (e.g., 3) */ } usb_host_client_config_t; Of course, I corrected it manually, but later run in some issues - perhaps because of this. I know that you are working on a new version - but until then, perhaps you could fix this issue? Or even better, if you have some version of MSC perhaps I could try it?

I am trying to write a program ewhere the esp32-s2 would have HIDUSB capability (done..) + become an USB MSC device with one FAT partition toward a PC and at the same time to have FATFS open on that partition (done, but separatelly of HIDUSB). When I try all three together I hit the wall for 2 dys now. All available USB librarys seems to have some issues with MSC +FAT on the internal flash of ESP32. `

PaffAngryDragon avatar Feb 04 '23 13:02 PaffAngryDragon

This library is working pretty good with MSC + FATFS, tested and confirmed by many users.

It is possible that API has been changed in arduino-esp32 (esp-idf) you are trying to build with. What you can do is to edit host code, or even to delete it, because you dont need it. You can also try to use my v2 library, but its still a bit messy, because ive been trying to write code compatible with arduino and esp-idf, which is not easy, because they are using different tinyusb ports (kind of sucks).

chegewara avatar Feb 04 '23 15:02 chegewara