USBHost_t36 USB Mass Storage Driver Experiments

@All,

Sorry I have not responded for the last few days. I lost the computer to a power supply flame out. Fortunately I had most of my data backed up but not all of it. I spent most of this long weekend setting up a laptop and another desktop just in case this happens again. I think I am finally caught up with you guys:)

Got the T$ Saturday and have started to work with it today. I grabbed all of the documentation for the 1052 and 1062. The one thing I have to do is understand how the pinout diagram works.
I guess starting with the 1062 ref. manual.

I want to get back to working MSC as soon as I can and see if I can improve the transfer speed.

Awesome work on partitions. I do have minimal POSIX style file system working on my other T36 setup and want to port it over to the T$.
 
Hi @WMXZ - Issued a PR: https://github.com/WMXZ-EU/uSDFS/pull/7

You might want to check it out and see if I screwed up anything obvious...

I also now tried it where I redid the 2 partition disk on Ubuntu 18.04 using gparted and had it format as Fat32... And test app still worked.

Wow - this thread went quiet for dozens of hours! I found one of my Star-Tech and the Apricorn USB3 'minimal' cable USB to Sata adapters …

My ZIP is dated 5/26 and I see I have this noted version #? :: Using library uSDFS at version 1.1.1 in folder: T:\tCode\libraries\uSDFS
Went to plug one into HUB to test and getting yelled at for this:
Code:
T:\TEMP\arduino_build_logger_RawWriteHub.ino\libraries\uSDFS\ff.c.o: In function `check_GPT_disk':
T:\tCode\libraries\uSDFS\src/ff.c:3257: undefined reference to `VolToPart'

It needs @mjs513's p#272 :: PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,1}, {2,2}}; /* Volume - Partition resolution table */

Using the Apricorn on my Plextor SSD 13 MB/s and not even a HUGE buffsize at 16K … 64KB of RAM:
Code:
Test logger_RawWrite
BUFFSIZE :16384
Dev Type :2:/
File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes

Change drive
A_00001.dat
stat FR_OK 0
 opened FR_OK 0

................................................................
.................................... [B][COLOR="#FF0000"](5008995 - 13.083662 MB/s)[/COLOR][/B]
 (open: 9033 us; close: 9000 us; write: min,max: 4940 4945 us)

That speed with:
Code:
#define MXFN 100 // maximal number of files //was 100
#define MXRC 1000 // number of records in file // was 1000

And it needs this to run through a HUB:
Code:
#include <USBHost_t36.h>
extern USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);

Funny I accidentally type 18 instead of 16 for BUFFSIZE and it went slower! and with 8K buffsize it only did 8 MB/sec

Of course this is bad testing for SSD drives - the more spastic writes the more wear on the FLASH - and without OS TRIM support the free space isn't cleared in advance on delete - that's why I went with the Seagate HDD for testing.

Really need to get to a read test ….
 
Code:
T:\TEMP\arduino_build_logger_RawWriteHub.ino\libraries\uSDFS\ff.c.o: In function `check_GPT_disk':
T:\tCode\libraries\uSDFS\src/ff.c:3257: undefined reference to `VolToPart'

It needs @mjs513's p#272 :: PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,1}, {2,2}}; /* Volume - Partition resolution table */

Added PARTITION VolToPart to sd_config.h
 
@All - Sorry I have been offline so long.

I have been doing alot of research with the EHCI USB controller and mass storage devices. I think I may found out why USB thumb drives are slower than regular hard drives or ssd drives. Most hard drives support onboard write caching. The thumb drives I have and tested did not. From what I could find on the Internet they don't. You can support write caching through software but it is not recommened because if there was power loss you could lose data. You can turn write caching on/off in most OS's.

As a test, I used the 'hdparm' command in Linux to turn the devices onboard caching off and on.

With caching turned on:
Code:
Test logger_RawWrite
uSDFS_VER:30_MAY_19_15_00
BUFFSIZE (bytes):32768
Dev Type :2:/
File System FS_FAT32
Free Disk Size 7613710 clusters
Cluster Size 64 sectors
Sector Size 512 bytes

Change drive
A_00001.dat
stat FR_OK 0
 opened FR_OK 0

 [COLOR="#FF0000"](24998 - 1.310825 MB/s)[/COLOR]
 (open: 31033 us; close: 18000 us; write: min,max: 6976 6976 us)

unmount FR_OK

