Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

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

  1. #1
    Junior Member
    Join Date
    Apr 2020
    Posts
    10

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

    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

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    ... 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 ...

  3. #3
    Junior Member
    Join Date
    Apr 2020
    Posts
    10
    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....

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,380
    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?

  5. #5
    Junior Member
    Join Date
    Apr 2020
    Posts
    10
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •