esp32 s2 tinyUSB
esp32 s2 tinyUSB
I would like to share good news. Today i finished updating tinyUSB component to master branch and have prepared 3 useful and really cool examples https://github.com/chegewara/esp-idf/tr ... herals/usb:
- CDC usb, communication device class, which allows to connect with any terminal like putty and communicate with system, possible use case AT commands etc, alternative to UART, but using native USB,
- MSC, mass storage class, can be used like a common pendrive, for now example is using only internal ram (small ram disk), possible use case - OTA update by drag and drop, adding SD card will make even more use cases,
- webUSB, usb device controlled from web browser without using wifi, currently example is using website terminal to send message to esp32s2 and esp32s2 is echoing it, also its possible to connect with putty at the same time and text between website esp32 and putty, another example project what can be done with webusb https://github.com/sowbug/weblight, another use case is setup wifi credentials and all other device setting using cloud hosted website, without need to run AP
Still few more usb device types left, like HID or MIDI.
esp-idf PRs on the way, lets hope can be merged soon.
WebUSB: MSC disk: MSC disk benchmark:
- CDC usb, communication device class, which allows to connect with any terminal like putty and communicate with system, possible use case AT commands etc, alternative to UART, but using native USB,
- MSC, mass storage class, can be used like a common pendrive, for now example is using only internal ram (small ram disk), possible use case - OTA update by drag and drop, adding SD card will make even more use cases,
- webUSB, usb device controlled from web browser without using wifi, currently example is using website terminal to send message to esp32s2 and esp32s2 is echoing it, also its possible to connect with putty at the same time and text between website esp32 and putty, another example project what can be done with webusb https://github.com/sowbug/weblight, another use case is setup wifi credentials and all other device setting using cloud hosted website, without need to run AP
Still few more usb device types left, like HID or MIDI.
esp-idf PRs on the way, lets hope can be merged soon.
WebUSB: MSC disk: MSC disk benchmark:
Re: esp32 s2 tinyUSB
Here is another test. This time i am using port of tinyusn library with arduino as component. Board is kaluga, and disk is in spiram, disk size 1MB:
Re: esp32 s2 tinyUSB
I played with USB and tinyusb for some time recently and i prepared small, not finished, library that can show how it is going to be easy to use it with arduino. There is few examples prepared to show few USB classed at work. Code is prepared to work as arduino as component, sorry for that:
https://github.com/chegewara/esp32s2-ti ... -component
https://github.com/chegewara/esp32s2-ti ... -component
Re: esp32 s2 tinyUSB
I have another cool example how to use USB on S2. This time its MSC class (mass storage) to OTA update device with drag n drop.
Its enough to copy new binary to esp32 which works like a pendrive and new firmware will be flashed and start from OTA partition.
Code is still messy, but for all who would like to test it here is dfu.bin that can be flashed and tested.
PS i forgot to mention, there is implemented factory reset with pin 21, so it can be updated as many times as you want
Here is arduino as component code:
https://github.com/chegewara/esp32s2-msc-ota
Its enough to copy new binary to esp32 which works like a pendrive and new firmware will be flashed and start from OTA partition.
Code is still messy, but for all who would like to test it here is dfu.bin that can be flashed and tested.
PS i forgot to mention, there is implemented factory reset with pin 21, so it can be updated as many times as you want
Here is arduino as component code:
https://github.com/chegewara/esp32s2-msc-ota
Re: esp32 s2 tinyUSB
Hi,
i would like to share with another esp32 S2 demo using native USB. This time i have connected DS18d20 temp sensor and data are sent to webUSB. Whenever web page is opened and connected to esp32 data are received every 500ms and last 10 records are displayed with chart.js:
I know it is possible with old esp32 and web server, but here we dont need wifi connection to esp, website is hosted on internet.
i would like to share with another esp32 S2 demo using native USB. This time i have connected DS18d20 temp sensor and data are sent to webUSB. Whenever web page is opened and connected to esp32 data are received every 500ms and last 10 records are displayed with chart.js:
I know it is possible with old esp32 and web server, but here we dont need wifi connection to esp, website is hosted on internet.
Re: esp32 s2 tinyUSB
After some time i have "ready" but still not finished arduino library that i would like to share.
https://github.com/chegewara/EspTinyUSB
I hope you all can have so much fun and joy as i had studying it. Here is short list implemented features:
https://github.com/chegewara/EspTinyUSB
I hope you all can have so much fun and joy as i had studying it. Here is short list implemented features:
- CDC, communication device class,
- MSC, mass storage class,
- HID, human interface device class, this class is temporary hardcoded to use IN/OUT vendor HID,
- MIDI, musical instrument digital interface class,
- DFU, device firmware update class,
- WebUSB, its using vendor class to show webusb usage.
-
- Posts: 9709
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp32 s2 tinyUSB
Thanks for posting this! The ESP32-S2 still is a pretty new chip, and it's good to have some coverage of the features the USB peripheral has / can be used for.
Re: esp32 s2 tinyUSB
Hi @ESP_Sprite
i think it is temporary library, because i know espressif is working on arduino tinyusb. Actually there is already added official library with USB CDC.
Please check PM
i think it is temporary library, because i know espressif is working on arduino tinyusb. Actually there is already added official library with USB CDC.
Please check PM
-
- Posts: 16
- Joined: Thu Aug 01, 2019 11:59 pm
Re: esp32 s2 tinyUSB
Hi, I've been trying out your IDF and arduino-esp32s2 libraries:
Setup:
ESP32-S2-WROOM (Do I need to use the wrover?)
ESP-IDF v4.3-dev-771-gc77c4ccf6-dirty
1. The ESP-IDF MSC example 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. Arduino-esp32s2 EspTinyUSB library, both the MSC and the all_in_one example. 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?
Setup:
ESP32-S2-WROOM (Do I need to use the wrover?)
ESP-IDF v4.3-dev-771-gc77c4ccf6-dirty
1. The ESP-IDF MSC example 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. Arduino-esp32s2 EspTinyUSB library, both the MSC and the all_in_one example. 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?
Re: esp32 s2 tinyUSB
Hi,
this has been answered in another post on forum.
Today i would like to share good news. I have first on the world (or maybe not) working ESP32 S2 pendrive that can read SD card over SPI.
Code is working with a bit changed arduino-esp32 and my library. Its not super speed, i would say it slow, yet, but it is working and can be read/write by OS (tested with linux) and still can be read/write by esp32 like usual.
Here for comparison is benchmark of RAM disk from the same code:
this has been answered in another post on forum.
Today i would like to share good news. I have first on the world (or maybe not) working ESP32 S2 pendrive that can read SD card over SPI.
Code is working with a bit changed arduino-esp32 and my library. Its not super speed, i would say it slow, yet, but it is working and can be read/write by OS (tested with linux) and still can be read/write by esp32 like usual.
Here for comparison is benchmark of RAM disk from the same code:
Who is online
Users browsing this forum: No registered users and 53 guests