esp32 s2 tinyUSB

adamwilt
Posts: 13
Joined: Sun Dec 06, 2020 1:54 am

Re: esp32 s2 tinyUSB

Postby adamwilt » Fri Feb 05, 2021 5:59 am

Interesting: when I build msc_disk.c into the tinyusb component itself (specifically, in components/tinyusb/tinyusb/src/class/msc, alongside msc_device.c), it compiles and links with only the error
region `dram0_0_seg' overflowed by 11808 bytes
If I then change the DISK_BLOCK_NUM to 4 instead of 2 * 140, to avoid allocating 70kb of data, it links without any errors. (It may not run because the "disk" is too small, but at least it compiles and links cleanly).

Here's components/tinyusb/CMakeLists.txt file with msc_disk added to it. It's the stock CMakeLists.txt from espressif/esp-idf-master, with one line added to include msc_disk.c. The chegewara version of this CMakeLists.txt is very different: the most obvious change is that tinyusb as added as a library here, not compiled as a "normal" component as it is in the chegewara version. I'm guessing that this is at the root of the problem, but I'll have to learn a lot more about how these builds work before I can figure out how (or if!) I can make msc_disk work in its original location.

Code: Select all

idf_component_register(REQUIRES esp_rom freertos vfs soc)

if(CONFIG_USB_ENABLED)

  ### variables ###
  #################
  set(compile_options
      "-DCFG_TUSB_MCU=OPT_MCU_ESP32S2"
      "-DCFG_TUSB_DEBUG=${CONFIG_USB_DEBUG_LEVEL}"
      "-Wno-type-limits" # needed for the vanila tinyusb with turned off classes
  )
  idf_component_get_property(FREERTOS_ORIG_INCLUDE_PATH freertos
                             ORIG_INCLUDE_PATH)
  set(includes_private
      # tusb:
      "${COMPONENT_DIR}/tinyusb/hw/bsp/"
      "${COMPONENT_DIR}/tinyusb/src/"
      "${COMPONENT_DIR}/tinyusb/src/device"
      # espressif:
      "${COMPONENT_DIR}/additions/include_private"
      )

  set(includes_public
      # tusb:
      "${FREERTOS_ORIG_INCLUDE_PATH}"
      "${COMPONENT_DIR}/tinyusb/src/"
      # espressif:
      "${COMPONENT_DIR}/additions/include")
  set(srcs
      # espressif:
      "${COMPONENT_DIR}/additions/src/descriptors_control.c"
      "${COMPONENT_DIR}/additions/src/tinyusb.c"
      "${COMPONENT_DIR}/additions/src/tusb_tasks.c"
      "${COMPONENT_DIR}/additions/src/usb_descriptors.c"
      # tusb:
      "${COMPONENT_DIR}/tinyusb/src/portable/espressif/esp32s2/dcd_esp32s2.c"
      "${COMPONENT_DIR}/tinyusb/src/class/cdc/cdc_device.c"
      "${COMPONENT_DIR}/tinyusb/src/class/hid/hid_device.c"
      "${COMPONENT_DIR}/tinyusb/src/class/midi/midi_device.c"
      "${COMPONENT_DIR}/tinyusb/src/class/msc/msc_device.c"
      "${COMPONENT_DIR}/tinyusb/src/class/msc/msc_disk.c"
      "${COMPONENT_DIR}/tinyusb/src/class/vendor/vendor_device.c"
      "${COMPONENT_DIR}/tinyusb/src/common/tusb_fifo.c"
      "${COMPONENT_DIR}/tinyusb/src/device/usbd_control.c"
      "${COMPONENT_DIR}/tinyusb/src/device/usbd.c"
      "${COMPONENT_DIR}/tinyusb/src/tusb.c")
  # cdc stuff if turned on
  if(CONFIG_USB_CDC_ENABLED)
    list(APPEND srcs
        "${COMPONENT_DIR}/additions/src/cdc.c"
        "${COMPONENT_DIR}/additions/src/tusb_cdc_acm.c"
         "${COMPONENT_DIR}/additions/src/tusb_console.c"
         "${COMPONENT_DIR}/additions/src/vfs_tinyusb.c")
  endif()

  ### tinyusb lib ###
  ###################
  add_library(tinyusb STATIC ${srcs})
  target_include_directories(
    tinyusb
    PUBLIC ${includes_public}
    PRIVATE ${includes_private})
  target_compile_options(tinyusb PRIVATE ${compile_options})
  target_link_libraries(${COMPONENT_TARGET} INTERFACE tinyusb)

endif()

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

Re: esp32 s2 tinyUSB

Postby chegewara » Fri Feb 05, 2021 10:14 am

Stellershime wrote:
Thu Feb 04, 2021 9:11 pm
Do you have any coding examples that is just simply reading and writing text files to the SD card and then drag/dropping them through the usb without involving usbWeb? Or you do have any good headers on how I can implement that through the code that you already provided? Also, I'm having some trouble compiling the arduino-tinyusb library with the header files. Should I be including espressif/esp-idf and the arduino-esp32 branches as components?
For arduino-esp32 you can use this library:
https://github.com/chegewara/EspTinyUSB

I will try to add new example with msc class using SD card, but for now it requires to edit arduino-esp32 a bit.
Here is last file (dont know why i cant attack it):

Code: Select all

// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _SD_DISKIO_H_
#define _SD_DISKIO_H_

#include "Arduino.h"
#include "SPI.h"
#include "sd_defines.h"
// #include "diskio.h"

uint8_t sdcard_init(uint8_t cs, SPIClass * spi, int hz);
uint8_t sdcard_uninit(uint8_t pdrv);

bool sdcard_mount(uint8_t pdrv, const char* path, uint8_t max_files);
uint8_t sdcard_unmount(uint8_t pdrv);

sdcard_type_t sdcard_type(uint8_t pdrv);
uint32_t sdcard_num_sectors(uint8_t pdrv);
uint32_t sdcard_sector_size(uint8_t pdrv);
bool sd_read_raw(uint8_t pdrv, uint8_t* buffer, uint32_t sector);
bool sd_write_raw(uint8_t pdrv, uint8_t* buffer, uint32_t sector);

#endif /* _SD_DISKIO_H_ */
All 4 files are from this library:
https://github.com/espressif/arduino-es ... ies/SD/src
Attachments
sd_diskio.cpp
(20.18 KiB) Downloaded 604 times
SD.h
(1.31 KiB) Downloaded 609 times
SD.cpp
(2.57 KiB) Downloaded 604 times

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

Re: esp32 s2 tinyUSB

Postby chegewara » Fri Feb 05, 2021 10:19 am

adamwilt wrote:
Fri Feb 05, 2021 5:59 am
Interesting: when I build msc_disk.c into the tinyusb component itself (specifically, in components/tinyusb/tinyusb/src/class/msc, alongside msc_device.c), it compiles and links with only the error
region `dram0_0_seg' overflowed by 11808 bytes
If I then change the DISK_BLOCK_NUM to 4 instead of 2 * 140, to avoid allocating 70kb of data, it links without any errors. (It may not run because the "disk" is too small, but at least it compiles and links cleanly).
This example is using RAM disc, so you can easy decrease DISK_BLOCK_NUM to 2*16 or something to fit in S2 RAM, or you can add few more lines of code to use PSRAM.

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

