wwatson4506 / UsbMscFat

Teensy 36/40/41 Compatiblility Layer for MSC and SdFat
MIT License
10 stars 4 forks source link

mscTesting don't run as expected #8

Closed BOBILLIER closed 3 years ago

BOBILLIER commented 3 years ago

have test MSCDriveinfo on my t3.6 and all run correctly and I read correctly my USB Stick Infos. But I have tried another example "mscTesting" how is delivered with USBHost_t36 library and write by WWatson, and this doesn't detect my USB stick and return error code 35 at the start. But after seconds, I saw it when I send a character to Serial port. I know that this example is not a part of this library but a part of USBHost_t36 library, but I think it will be good you correct this or ask to Teensyduino to remove it to avoid misunderstanding.

wwatson4506 commented 3 years ago

BOBILLIER, Code 35 means that MSC timed out waiting for the USB device to come online. I have a pull request in for that for USBHost_t36. Right now you can change two values in the msc.h file and retry to connect the the same device that failed. The msc.h file is located in the utility folder in the USBHost_t36 library. Starting at line #73 find these lines:

// These two defines are timeouts for detecting a connected drive // and waiting for it to be operational.

define MEDIA_READY_TIMEOUT 1000

define MSC_CONNECT_TIMEOUT 4000

And change them to:

// These two defines are timeouts for detecting a connected drive // and waiting for it to be operational.

define MEDIA_READY_TIMEOUT 5000

define MSC_CONNECT_TIMEOUT 5000

Another user as well as myself was having the same problem when trying to use a USB SD card reader. Giving a longer timeout fixed the problem. Note: Some USB devices can take up to a minute or more to become ready. USB hard drives in particular.

Because of FatFS and uSDFS still being used I do not want to eliminate mscTesting.

On Mon, Jun 7, 2021 at 7:56 AM BOBILLIER @.***> wrote:

have test MSCDriveinfo on my t3.6 and all run correctly and I read correctly my USB Stick Infos. But I have tried another example "mscTesting" how is delivered with USBHost_t36 library and write by WWatson, and this doesn't detect my USB stick and return error code 35. I know that this example is not a part of this library but a part of USBHost_t36 library, but I think it will be good you correct this or ask to Teensyduino to remove it to avoid misunderstanding.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wwatson4506/UsbMscFat/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2Q7URU55GMXHA3XLUCF3TRTMZDANCNFSM46H3GJQQ .

BOBILLIER commented 3 years ago

You are right. In my case (and my USB Stick) MSC.begin take up to 6 seconds.