Arduino-ESP32S2 USB drag and drop

joe_fang_iD
Posts: 16
Joined: Thu Aug 01, 2019 11:59 pm

Arduino-ESP32S2 USB drag and drop

Postby joe_fang_iD » Mon Aug 10, 2020 10:49 pm

My goal is to use arduino-esp32s2 to include both neopixel libraries as well as USB On-The-Go, for its drag and drop features. I'm having difficulty on the USB OTG side. I guess my first general question is, is Arduino-esp32s2 USB drag and drop possible right now?

Setup:
ESP32-S2-WROOM (Do I need to use the wrover?)
ESP-IDF v4.3-dev-771-gc77c4ccf6-dirty

Several things I've tried:

1. Default IDF's tusb_sample_descriptor example (I know this is not arduino-esp32s2). It compiles and runs, but I don't know how to convert it to usb drag and drop. When I Enable Mass Storage TinyUSB driver and use the MassStorage Class demo, it fails during linkage with the following message:

FAILED: tusb_sample_descriptor.elf
cmd.exe /C "cd . && C:\Users\joe_fang\.espressif\tools\xtensa-esp32s2-elf\esp-2020r2-8.2.0\xtensa-esp32s2-elf\bin\xtensa-esp32s2-elf-g++.exe -mlongcalls @CMakeFiles\tusb_sample_descriptor.elf.rsp -o tusb_sample_descriptor.elf && cd ."
c:/users/joe_fang/.espressif/tools/xtensa-esp32s2-elf/esp-2020r2-8.2.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.2.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: tusb_sample_descriptor.elf section `.dram0.data' will not fit in region `dram0_0_seg'
c:/users/joe_fang/.espressif/tools/xtensa-esp32s2-elf/esp-2020r2-8.2.0/xtensa-esp32s2-elf/bin/../lib/gcc/xtensa-esp32s2-elf/8.2.0/../../../../xtensa-esp32s2-elf/bin/ld.exe: region `dram0_0_seg' overflowed by 5840 bytes

2. Chegewara's ESP-IDF tinyusb examples: Same issue as 1. dram0_0 issues.
3. Chegewara's Arduino-esp32s2 EspTinyUSB library, both the MSC and the all_in_one examples. They give me the following during runtime:

ELF file SHA256: 0000000000000000

Rebooting...
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x3 (RTC_SW_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40025c41
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe8100,len:0x4
load:0x3ffe8104,len:0x570
load:0x40050000,len:0x1620
load:0x40054000,len:0x1a04
entry 0x40050280
Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.

Core 0 register dump:
PC : 0x4001abc8 PS : 0x00060030 A0 : 0x80080e89 A1 : 0x3ffc8a90
A2 : 0x00000000 A3 : 0x3ffbda30 A4 : 0x00001400 A5 : 0x00000000
A6 : 0x4d903ceb A7 : 0x534f4453 A8 : 0x3ffbee30 A9 : 0x3ffc8a60
A10 : 0x00000000 A11 : 0x00000400 A12 : 0x00000000 A13 : 0x00000003
A14 : 0x3ffc2720 A15 : 0x3ffc8b44 SAR : 0x00000000 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000003 LCOUNT : 0x40026961

Backtrace:0x4001abc5:0x3ffc8a90 |<-CORRUPTED



One of the examples did say that I had to use the wrover, so maybe if I used a ESP32-S2-WROVER, the arduino library would work?

Additional Question:

Can I implement drag-and-drop features using USB CDC instead of TinyUSB?

ESP_Sprite
Posts: 9709
Joined: Thu Nov 26, 2015 4:08 am

Re: Arduino-ESP32S2 USB drag and drop

Postby ESP_Sprite » Tue Aug 11, 2020 11:16 am

Not sure what your issue with getting the example to run is, but do be aware that drag-and-drop is far from trivial to implement... and no, you need mass storage and cannot use CDC.

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

Re: Arduino-ESP32S2 USB drag and drop

Postby chegewara » Tue Aug 11, 2020 12:40 pm

Hi,
you could start with my fork of esp-idf with my changes to tinyUSB component and this example:

https://github.com/chegewara/esp-idf/tr ... sample_msc

In arduino library you can change this value to make it works on S2 wroom:
https://github.com/chegewara/EspTinyUSB ... disk.c#L42

and then change this to not allocate from SPIRAM:
https://github.com/chegewara/EspTinyUSB ... isk.c#L122

Or you can try to use original file from tinyusb here:
https://github.com/hathach/tinyusb/blob ... msc_disk.c


Like ESP_Sprite said, you cant use this feature with CDC, it has to be MSC device and i have app that is doing exactly this.
Example dfu.bin can be downloaded from my website and flashed using dfu-utl on linux or dfu website:
https://usb.esp32.eu.org/msc-ota/
https://usb.esp32.eu.org/dfu-util/

PS i dont remember if dfu.bin was prepared to use with wroom or wrover, sorry

Who is online

Users browsing this forum: DonEvans and 85 guests