Re: esp32 s2 tinyUSB

Postby chegewara » Fri Feb 05, 2021 12:18 pm

I just added sd card msc example to arduino EspTinyUSB library. It still requires to update local SD library in arduino-esp32, but using code later is very easy:
https://github.com/chegewara/EspTinyUSB ... sd_msc.ino

It is very slow to work with big sd card, like 16GB (it takes teens of seconds before you can use card, when you open root folder first time), but its working nicely and with small effort its possible to add "OTA" update with drag n drop.
Attachments
Screenshot from 2021-02-05 12-57-47.png
Screenshot from 2021-02-05 12-57-47.png (144.16 KiB) Viewed 28792 times

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Fri Feb 05, 2021 8:56 pm

Thanks for Posting the sample code! But I'm getting this error message when I tried to compile the SD_MSC example.
Arduino: 1.8.13 (Windows 10), Board: "ESP32S2 Dev Module, UART0, Disabled, Default 4MB with ffat (1.2MB APP/1.5MB FATFS), 240MHz (WiFi), QIO, 80MHz, 4MB (32Mb), 921600, None"

In file included from C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb.h:65,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src/usb_descriptors.h:17,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src/esptinyusb.h:3,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\cdc\cdcusb.cpp:3:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\cdc\cdcusb.cpp: In member function 'bool CDCusb::begin(char*)':

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\cdc\cdcusb.cpp:26:73: warning: narrowing conversion of '(128 | (((int)((CDCusb*)this)->CDCusb::_EPNUM_CDC) - 1))' from 'int' to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]