With caching turned off:
Code:
Test logger_RawWrite
uSDFS_VER:30_MAY_19_15_00
BUFFSIZE (bytes):32768
Dev Type :2:/
File System FS_FAT32
Free Disk Size 7613710 clusters
Cluster Size 64 sectors
Sector Size 512 bytes

Change drive
A_00001.dat
stat FR_OK 0
 opened FR_OK 0

[COLOR="#FF0000"] (104998 - 0.312082 MB/s)[/COLOR]
 (open: 65030 us; close: 75000 us; write: min,max: 29976 29976 us)

unmount FR_OK

Different drives have different cache sizes so the results varied between the drives I tested.

It shows a fairly substantial difference. So I guess maybe the best way to increase the write speeds especially for thumb drives is to do write caching through software.
I have not done this before so it will be a new learning experience for me (Any help appreciated). Wondering if the 'Circular Buffer' library would be usable or practical in this application.

Anyway, I am getting the same speed results with the T36 and T4.
 
Code:
T:\TEMP\arduino_build_logger_RawWriteHub.ino\libraries\uSDFS\ff.c.o: In function `check_GPT_disk':
T:\tCode\libraries\uSDFS\src/ff.c:3257: undefined reference to `VolToPart'

It needs @mjs513's p#272 :: PARTITION VolToPart[] = {{0,0}, {1,0}, {2,0}, {2,1}, {2,2}}; /* Volume - Partition resolution table */
Added PARTITION VolToPart to sd_config.h

I'm wondering if that should be in Sketch? That could change based on user drive and partition layout?
 
@All - Sorry I have been offline so long.

I have been doing alot of research with the EHCI USB controller and mass storage devices. I think I may found out why USB thumb drives are slower than regular hard drives or ssd drives. Most hard drives support onboard write caching. The thumb drives I have and tested did not. From what I could find on the Internet they don't. You can support write caching through software but it is not recommened because if there was power loss you could lose data. You can turn write caching on/off in most OS's.

As a test, I used the 'hdparm' command in Linux to turn the devices onboard caching off and on.

With caching turned on:

//...

Different drives have different cache sizes so the results varied between the drives I tested.

It shows a fairly substantial difference. So I guess maybe the best way to increase the write speeds especially for thumb drives is to do write caching through software.
I have not done this before so it will be a new learning experience for me (Any help appreciated). Wondering if the 'Circular Buffer' library would be usable or practical in this application.

Anyway, I am getting the same speed results with the T36 and T4.

Wow - that looks SLOW in both cases? I've gone to " BUFFSIZE :16384 " and it seems to be capable and good there - It is slower at BUFFSIZE 8K { Max 8.139 MB/s } and not much better at 30K { Max 13.5 MB/s } - and I still get errors at 32K?


I put these numbers on the T4 - I did a 64GB usb3.1 ADATA flash drive - but closed post before writing:
> Tested USB HOST to SSD and HDD - both hitting 12.8 to 13 MB/sec disk writes with 64 KB buffer.

Oh yeah - the numbers on FLASH were as high at 4-5 MB/sec - and then some batches were suffering from DRIVE Overhead where the next dot sat and sat. Doing a repro I am seeing 3.5 to 6.9 MB/sec:
Test logger_RawWrite_FS // Edited the SKETCH to put out the _FS name in this case
1970-01-01 00:00:00
BUFFSIZE :16384
Dev Type :2
Using uSDFS
uSDFS_VER:15_MAY_19_08_16
File System FS_EXFAT
// ...

.................................... (17274989 - 3.793693 MB/s)
(open: 64997 us; close: 25945 us; write: min,max: 4943 4374945 us)

A_00005.dat
// ...

.................................... (9417988 - 6.958599 MB/s)
(open: 45998 us; close: 11945 us; write: min,max: 4943 2407945 us)

On SD Flash Cards 'Fast Logging' the recommendation has been pre-allocated files? Then truncating on close? - I've not looked at the mechanics of that ...

Doing that up front - when max file size is known would get the FAT updates and Dir entry overhead out of the way - and might inspire the FLASH drive to clear and allocate the needed pages in advance - so file create/open could take 'some time' - but would run at best speed after that.

How many files can currently be opened at once? A test of 'PreAlloc' might be faster and less dangerous than parsing writes and dedicating buffers for multiple files - if just a single file then the cache would be just writing in proper device size blocks 512 bytes or larger?

I keep meaning to read the DOC thingy - is there a way to get the VOLUME NAME? Would be nice to show that to record the device at hand. Also a READ example I keep hoping to get to …

