USBhost MSC throughput much lower than SD card on T4.1

strud

Well-known member
Hi All,

I've been working on a DAQ system using the T4.1 and a nice 24bit ADC from TI.

Just recently I've added the USB host MSC library to enable writing my captured and converted data to files on a USB flash drive.

Iam using the Teensyduino beta release 1.57.

It is all working except for the fact the time to write the same files to the USB drive is MUCH longer/slower (like > 10x) than for the SD card.

My question is what is the default rate setup for the USB MSC interface?

Can I change this?

Could there be another reason this is so slow?

Thanks

Craig
 
... long time away from another thread ... YMMV ... that thread had testing of drive speed and details if it can be found ...

How large is the USB Host write Buffer to the Flash Drive?

seems it was optimal with increasing write speeds using 8KB or 16KB or ...
 
Hi defragster, will continue to search, nothing found yet.

Any pointers on where to look for the USB host write buffer settings?

So some more data about the speed difference with a more scientific approach.

Same SD card used in the microSD slot of the T4.1 and in a USB SD card reader

SD card in native slot: 2242 bytes/ms
SD card in USB DS card reader: 857 bytes/ms

So obviously the USB memory stick I was first using is pretty ordinary....
 
I believe Bill's driver for SDIO (and also dedicated SPI) is leaving the card in the middle of a multi-sector write.

But the USB code is probably doing single sector writes. The actual access done to the SD card might even be reading a sector, modifying part of the 512 bytes, then writing it. Maybe? Really just guesswork from having looked at the code a few times...

To really analyze what's going on would require a test program and a lot of work to monitor the low-level communication. Can't say when that sort of optimization effort will happen, or even with certain that it will ever be done (though I sure want to), but before 1.57 release seems unlikely.

In the meantime, you might experiment with writing larger amounts. Maybe buffer data and write it in chucks of 512 bytes (1 sector) or multiples of 512, to see if you get a speedup when SdFat doesn't have to combine your data with stuff already stored in the sectors. Curious to hear if that makes a difference?
 
Hi Paul,

Tried that and there was an improvement for my standard DAQ capture from 856kB/s up to 1018kB/s.

Interested to know if others are getting USB MSC file write speeds higher than this though, seems very slow, about 1/2 the speed of using the same SD card in the SD slot.
 
Back
Top