uint8_t cdc[TUD_CDC_DESC_LEN] = {TUD_CDC_DESCRIPTOR(ifIdx, 4, (0x80 | (_EPNUM_CDC - 1)), 8, _EPNUM_CDC, 0x80 | _EPNUM_CDC, 64)};

~~~~~~^~~~~~~~~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h:203:26: note: in definition of macro 'TUD_CDC_DESCRIPTOR'

7, TUSB_DESC_ENDPOINT, _ep_notif, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_ep_notif_size), 16,\

^~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\cdc\cdcusb.cpp:26:114: warning: narrowing conversion of '(int)(128 | ((unsigned char)((int)((CDCusb*)this)->CDCusb::_EPNUM_CDC)))' from 'int' to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]

uint8_t cdc[TUD_CDC_DESC_LEN] = {TUD_CDC_DESCRIPTOR(ifIdx, 4, (0x80 | (_EPNUM_CDC - 1)), 8, _EPNUM_CDC, 0x80 | _EPNUM_CDC, 64)};

~~~~~^~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h:209:26: note: in definition of macro 'TUD_CDC_DESCRIPTOR'

7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0

^~~~~

In file included from C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb.h:65,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\hid\hidgeneric.cpp:2:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\hid\hidgeneric.cpp: In member function 'virtual bool HIDgeneric::begin(char*)':

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\hid\hidgeneric.cpp:19:118: warning: narrowing conversion of '(int)(128 | ((unsigned char)((int)((HIDgeneric*)this)->HIDgeneric::<anonymous>.HIDusb::_EPNUM_HID)))' from 'int' to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]

uint8_t hid[] = {TUD_HID_INOUT_DESCRIPTOR(ifIdx++, 0, HID_PROTOCOL_NONE, sizeof(desc_hid_report), _EPNUM_HID, 0x80 | _EPNUM_HID, CFG_TUD_HID_BUFSIZE, 10)};

~~~~~^~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h:253:26: note: in definition of macro 'TUD_HID_INOUT_DESCRIPTOR'

7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_INTERRUPT, U16_TO_U8S_LE(_epsize), _ep_interval

^~~~~

In file included from C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb.h:65,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\midi\midiusb.cpp:2:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\midi\midiusb.cpp: In member function 'bool MIDIusb::begin(char*)':

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\midi\midiusb.cpp:22:67: warning: narrowing conversion of '(int)(128 | ((unsigned char)((int)((MIDIusb*)this)->MIDIusb::_EPNUM_MIDI)))' from 'int' to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]

uint8_t midi[] = {TUD_MIDI_DESCRIPTOR(1, 8, _EPNUM_MIDI, 0x80 | _EPNUM_MIDI, 64)};

~~~~~^~~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h:294:26: note: in definition of macro 'TUD_MIDI_DESC_EP'

7, TUSB_DESC_ENDPOINT, _epout, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0,\

^~~~~~

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\midi\midiusb.cpp:22:23: note: in expansion of macro 'TUD_MIDI_DESCRIPTOR'

uint8_t midi[] = {TUD_MIDI_DESCRIPTOR(1, 8, _EPNUM_MIDI, 0x80 | _EPNUM_MIDI, 64)};

^~~~~~~~~~~~~~~~~~~

In file included from C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb.h:65,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\msc\mscusb.cpp:2:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\msc\mscusb.cpp: In member function 'bool MSCusb::begin(char*)':

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\msc\mscusb.cpp:16:70: warning: narrowing conversion of '(int)(128 | ((unsigned char)((int)((MSCusb*)this)->MSCusb::_EPNUM_MSC)))' from 'int' to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]

uint8_t msc[] = {TUD_MSC_DESCRIPTOR(ifIdx++, 5, _EPNUM_MSC, 0x80 | _EPNUM_MSC, 64)}; // highspeed 512

~~~~~^~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h:223:26: note: in definition of macro 'TUD_MSC_DESCRIPTOR'

7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0

^~~~~

In file included from C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/tusb.h:65,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src/usb_descriptors.h:17,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src/esptinyusb.h:3,

from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:3:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp: In member function 'bool WebUSB::begin(char*, const char*, bool)':

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:73:79: warning: narrowing conversion of '(int)(128 | ((unsigned char)((int)((WebUSB*)this)->WebUSB::_EPNUM_VENDOR)))' from 'int' to 'uint8_t' {aka 'unsigned char'} inside { } [-Wnarrowing]

uint8_t vendor[] = {TUD_VENDOR_DESCRIPTOR(ifIdx++, 7, _EPNUM_VENDOR, 0x80 | _EPNUM_VENDOR, 64)};

~~~~~^~~~~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32/tools/sdk/esp32s2/include/tinyusb/tinyusb/src/device/usbd.h:527:26: note: in definition of macro 'TUD_VENDOR_DESCRIPTOR'

7, TUSB_DESC_ENDPOINT, _epin, TUSB_XFER_BULK, U16_TO_U8S_LE(_epsize), 0

^~~~~

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp: At global scope:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:217:10: error: conflicting declaration of 'bool tud_vendor_control_request_cb(uint8_t, const tusb_control_request_t*)' with 'C' linkage

bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const *request)

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:4:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src/webusb.h:34:15: note: previous declaration with 'C++' linkage

friend bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const *request);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:264:10: error: conflicting declaration of 'bool tud_vendor_control_complete_cb(uint8_t, const tusb_control_request_t*)' with 'C' linkage

bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const *request)

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In file included from C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:4:

C:\Users\Henry Wang\Documents\Arduino\libraries\EspTinyUSB\src/webusb.h:35:15: note: previous declaration with 'C++' linkage

friend bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const *request);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Multiple libraries were found for "SD.h"

Used: C:\Users\Henry Wang\Documents\Arduino\hardware\espressif\esp32\libraries\SD

Not used: C:\Program Files (x86)\Arduino\libraries\SD

exit status 1

Error compiling for board ESP32S2 Dev Module.



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Any ideas on what I'm doing wrong?

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

Re: esp32 s2 tinyUSB

Postby chegewara » Fri Feb 05, 2021 11:22 pm

Do you have maybe "Serial Connected to: USB CDC"?
When you are using USB device (at least with my library) you have to use UART0 for serial logs.

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Fri Feb 05, 2021 11:31 pm

I'll check when I get back home today. Sorry for the long post, couldn't figure out how to make it scrolling. But I'm fairly confident it is UART0 bc I've never used USB as serial before. I see that there was also of "conflict with c linkage" errors and alot of the messages seems to reference webusb.x quite a bit and a couple tusb header files. I have no idea what that means tbh.

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Sat Feb 06, 2021 2:25 am

  • C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp: At global scope:
    C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:217:10: error: conflicting declaration of 'bool tud_vendor_control_request_cb(uint8_t, const tusb_control_request_t*)' with 'C' linkage
    bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const *request)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:4:
    C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src/webusb.h:34:15: note: previous declaration with 'C++' linkage
    friend bool tud_vendor_control_request_cb(uint8_t rhport, tusb_control_request_t const *request);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:264:10: error: conflicting declaration of 'bool tud_vendor_control_complete_cb(uint8_t, const tusb_control_request_t*)' with 'C' linkage
    bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const *request)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src\classes\web\webusb.cpp:4:
    C:\Program Files (x86)\Arduino\libraries\EspTinyUSB\src/webusb.h:35:15: note: previous declaration with 'C++' linkage
    friend bool tud_vendor_control_complete_cb(uint8_t rhport, tusb_control_request_t const *request);
After a closer look it seems like these few lines lines are the most relevant for the code failing to compile as everything else seems to be warnings. This is built in the arduino IDE using the V4.2 release of the espressif/esp32-arduino repo.

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

Re: esp32 s2 tinyUSB

Postby chegewara » Sat Feb 06, 2021 10:15 pm

Ok, it looks like there are some changes in tinyusb merged in most recent commit of arduino-esp32. You can try with this commit, which is working:
https://github.com/espressif/arduino-es ... 79a4ad3e7e

EDIT i just updated library to follow changes in tinyusb API.

Stellershime
Posts: 10
Joined: Thu Feb 04, 2021 8:55 pm

Re: esp32 s2 tinyUSB

Postby Stellershime » Mon Feb 22, 2021 10:06 pm

Hello,
After trying out the tinyusb library that has been uploaded to the library manager. I ran in this error.

Code: Select all

16:59:52.672 -> MSC lun 1 begin
16:59:52.672 -> SD Card Type: SDHC
16:59:52.672 -> SD Card Size: 15193MB
16:59:52.672 -> Listing directory: /
16:59:52.706 ->   FILE: /test.txt  SIZE: 1048576
16:59:52.706 ->   FILE: /foo.txt  SIZE: 13
16:59:52.706 ->   FILE: /datalog.txt  SIZE: 168685
16:59:52.706 ->   DIR : /System Volume Information
16:59:52.706 -> Creating Dir: /mydir
16:59:52.774 -> Dir created
16:59:52.774 -> Listing directory: /
16:59:52.774 ->   FILE: /test.txt  SIZE: 1048576
16:59:52.774 ->   FILE: /foo.txt  SIZE: 13
16:59:52.774 ->   FILE: /datalog.txt  SIZE: 168685
16:59:52.774 ->   DIR : /mydir
16:59:52.774 ->   DIR : /System Volume Information
16:59:52.774 -> Removing Dir: /mydir
16:59:52.807 -> Dir removed
16:59:52.807 -> Listing directory: /
16:59:52.807 ->   FILE: /test.txt  SIZE: 1048576
16:59:52.807 ->   FILE: /foo.txt  SIZE: 13
16:59:52.807 ->   FILE: /datalog.txt  SIZE: 168685
16:59:52.807 ->   DIR : /System Volume Information
16:59:52.807 -> Listing directory: /System Volume Information
16:59:52.807 ->   FILE: /System Volume Information/WPSettings.dat  SIZE: 12
16:59:52.807 ->   FILE: /System Volume Information/IndexerVolumeGuid  SIZE: 76
16:59:52.807 -> Writing file: /hello.txt
16:59:52.807 -> File written
16:59:52.841 -> Appending to file: /hello.txt
16:59:52.841 -> Message appended
16:59:52.841 -> Reading file: /hello.txt
16:59:52.841 -> Read from file: Hello World!
16:59:52.841 -> Deleting file: /foo.txt
16:59:52.841 -> File deleted
16:59:52.841 -> Renaming file /hello.txt to /foo.txt
16:59:52.841 -> File renamed
16:59:52.841 -> Reading file: /foo.txt
16:59:52.841 -> Read from file: Hello World!
16:59:53.989 -> 1048576 bytes read for 1132 ms
16:59:56.526 -> 1048576 bytes written for 2548 ms
16:59:56.526 -> Total space: 15185MB
16:59:56.526 -> Used space: 3MB
17:00:56.319 -> E (74050) TUSB:DCD: Complete but not empty: 0/18
17:00:57.639 -> E (75365) TUSB:DCD: Complete but not empty: 0/18
17:01:09.727 -> E (87443) TUSB:DCD: Complete but not empty: 0/18
17:01:11.047 -> E (88763) TUSB:DCD: Complete but not empty: 0/18
17:01:31.175 -> E (108890) TUSB:DCD: Complete but not empty: 0/18
17:01:32.468 -> E (110208) TUSB:DCD: Complete but not empty: 0/18
17:02:39.143 -> E (176887) TUSB:DCD: Complete but not empty: 0/18
17:02:40.476 -> E (178203) TUSB:DCD: Complete but not empty: 0/18
it seems like the PC was unable to recognize the the descriptor, so my device is connected as an unknown device. I'm using a usb Micro b connector with the ID pin set as floating. I don't know if this makes a difference. From what I gather, you seem to be using a USB A connector? Would the code work with a usb micro B?

edit: funnily enough, it worked right after i posted this reply, maybe it was just a crappy micro b to usb a cable.

Who is online

Users browsing this forum: No registered users and 46 guests