Here is HIGH and LOW of 128 MB cache Seagate 2.5 in that Orico Hub/Drive box - runs at same speed at SSD:
Code:
Test logger_RawWrite_FS
1970-01-01 00:12:13
BUFFSIZE :16384
Dev Type :2
Using uSDFS
uSDFS_VER:15_MAY_19_08_16
File System FS_EXFAT

.................................... (5024988 - 13.042021 MB/s)
 (open: 45999 us; close: 19945 us; write: min,max: 4943 7943 us)

.................................... (5152992 - 12.718048 MB/s)
 (open: 135994 us; close: 93945 us; write: min,max: 4943 47945 us)
 
Okay I opened the DOC HTML - making so many test drives I've been putting Drive and size info in the LABEL so I know which BOX is Which. Here is my Seagate Barracude 500 GB drive:

in ...\libraries\uSDFS\examples\logger_RawWrite_FS\logger_RawWrite_FS.ino
Code:
  void init(void)
  {
    Serial.println("Using uSDFS");
    Serial.print("uSDFS_VER:"); Serial.println(uSDFS_VER);
//...
[B]   [COLOR="#FF0000"] /* Get volume label of the default drive */[/COLOR]
    char Vstr[24];
    uint32_t SN;
    f_getlabel(Dev, Vstr, &SN);
    Serial.printf("Volume Label: ");
    Serial.printf(Vstr);
    Serial.printf("  Ser#: ");
    Serial.println(SN);
[/B]

Had to edit library file : ..\uSDFS\src\ffconf.h
Code:
[B]#define FF_USE_LABEL	1[/B]
/* This option switches volume label functions, f_getlabel() and f_setlabel().
[COLOR="#FF0000"]/  (0:Disable or 1:Enable) */[/COLOR]

Code:
Test logger_RawWrite_FS
1970-01-01 00:46:07
BUFFSIZE :8192
Dev Type :2
Using uSDFS
uSDFS_VER:15_MAY_19_08_16
File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes
[COLOR="#FF0000"][B]Volume Label: SBarr500 [/B] Ser#: 1856911144[/COLOR]
 
@defragster

Wow - that looks SLOW in both cases? I've gone to " BUFFSIZE :16384 " and it seems to be capable and good there - It is slower at BUFFSIZE 8K { Max 8.139 MB/s } and not much better at 30K { Max 13.5 MB/s } - and I still get errors at 32K?

Yeah, it does seem slow. I am going to use 'RawWrite_FS' and retest everything. It seems the larger the file to a point the lager the MBs is. I think this has to do with the sketch in that the calculations for speed are based on the number of 32 bit writes including file open and close times. And if I am right the file size is based on the buffer size.

I keep meaning to read the DOC thingy - is there a way to get the VOLUME NAME? Would be nice to show that to record the device at hand. Also a READ example I keep hoping to get to …

Yes there is. I was using that in my initial demo example program which with all the recent changes will not work any more. I have to find it and rewrite it. You can get the volume label and the serial number.

I have to go out for a while but when I get back I will get the code and post it.

I was also getting 13 to 14 MBs with some of my drives. I think that was on my Seagate Barracuda 500GB drive.

EDIT:
Good deal. Guess you found it.
 
Last edited:
@wwatson:
>> I got the VOLUME label displayed p#283

>> the file size and test is a combo of "4 byte BUFFSIZE[ ## ]" and:
Code:
#define MXFN 10 // maximal number of files //was 100
#define MXRC 1000 // number of records in file // was 1000

This says 10 files of 100 records - and indeed EACH record is of size BUFFSIZE.

I just dropped to MXRC of 10 and with only 10 records per file the max number with BUFFSIZE 16K :: 11.109303 MB/s

So shorter tests are faster to execute and get MOST of the speed
 
I'm wondering if that should be in Sketch? That could change based on user drive and partition layout?

Is one possibility
my reasoning was, that sd_config.h would be edited to say which interface one is using (spi,sdio,usb) where one could also have 2 or more spi devices
Also sd_config should be always checked as it has spi port definitions.

now, can weak be also used for structures?

if the location is 'too hidden' I could also move 'sd_config' into uSDFS.h which is to be used in main sketch
 
Is one possibility
my reasoning was, that sd_config.h would be edited to say which interface one is using (spi,sdio,usb) where one could also have 2 or more spi devices
Also sd_config should be always checked as it has spi port definitions.

now, can weak be also used for structures?

if the location is 'too hidden' I could also move 'sd_config' into uSDFS.h which is to be used in main sketch

There probably is a good answer - I've only hacked the sketches following into sources as needed- not looked at the bigger picture. One possible way would be to have a default VOL* to a generally good list and allow a sketch update in setup() - but I don't know which parts of this are compile versus runtime to get the needed parts included. Having multiple devices seems important for some uses
 
There probably is a good answer - I've only hacked the sketches following into sources as needed- not looked at the bigger picture. One possible way would be to have a default VOL* to a generally good list and allow a sketch update in setup() - but I don't know which parts of this are compile versus runtime to get the needed parts included. Having multiple devices seems important for some uses

I realized that having the VolToPart in sd_config.h could result in multiple declaration, so I moved it to uSDFS.h, which is only called by main thread.
This way it can be changed without need to recompile library (is declared external in ff.h)
if you wanted to use your own VolToPart you then in your sketch simply do something like

Code:
	#define MY_VOL_TO_PART
        #include "uSDFS.h"
	PARTITION VolToPart[] = {{0, 0}, //{ physical drive number, Partition: 0:Auto detect, 1-4:Forced partition)} 
			        {1,0}, 
	   	                {2 0}, 
				{2, 1}, 
				{2, 2}
				 }; /* Volume - Partition resolution table */
or
Code:
	#define MY_VOL_TO_PART
        #include "uSDFS.h"
	#include "sd_config.h"
	PARTITION VolToPart[] = {{DEV_SPI, 0}, //{ physical drive number, Partition: 0:Auto detect, 1-4:Forced partition)} 
				 {DEV_SDHC,0}, 
				 {DEV_USB, 0}, 
				 {DEV_USB, 1}, 
				 {DEV_USB, 2}
				 }; /* Volume - Partition resolution table */
 
That certainly works to make it usable!

I read the docs there is : 'The f_expand function prepares or allocates a contiguous data area to the file.'
Cleaner to use than an l_seek it seems - but the file has to be 0 length to start - so if it exists would require this first: 'f_truncate - Truncate size'

I went through and got rid of ALL warnings on my copy - it still works. Did two file pull requests.

Also did a clone to look at doing a logger_RawRead version … will see if I get back to it.
 
Another edit to ffconf.h :: #define FF_USE_EXPAND 1 /* This option switches f_expand function. (0:Disable or 1:Enable) */

And this worked:
Code:
[COLOR="#FF0000"]      if ((rc = f_open(&fil, filename, FA_WRITE | FA_CREATE_ALWAYS))) die("open", rc);
    }[/COLOR]
