chegewara / EspTinyUSB

ESP32S2 native USB library. Implemented few common classes, like MIDI, CDC, HID or DFU (update).
MIT License
489 stars 70 forks source link

Errors when compiling the new library #18

Closed joelsernamoreno closed 3 years ago

joelsernamoreno commented 3 years ago

Hi

I have seen that you have added SD Mass Storage

I tried to test this but when I compile the example your library gives many errors.

Now I can't use the keyboard example either

I attach screenshots with the errors:

107583206-e2713c80-6bfa-11eb-9654-998b6cca21d0

107583239-edc46800-6bfa-11eb-95b9-0b7709220bd2

107583266-f4eb7600-6bfa-11eb-9d42-59782415bc1d

107583298-fb79ed80-6bfa-11eb-94cd-a2018d8417a9

107583326-03399200-6bfb-11eb-9fd5-405e0a70b25c

Thanks

chegewara commented 3 years ago

Hi, can you try to update arduino-esp32 to most recent commit in idf-espressif/v4.2 branch?

Most warings you see are casting problems and can be ignored.

joelsernamoreno commented 3 years ago

i

Do you have the link to download and install this? I tried to do it with v4.3-beta1 but it keeps giving errors

Thanks

chegewara commented 3 years ago

I am assuming you are working on linux: https://github.com/espressif/arduino-esp32/blob/master/docs/arduino-ide/debian_ubuntu.md

Then just do this: git checkout idf-espressif/v4.2

joelsernamoreno commented 3 years ago

Error with git checkout idf-espressif/v4.2

error: specified path 'idf-espressif/v4.2' did not match any file(s) known to git

I can do git checkout esp32s2 and then install this with python3 gey.py

On Arduino the ESP32S2 board is installed but I keep getting the same errors with your library

chegewara commented 3 years ago

Sorry, it is idf-release/v4.2.

joelsernamoreno commented 3 years ago

Hello

Well, I don't seem to get so many errors now, but I have a problem with SD.writeRAW

Selección_054

Thanks

chegewara commented 3 years ago

https://github.com/espressif/arduino-esp32/pull/4777

joelsernamoreno commented 3 years ago

I have modified this in my files, now this compiles

Well, I'm testing with a featherS2, but it doesn't seem to be compatible.

I have changed the MISO, MOSI, SCK and SS pins in your sketch to the ones that correspond with featherS2 io35, io37, io36 and io9.

My laptop recognizes the device drive, but does not recognize the SD storage.

I'll have to wait until I get an ESP32-S2 wroom

chegewara commented 3 years ago

FeatherS2 should be compatible, when you change pin to macth on board. Easy way to test is is to make standard arduino-esp32 SD card example to work, just add SPIClass code just like in my example.

joelsernamoreno commented 3 years ago

The problem is that I can't debug this with serial

To program feathers2 I have to start it in boot mode (press boot button + press reset button + release reset button).

After uploading the code, I have to reset featherS2, then I can't access the serial.

I can only access serial in boot mode, to run the code I can't be in boot mode.

I will try to change the microSD slot or wait for ESP32-S2 wroom

chegewara commented 3 years ago

With regular SD card example you can debug log over USB. You can also use another esp32 board for logging, just like CP2102, but its not that easy.

joelsernamoreno commented 3 years ago

Hi

SD Mass Storage is working now

My patience was short, it takes a few minutes until the SD is identified on the computer.

Could this be done faster?

chegewara commented 3 years ago

Sorry, but no. USB on S2 is slow, you can see more info here: https://esp32.com/viewtopic.php?f=18&t=15908&start=20

The bigger the card and more files the slower is to start.

joelsernamoreno commented 3 years ago

Well, when I have some free time I will try to add two new functions to your library

SDstr(); SDstp();

SDstr(); to start the SD storage SDstp(); to stop the SD storage

This is interesting to control the storage from a web panel

Thanks

chegewara commented 3 years ago

There is no need to add it to library, you can control it in app using standard SD API. All you need is to control this variable (which is only part of example), to control msc transfer: https://github.com/chegewara/EspTinyUSB/blob/master/examples/sd_msc/sd_msc.ino#L19

joelsernamoreno commented 3 years ago

Well, a question

I would like to try Disk Mass Storage, does this work only with ESP32-S2 Wroom or does it also work with Feathers2?

By the way, after Chinese New Year my new devices will be made with ESP32-S2, I will send you some when I get them

chegewara commented 3 years ago

Any S2 board is good as long as you can connect SD card.

joelsernamoreno commented 3 years ago

I don't mean SD, I mean converting the ESP32-S2 memory to mass storage.

https://github.com/chegewara/EspTinyUSB/blob/master/examples/msc/msc.ino

chegewara commented 3 years ago

This example works with any S2 board with PSRAM. IIRC FeatherS2 is with PSRAM, so should works. There is some discussion about adding unified API, so MSC could works with FFAT, SPIFFS, SD card etc, but there is no timeline yet.

joelsernamoreno commented 3 years ago

Hi!

I have tried your last example of sd msc, it works faster than the previous example

Good job 👍