[B]    rc = f_truncate( &fil );
    if (rc != FR_OK) die("truncate", rc);
    rc = f_expand( &fil, 4*BUFFSIZE*MXRC, 1);
    if (rc != FR_OK) die("expand", rc);
[/B]

Hard Disk ran at same speed - though more consistent, ran with "R" test files two at 13.0395, two at 13.01, the other six 13.0420
64GB aData Flash drive made it to 13 MB/s up from 6.9 Max posted above - but the first was SLOW and it still took HITS on some dots - and some HUGE open times.
2nd Run gave with same file names: 2.9, 4.3, (4*)6.6, 7, 8.4, (2*)12.9
Code:
Test logger_RawRead
uSDFS_VER:15_MAY_19_08_16
BUFFSIZE :16384
Dev Type :2:/
File System FS_EXFAT
Volume Label: AdataWonder  Ser#: 3614341965

A_00001.dat
.................................... (21819958 - 3.003489 MB/s)
 (open: 205075 us; close: 12000 us; write: min,max: 4957 4097959 us)
.................................... (5040971 - 13.000669 MB/s)
 (open: 40014 us; close: 12000 us; write: min,max: 4929 15959 us)
.................................... (9946971 - 6.588538 MB/s)
 (open: 40016 us; close: 12000 us; write: min,max: 4929 2412959 us)
.................................... (5050993 - 12.974874 MB/s)
 (open: 86993 us; close: 26000 us; write: min,max: 4952 15959 us)
.................................... (16249971 - 4.032992 MB/s)
 (open: 46016 us; close: 13000 us; write: min,max: 4929 4351959 us)
.................................... (9920971 - 6.605805 MB/s)
 (open: 46015 us; close: 12000 us; write: min,max: 4929 2401959 us)
.................................... (9839971 - 6.660182 MB/s)
 (open: 46016 us; close: 12000 us; write: min,max: 4929 2418959 us)
.................................... (8671971 - 7.557221 MB/s)
 (open: 46016 us; close: 12000 us; write: min,max: 4929 2405959 us)
.................................... (5057926 - 12.957089 MB/s)
 (open: 123061 us; close: 27000 us; write: min,max: 4957 20959 us)
.................................... (7493994 - 8.745136 MB/s)
 (open: 65993 us; close: 13000 us; write: min,max: 4952 2168959 us)
unmount FR_OK

Changing to fresh "R" files from "A":
Code:
.................................... (8880977 - 7.379368 MB/s)
 (open: 317063 us; close: 13000 us; write: min,max: 4957 2155957 us)
.................................... (7823984 - 8.376295 MB/s)
 (open: 118001 us; close: 13000 us; write: min,max: 4943 2186959 us)
.................................... (5039984 - 13.003216 MB/s)
 (open: 132002 us; close: 27000 us; write: min,max: 4943 11959 us)
.................................... (7472984 - 8.769723 MB/s)
 (open: 127003 us; close: 13000 us; write: min,max: 4943 2133959 us)
.................................... (7470984 - 8.772071 MB/s)
 (open: 127002 us; close: 13000 us; write: min,max: 4943 2139959 us)
.................................... (7451984 - 8.794436 MB/s)
 (open: 127002 us; close: 13000 us; write: min,max: 4943 2121959 us)
.................................... (7464984 - 8.779121 MB/s)
 (open: 127002 us; close: 13000 us; write: min,max: 4943 2133959 us)
.................................... (7458995 - 8.786170 MB/s)
 (open: 140991 us; close: 11000 us; write: min,max: 4954 2123959 us)
.................................... (7456984 - 8.788540 MB/s)
 (open: 136002 us; close: 11000 us; write: min,max: 4943 2134959 us)
.................................... (7456984 - 8.788540 MB/s)
 (open: 136002 us; close: 11000 us; write: min,max: 4943 2124959 us)

And before this was probably slower and less consistent an 8 GB SDHC card - though turning above code off on same files is getting the same speed running again - except I got one 5.05, a 5.15 and a low of 4.2 MB/s:
Code:
Test logger_RawRead
uSDFS_VER:15_MAY_19_08_16
BUFFSIZE :16384
Dev Type :1:/
File System FS_FAT32
Volume Label: TEENSY8A  Ser#: 3702913836
.................................... (14604163 - 4.487488 MB/s)
 (open: 85586 us; close: 10366 us; write: min,max: 10822 464104 us)
.................................... (13345968 - 4.910547 MB/s)
 (open: 213404 us; close: 10296 us; write: min,max: 5816 142389 us)
.................................... (13423899 - 4.882039 MB/s)
 (open: 88753 us; close: 10328 us; write: min,max: 10845 139678 us)
.................................... (13152998 - 4.982590 MB/s)
 (open: 89523 us; close: 10193 us; write: min,max: 10901 36359 us)
.................................... (13419998 - 4.883458 MB/s)
 (open: 84319 us; close: 10199 us; write: min,max: 10845 134118 us)
.................................... (13140066 - 4.987494 MB/s)
 (open: 90859 us; close: 10256 us; write: min,max: 10860 36436 us)
.................................... (13415637 - 4.885046 MB/s)
 (open: 89656 us; close: 10263 us; write: min,max: 10818 117949 us)
.................................... (13163048 - 4.978786 MB/s)
 (open: 86657 us; close: 10189 us; write: min,max: 10871 46707 us)
.................................... (13159255 - 4.980221 MB/s)
 (open: 90582 us; close: 10273 us; write: min,max: 10841 36600 us)
.................................... (14302373 - 4.582177 MB/s)
 (open: 85618 us; close: 10193 us; write: min,max: 10856 466561 us)
 
I thought it would be interesting to see what the read/write speeds are with reading/writing sectors directly through MSC with t4.

These are the results with various buffer sizes on HD's:
Code:
Direct sector read/Write speed test
(Destroys any data on the drive!)

Write speed is 3000 2.730667 MB/s for 8192 bytes
Read speed is 2992 2.737968 MB/s for 8192 bytes

Write speed is 3000 5.461333 MB/s for 16384 bytes
Read speed is 2992 5.475936 MB/s for 16384 bytes

Write speed is 4000 8.192000 MB/s for 32768 bytes
Read speed is 2992 10.951872 MB/s for 32768 bytes

Write speed is 5000 13.107200 MB/s for 65536 bytes
Read speed is 3992 16.416834 MB/s for 65536 bytes

Write speed is 6000 16.384001 MB/s for 98304 bytes
Read speed is 4992 19.692308 MB/s for 98304 bytes

These are the results with various buffer sizes on thumb drives:
Code:
Write speed is 3000 2.730667 MB/s for 8192 bytes
Read speed is 3992 2.052104 MB/s for 8192 bytes

Write speed is 3000 5.461333 MB/s for 16384 bytes
Read speed is 2992 5.475936 MB/s for 16384 bytes

Write speed is 5000 6.553600 MB/s for 32768 bytes
Read speed is 2992 10.951872 MB/s for 32768 bytes

Write speed is 8000 8.192000 MB/s for 65536 bytes
Read speed is 4992 13.128205 MB/s for 65536 bytes

Write speed is 11000 8.936728 MB/s for 98304 bytes
Read speed is 5992 16.405874 MB/s for 98304 bytes

The results of the sector writes are about 1 MBs faster than the uSDFS file writes. (On my drives).
I have not figured out why 8192 byte and 16384 byte buffer read/writes are almost the same speed yet.
Noticed that the thumb drive write speed does not change after a buffer size of 65536.

Now to reformat all the drives I tested on and do some file read speed testing with uSDFS.
 
Nice to see a couple bigger numbers showing the USB has a bit more headroom at 16 and 19 MB/sec. I got some new Flash drives and SDHC cards - still unopened. And the new TD beta took me away from thinking about my RawRead sample a bit ...
 
Here is the result of some more tests I ran on the T4 and MSC.

Code:
Sector Number 6190864, [COLOR="#FF0000"]Sector Count 16[/COLOR]
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 2F 08 00 00 00 20 00 00 00 00 0A 2A 00 00 5E 77 10 00 00 10 00 00 00 00 00 00 00 
msOutCompleted(CBW) in = [COLOR="#FF0000"]1000us[/COLOR]
msController CallbackOut (static)
[COLOR="#FF0000"]transfer->qtd.token = 1[/COLOR]
msController dataOut (static)[COLOR="#FF0000"]8192[/COLOR]
39 00 00 00 39 00 00 00 39 00 00 00 39 00 00 00 39 00 00 00 39 00 00 00 39 00 00 00 39 00 00 00 
msOutCompleted(Data) in = 998us
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 2F 08 00 00 00 00 00 00 00 
** CSWSIGNATURE
Sector Number 6190880, Sector Count 16
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 30 08 00 00 00 20 00 00 00 00 0A 2A 00 00 5E 77 20 00 00 10 00 00 00 00 00 00 00

The out transfers are taking about 1ms to complete. The multi sector writes are limited to 16 sectors by FatFs. (8192 / 512 = 16). I have not found why yet. It might possibly have to do with cluster sizes. So no matter how large the buffer is the maximum number of bytes transfered in one transfer through FatFs is gong to be 8192 byte or 16 512 byte sectors.

Code:
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 512
54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 C7 75 C8 4E C8 4E 00 00 C7 75 C8 4E 00 00 00 00 00 00 
** ????
msInCompleted(Data) in = 998us
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 38 08 00 00 00 00 00 00 00 
** CSWSIGNATURE

In transfers appear to be the same. About 1ms.

@defragster - Been looking to find out why the out transfers seem to be stalling at times. I see this 'transfer->qtd.token = 1' which indicates that EHCI has recieved a NAK from the device because it does not have room in the write cache for any more data until it emptys and is in a PING state asking if the device is ready to accept more data. (EHCI reference manual - page 44, and pages 88-89). Not sure if this is the cause but it happens more with thumb drives than hard drives. It could also be from a stalled pipe which is handled by EHCI. Just not sure.

@Paul - Please correct me if I am wrong about the PING state.

Edit:

Found one hard drive giving different results:
Code:
Sector Number 145152, Sector Count 64
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 F1 01 00 00 00 80 00 00 00 00 0A 2A 00 00 02 37 00 00 00 40 00 00 00 00 00 00 00 
msOutCompleted(CBW) in = 1001us
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)[COLOR="#FF0000"]32768[/COLOR]
32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 
msOutCompleted(Data) in = [COLOR="#FF0000"]1998us[/COLOR]
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 F1 01 00 00 00 00 00 00 00 
** CSWSIGNATURE
Sector Number 145216, Sector Count 64
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)31
55 53 42 43 F2 01 00 00 00 80 00 00 00 00 0A 2A 00 00 02 37 40 00 00 40 00 00 00 00 00 00 00 
msOutCompleted(CBW) in = 1001us
msController CallbackOut (static)
transfer->qtd.token = 0
msController dataOut (static)32768
32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 32 00 00 00 
msOutCompleted(Data) in = 1998us
msController CallbackIn (static)
transfer->qtd.token = 0
msController dataIn (static): 13
55 53 42 53 F2 01 00 00 00 00 00 00 00 
** CSWSIGNATURE

This was a Barracuda 250 GIG HD.
 
Last edited:
The out transfers are taking about 1ms to complete. The multi sector writes are limited to 16 sectors by FatFs. (8192 / 512 = 16). I have not found why yet. It might possibly have to do with cluster sizes. So no matter how large the buffer is the maximum number of bytes transfered in one transfer through FatFs is gong to be 8192 byte or 16 512 byte sectors.
may this be connected with the 16384 Byte limit in aueue_Data_Transfer in ehci.cpp?
(I know you said 8192 but i know FS is sending lager blocks (I recall a transfer of 64*512))
 
@WMXZ

may this be connected with the 16384 Byte limit in aueue_Data_Transfer in ehci.cpp?
(I know you said 8192 but i know FS is sending lager blocks (I recall a transfer of 64*512))

I am pretty sure it's based on cluster sizes. I 'loggerRawWrite.ino' you display the reported cluster size. I found that it matches the block count sent by FatFs.
Ehci.cpp breaks it up into 16384 byte chunks sent if it greater than 16384.

Heading to work now.
 
@WMXZ
I am pretty sure it's based on cluster sizes. I 'loggerRawWrite.ino' you display the reported cluster size. I found that it matches the block count sent by FatFs.
Ehci.cpp breaks it up into 16384 byte chunks sent if it greater than 16384.

if there is a match, then there is a good answer
 
@WMXZ

I don't know of I have missed something but I just did a git pull on uSDFS and I ca't seem to compile 'logger_RawWrite.ino' any more without the following errors.

Code:
/home/wwatson/arduino-1.8.9/arduino-builder -dump-prefs -logger=machine -hardware /home/wwatson/arduino-1.8.9/hardware -hardware /home/wwatson/.arduino15/packages -tools /home/wwatson/arduino-1.8.9/tools-builder -tools /home/wwatson/arduino-1.8.9/hardware/tools/avr -tools /home/wwatson/.arduino15/packages -built-in-libraries /home/wwatson/arduino-1.8.9/libraries -libraries /home/wwatson/Arduino/libraries -fqbn=teensy:avr:teensy4b2:usb=serial,opt=o2std,keys=en-us -ide-version=10809 -build-path /tmp/arduino_build_981447 -warnings=none -build-cache /tmp/arduino_cache_135472 -verbose /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite/logger_RawWrite.ino
/home/wwatson/arduino-1.8.9/arduino-builder -compile -logger=machine -hardware /home/wwatson/arduino-1.8.9/hardware -hardware /home/wwatson/.arduino15/packages -tools /home/wwatson/arduino-1.8.9/tools-builder -tools /home/wwatson/arduino-1.8.9/hardware/tools/avr -tools /home/wwatson/.arduino15/packages -built-in-libraries /home/wwatson/arduino-1.8.9/libraries -libraries /home/wwatson/Arduino/libraries -fqbn=teensy:avr:teensy4b2:usb=serial,opt=o2std,keys=en-us -ide-version=10809 -build-path /tmp/arduino_build_981447 -warnings=none -build-cache /tmp/arduino_cache_135472 -verbose /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite/logger_RawWrite.ino
Using board 'teensy4b2' from platform in folder: /home/wwatson/arduino-1.8.9/hardware/teensy/avr
Using core 'teensy4' from platform in folder: /home/wwatson/arduino-1.8.9/hardware/teensy/avr
Detecting libraries used...
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_981447/sketch/logger_RawWrite.ino.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /tmp/arduino_build_981447/sketch/logger_RawWrite.ino.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /home/wwatson/Arduino/libraries/uSDFS/src/diskio.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /home/wwatson/Arduino/libraries/uSDFS/src/ff.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /home/wwatson/Arduino/libraries/uSDFS/src/ffsystem.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /home/wwatson/Arduino/libraries/uSDFS/src/ffunicode.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /home/wwatson/Arduino/libraries/uSDFS/src/utility/ff_utils.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src /home/wwatson/Arduino/libraries/uSDFS/src/utility/sd_msc.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src /home/wwatson/Arduino/libraries/uSDFS/src/utility/sd_msc.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /home/wwatson/Arduino/libraries/uSDFS/src/utility/sd_msc.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /home/wwatson/Arduino/libraries/uSDFS/src/utility/sd_sdhc.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /home/wwatson/Arduino/libraries/uSDFS/src/utility/sd_spi.c -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /home/wwatson/Arduino/libraries/MSC/src/MassStorageDriver.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /home/wwatson/Arduino/libraries/MSC/src/MassStorageHost.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/antplus.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/ehci.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/enumeration.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/hid.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/hub.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/joystick.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/keyboard.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/keyboardHIDExtras.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/memory.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/midi.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/mouse.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/print.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/rawhid.cpp -o /dev/null
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/utility /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36/serial.cpp -o /dev/null
Generating function prototypes...
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /tmp/arduino_build_981447/sketch/logger_RawWrite.ino.cpp -o /tmp/arduino_build_981447/preproc/ctags_target_for_gcc_minus_e.cpp
/home/wwatson/arduino-1.8.9/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino_build_981447/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/precompile_helper /home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_981447 /home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 /tmp/arduino_build_981447/pch/Arduino.h -o /tmp/arduino_build_981447/pch/Arduino.h.gch
/home/wwatson/arduino-1.8.9/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_981447/pch -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/Arduino/libraries/uSDFS/src -I/home/wwatson/Arduino/libraries/MSC/src -I/home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 /tmp/arduino_build_981447/sketch/logger_RawWrite.ino.cpp -o /tmp/arduino_build_981447/sketch/logger_RawWrite.ino.cpp.o
In file included from /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite/logger_RawWrite.ino:59:0:
/home/wwatson/arduino-1.8.9/hardware/tools/arm/arm-none-eabi/include/time.h:37:8: error: redefinition of 'struct tm'
 struct tm
        ^
In file included from /home/wwatson/Arduino/libraries/uSDFS/examples/logger_RawWrite/logger_RawWrite.ino:6:0:
/home/wwatson/Arduino/libraries/uSDFS/src/uSDFS.h:55:17: error: previous definition of 'struct tm'
  typedef struct tm
                 ^
logger_RawWrite: In function 'void loop()':
logger_RawWrite:187: warning: suggest parentheses around assignment used as truth value 
       if(rc = f_open(&fil, filename, (FA_WRITE | FA_CREATE_ALWAYS))) die("open", rc);
                                                                    ^
Using library uSDFS at version 1.1.2 in folder: /home/wwatson/Arduino/libraries/uSDFS 
Using library MSC at version 1.0.0 in folder: /home/wwatson/Arduino/libraries/MSC 
Using library USBHost_t36 at version 0.1 in folder: /home/wwatson/arduino-1.8.9/hardware/teensy/avr/libraries/USBHost_t36 
Error compiling for board Teensy 4-Beta2.

Did not backup uSDFS before I did the git pull. Any Ideas?
I had just got the WavFilePlayer.ino working with the T4.

Can't seem to find the problem.

Edit: That is WavFilePlayer.ino with uSDFS and MSC.
 
Last edited:
@WMXZ

I don't know of I have missed something but I just did a git pull on uSDFS and I ca't seem to compile 'logger_RawWrite.ino' any more without the following errors.

...

Did not backup uSDFS before I did the git pull. Any Ideas?
I had just got the WavFilePlayer.ino working with the T4.

Can't seem to find the problem.

Edit: That is WavFilePlayer.ino with usdfs and MSC.

~May 26 is the last I see downloaded ZIP for uSDFS - there was a new Beta after that with the time change from TeensyLoader? I don't see other newer downloads from this thread since then. My last run notes post above is 6/3 … without DOCS it re-zips to 723KB …
 
@WMXZ

I don't know of I have missed something but I just did a git pull on uSDFS and I ca't seem to compile 'logger_RawWrite.ino' any more without the following errors.

found some issues that where introduced while handling other thread (bat recorder) compilation issues.
updated github
 
@WMXZ - Thanks for the update. That fixed the problem. I really like using this library. Versatile and easy to use:)
 
Back
Top