USBHost_t36 USB Mass Storage Driver Experiments

Could not figure out why I could not change directories with my file manager and stbasic using exFAT with fatFS. It was actually changing directories but using the f_getcwd() function was only showing "2/".
The reason is this:

Note: In this revision, this function cannot retrieve the current directory path on the exFAT volume.
It always returns the root directory path.

http://elm-chan.org/fsw/ff/doc/getcwd.html

For now to use exFAT for keeping track I will have to keep track of the current working directory manually.
 
@wwatson - Today I received the cheap drive/adapter and plugged it into my PC and had to initialize it. So I choose MBR
I then formatted all of it as one exfat partition...

I then ran the MBR_diskIO_test program and it ran...
Code:
Disk read Result: 0
33 c0 8e d0 bc 00 7c 8e c0 8e d8 be 00 7c bf 00
06 b9 00 02 fc f3 a4 50 68 1c 06 cb fb b9 04 00
bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10
e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00
b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09
f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74
26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00
7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13
9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00
8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe
4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84
55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55
aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64
e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75
00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54
43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00
00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66
53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66
61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd
18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4
05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd
10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8
24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69
74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72
20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69
6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e
67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74
65 6d 00 00 00 63 7b 9a 33 08 72 2d 5a 03 00 20
21 00 07 fe ff ff 00 08 00 00 00 38 f9 0d 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa

Master Boot Record
  Partition: 0 first Sector: 2048 total Sectors: 234436608
  Partition: 1 first Sector: 0 total Sectors: 0
  Partition: 2 first Sector: 0 total Sectors: 0
  Partition: 3 first Sector: 0 total Sectors: 0
Next up need to remember what speed test or the like there is...

Yes I also wondered if there was some linux disk format setups for Microcontrollers as well.

Probably will do a little more on the system with this and then try it out on one of the RPIs...

@Kurte - I am thinking of ordering the same SSD and USB to SATA adapter. Did you ever have it working with the T36 or T4?
I know that the USB3S2SAT3CB USB to SATA adapter is for USB 3.0. I have been trying to find out if it is backwards compatible with USB 2.0.
With the Kingston SSD I am trying to find out what the current draw is. Haven't been able to find that information on the Internet yet. I have read
reviews about them not working on a USB 2.0 port without external power.

Hope everyone is having a good holiday:)
 
Yes, USB3 supports ~1500mA on the port itself while USB2 supports 500mA, thats why USB2 drives require a 2nd USB port for power (1A combined) while USB3 can just use a single port

All USB3 drives are compatible with USB2, however, the data rate is limited by the bandwidth of the port (USB2 is slower than USB3)
 
Yes, USB3 supports ~1500mA on the port itself while USB2 supports 500mA, thats why USB2 drives require a 2nd USB port for power (1A combined) while USB3 can just use a single port

All USB3 drives are compatible with USB2, however, the data rate is limited by the bandwidth of the port (USB2 is slower than USB3)

Thanks, I think I will order them:)
 
For USB Host on T_3.6/4.0 external power of hub is needed inline unless simple flash or other low power device.

With a powered USB 3 hub inline for function with USB 3 adapters, though it may work if you get good 5V power on Teensy VIN pin as well - but that wasn't setup here. But even then USB host from Teensy is USB 2 and may not send out enough power? So powered USB3 hub best sure solution.

I found this to be nice - A USB powered HUB with an internal drive bay : newegg.com/orico-2588h3-us-bk-enclosure
I mounted a HDD in the enclosure and when wall powered the T4/3.6 can use it with hub software layer. Also allows other USB connects too - I never tried 2nd drive addressing, though it seems that was posted to work.
> On T_3.6 it rejects external power feedback - but some T4 breakouts will get backfed power from this unit and it will keep running when T4's device USB is removed.
 
For USB Host on T_3.6/4.0 external power of hub is needed inline unless simple flash or other low power device.

With a powered USB 3 hub inline for function with USB 3 adapters, though it may work if you get good 5V power on Teensy VIN pin as well - but that wasn't setup here. But even then USB host from Teensy is USB 2 and may not send out enough power? So powered USB3 hub best sure solution.

I found this to be nice - A USB powered HUB with an internal drive bay : newegg.com/orico-2588h3-us-bk-enclosure
I mounted a HDD in the enclosure and when wall powered the T4/3.6 can use it with hub software layer. Also allows other USB connects too - I never tried 2nd drive addressing, though it seems that was posted to work.
> On T_3.6 it rejects external power feedback - but some T4 breakouts will get backfed power from this unit and it will keep running when T4's device USB is removed.

@defragster - I still have my StarTech USB 2.0 to SATA adapter I can use. I was mainly interested In buying and using an SSD drive. I think is the same adapter you have. While playing with IDE drives I noticed that the T4 was powering from the adapter when the second power cord was plugged into the adapter.
 
@defragster - I still have my StarTech USB 2.0 to SATA adapter I can use. I was mainly interested In buying and using an SSD drive. I think is the same adapter you have. While playing with IDE drives I noticed that the T4 was powering from the adapter when the second power cord was plugged into the adapter.

Cool, My SSD's wouldn't power up without added external power (they were olde ones) - so I always used a hub of some sort for that - the orico above or other **. I have a box of things ( and a small pile ) I used over time on this thread. I drug in two new low capacity old Seagate HDD's from some computer and chromebook I recycled the other day ( a 3.5" and 2.5" ) I haven't plugged in at all.

Wondering if the Paul@PJRC T4 Device USB work with DMA would apply to the HOST USB adapter given memory would offload from CPU and speed up the transfers?

Paul suggested proper hubs spec won't feed power to T4 - but some external hub/connectors do and that is nice and seems functional. Without proper ESD and USB chips in place - like raw T4 USB D-/D+ wired out - hopefully a Hub will protect the T4 from surge and bad ESD.

EDIT:
** : Or a powered external drive box
 
Last edited:
Cool, My SSD's wouldn't power up without added external power (they were olde ones) - so I always used a hub of some sort for that - the orico above or other **. I have a box of things ( and a small pile ) I used over time on this thread. I drug in two new low capacity old Seagate HDD's from some computer and chromebook I recycled the other day ( a 3.5" and 2.5" ) I haven't plugged in at all.

Wondering if the Paul@PJRC T4 Device USB work with DMA would apply to the HOST USB adapter given memory would offload from CPU and speed up the transfers?

Paul suggested proper hubs spec won't feed power to T4 - but some external hub/connectors do and that is nice and seems functional. Without proper ESD and USB chips in place - like raw T4 USB D-/D+ wired out - hopefully a Hub will protect the T4 from surge and bad ESD.

EDIT:
** : Or a powered external drive box

I am going to order the SSD drive that @Kurte suggested from Amazon.
Was checking out 'tinyUSB' that was mentioned on another thread. I found that the Mass Storage driver is very close to what I had developed. But, one heck of lot more sophisticated than mine. It also has an EHCI driver for the IMX1062. There is also a FIFO functions available with it. I am totally in the dark when it comes to
using DMA and queuing. Just need time to learn about it:)
 
I am going to order the SSD drive that @Kurte suggested from Amazon.
Was checking out 'tinyUSB' that was mentioned on another thread. I found that the Mass Storage driver is very close to what I had developed. But, one heck of lot more sophisticated than mine. It also has an EHCI driver for the IMX1062. There is also a FIFO functions available with it. I am totally in the dark when it comes to
using DMA and queuing. Just need time to learn about it:)

I was avoiding SSD testing because of their volatile nature - and they didn't seem to process faster than HDD's - figured one spastic test left on too long might reduce life. And two older (refurb) ones I had went bad in use.

Nice that github.com/hathach/tinyusb looks to have useful features and is MIT licensed.
 
I am going to order the SSD drive that @Kurte suggested from Amazon.
Was checking out 'tinyUSB' that was mentioned on another thread. I found that the Mass Storage driver is very close to what I had developed. But, one heck of lot more sophisticated than mine. It also has an EHCI driver for the IMX1062. There is also a FIFO functions available with it. I am totally in the dark when it comes to
using DMA and queuing. Just need time to learn about it:)

Good Morning @wwatson - @defragster

Just catching up - had other distractions last couple of days. Yep, the HP SDD (120Gb) drive I had attached worked w/o external power, https://forum.pjrc.com/threads/5582...er-Experiments?p=205879&viewfull=1#post205879, think I used a ORICO USB3.0 to SATA III external drive enclosure. Have to go did it out.

Would be nice that at some time this all could get merged with USBHost_t36 which does have EHCI for the 1062 :)

Have to get back to this again - just have to find the links to update the libraries.
 
@mjs513 - interesting you got usable SSD with no external power - mine were Olde Schoole drives - but specs even on newer drives typically show writes over 500ma?

This thread focused on the WRITE speed - is there a read speed test - maybe do a read back of data written and show that speed in the same sketch?

I have new devices I should test with this but haven't compiled/run this lately.

And given Paul's speed up on the T4's 480 Mbit/s DEVICE USB - wondering if any of those DMA buffering improvements would fit here as Paul indicated the core USB hardware was the same on T4 Device and what is used here for HOST.
 
@defragster, @all - Here is a sketch that I have been playing with. It performs the same read speed test as the write speed tests. I think:)

I have modified WMXZ's logger_RawWrite.ino example to do read speed tests along with other changes to test both read and writes. You can change the buffer size and the byte count (8-32) per transfer. In line #47 the define is 0 for reads and 1 for writes.

I have only tested it with a Kingston 32G thumb drive. It seems that read speeds are very consistent with varying buffer sizes and byte counts up to a point. Writes speeds vary between 2.7 and 3.4 MBs depending on settings and read speeds were consistent at 5.41 MBs up to a buffer size of 32768 a byte size of 16 or 32 bits. This is on a T3.6. Have not tested it yet with the T4.
Would be great if you could check it out with your hardware.
The sketch:
Code:
//Copyright 2019 by Walter Zimmer
// test_RawWrite.ino
// Version 08-jun-19
// Modified for testing wwatson
// use following lines for early definitions of multiple partition configuration in uSDFS.h
#define MY_VOL_TO_PART
#include "uSDFS.h"
#include "MassStorage.h"

#if FF_MULTI_PARTITION		/* Multiple partition configuration */ 
	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 */
#endif
// end of early definition

#define TEST_DRV 2
//
#define MXFN 5 // maximal number of files //was 100
#define MXRC 1000 // number of records in file // was 1000
const char *fnamePrefix = "A";

//
#if TEST_DRV == 0
  const char *Dev = "0:/";  // SPI
#elif TEST_DRV == 1
  const char *Dev = "1:/";  // SDHC
#elif TEST_DRV == 2
  const char *Dev = "2:/";  // USB
#endif

FRESULT rc;        /* Result code */
FATFS fatfs;      /* File system object */
FIL fil;        /* File object */

#if defined(__MK20DX256__)
  #define BUFFSIZE (2*1024) // size of buffer to be written
#elif defined(__MK66FX1M0__)
  #define BUFFSIZE (32*1024) // size of buffer to be written
#elif defined(__IMXRT1062__)
  #define BUFFSIZE (8*1024) // size of buffer to be written
#endif
// Change the next two lines for writing or reading 0 = read, 1 = write.
// uint8_t buffer[BUFFSIZE];, uint16_t buffer[BUFFSIZE];, uint32_t buffer[BUFFSIZE];
#define WR_RD 0
uint32_t buffer[BUFFSIZE];

UINT wr;

/* Stop with error message */
void die(const char *text, FRESULT rc)
{ Serial.printf("%s: Failed with rc=%s.\r\n", text,FR_ERROR_STRING[rc]);  while(1) asm("wfi"); }

//=========================================================================
void blink(uint16_t msec)
{
  digitalWriteFast(13,!digitalReadFast(13)); delay(msec);
}

#ifndef HAVETM
  #include <time.h>
  #define HAVETM
#endif
extern "C" struct tm seconds2tm(uint32_t tt);
extern "C" struct tm decode_fattime (uint16_t td, uint16_t tt);


void listDir(const char *dirName)
{
	FRESULT res;
	DIR dir;
	FILINFO fno;

	res = f_opendir(&dir, dirName);                       /* Open the directory */
	Serial.printf("openDir %s\n",FR_ERROR_STRING[res]);
	if (res == FR_OK) 
	{
		for (;;) 
		{
			res = f_readdir(&dir, &fno);                   /* Read a directory item */
			if (res != FR_OK || fno.fname[0] == 0) break;  /* Break on error or end of dir */
			if(!strncmp(fno.fname,fnamePrefix,strlen(fnamePrefix)))
			{
			  Serial.printf("%s ", fno.fname);                /* Display the object name */
			  Serial.printf("%d ", fno.fsize);                /* Display the object size */
			  struct tm tx = decode_fattime (fno.fdate, fno.ftime);
			  Serial.printf("%4d-%02d-%02d %02d:%02d:%02d\n",
							tx.tm_year,tx.tm_mon,tx.tm_mday, 
							tx.tm_hour,tx.tm_min,tx.tm_sec);
			}
		}
    }
    f_closedir(&dir);
}

void setup()
{
  // wait for serial line to come up
  pinMode(13,OUTPUT);
  pinMode(13,HIGH);
  while(!Serial);
  Serial.println("Test logger_RawWrite");
  Serial.print("uSDFS_VER:"); Serial.println(uSDFS_VER);
  if((rc = f_mount (&fatfs, Dev, 1))) die("Mount",rc);      /* Mount/Unmount a logical drive */
//  BUFFSIZE = (fatfs.csize*FF_MIN_SS/2);
  Serial.print("BUFFSIZE :");  Serial.println(BUFFSIZE);
  Serial.print("Dev Type :");  Serial.println(Dev);

  Serial.printf("File System %s\n", fileSystem[fatfs.fs_type]);
  Serial.printf("Free Disk Size %d clusters\n",fatfs.free_clst);
  Serial.printf("Cluster Size %d sectors\n",fatfs.csize);
#if FF_MAX_SS != FF_MIN_SS
  Serial.printf("Sector Size %d bytes\n",fatfs.ssize);
#else
  Serial.printf("Sector Size %d bytes\n",FF_MIN_SS);
#endif
  //-----------------------------------------------------------
  Serial.printf("\nChange drive\n");
  if((rc = f_chdrive(Dev))) die("chdrive",rc);
#if WR_RD == 1
  Serial.printf("\nTESING DRIVE WRITE SPEED\n\n");
#else
  Serial.printf("\nTESING DRIVE READ SPEED\n\n");
#endif
}

void loop()
{
	static uint32_t count=0;
	static int32_t ifn=0;
	static uint32_t isFileOpen=0;
	static char filename[80];
	static uint32_t t0=0;
	static uint32_t t1=0;
  static uint32_t dtwmin=1<<31, dtwmax=0;
  static uint32_t dto=1<<31, dtc=0;

  if(ifn>MXFN) { blink(500); return; }
  
  // stop testing (finish actual file)
  while (Serial.available() > 0) 
  { if ('q' == Serial.read() ) ifn = MXFN+1; }
  
  if(!count)
  {
    // close file
    if(isFileOpen)
    { dtc = micros();
      //close file
      if ((rc = f_close(&fil))) die("close", rc);
      //
      isFileOpen=0;
      t1=micros();
      dtc = t1-dtc;
      float MBs = (MXRC*BUFFSIZE*sizeof(buffer[0])*1.0f)/(1.0f*(t1-t0));
      Serial.printf(" (%d - %f MB/s)\n (open: %d us; close: %d us; write: min,max: %d %d us)\n\r",
                        t1-t0,MBs, dto, dtc, dtwmin,dtwmax);
      dtwmin=1<<31; dtwmax=0;
    }
  }
  //
  if(!isFileOpen)
  {
    // open new file
    ifn++;
    if(ifn>MXFN) 
    { listDir(Dev);
	  rc = f_unmount(Dev);
      Serial.print("unmount "); Serial.println(FR_ERROR_STRING[rc]);
      pinMode(13,OUTPUT); return; 
    } // at end of test: prepare for blinking

    dto=micros();
    sprintf(filename,"%s_%05d.dat",fnamePrefix,(int)ifn);
    Serial.println(filename);
    //
    // check status of file
    rc = f_stat(filename,0);
    Serial.printf("stat %s %x\n",FR_ERROR_STRING[rc],fil.obj.sclust);
    
#if WR_RD == 1
    rc = f_open(&fil, filename, (FA_WRITE | FA_CREATE_ALWAYS));
#else
    rc = f_open(&fil, filename, FA_READ);
#endif
    Serial.printf(" opened %s %x\n\r",FR_ERROR_STRING[rc],fil.obj.sclust);
    // check if file is Good
    if(rc == FR_INT_ERR)
    { // only option is to close file
        rc = f_close(&fil);
        if(rc == FR_INVALID_OBJECT)
        { Serial.println("unlinking file");
          rc = f_unlink(filename);
          if (rc) die("unlink", rc);
        }
        else
          die("close", rc);
      // retry open file
#if WR_RD == 1
      if(rc = f_open(&fil, filename, (FA_WRITE | FA_CREATE_ALWAYS))) die("open", rc);
#else
	  if(rc = f_open(&fil, filename, FA_READ)) die ("open",rc);
#endif
    }
    //
    isFileOpen=1;
    t0=micros();
    dto=t0-dto;
  }
  
  if(isFileOpen)
  {
     // fill buffer
#if WR_RD == 1
     for(int ii=0;ii<BUFFSIZE;ii++) buffer[ii]='0'+(count%10);
#endif
     count++;
     if(!(count%10))Serial.printf(".");
     if(!(count%640)) Serial.println(); Serial.flush();
     uint32_t ta=micros();
#if WR_RD == 1
     //write data to file 
     rc = f_write(&fil, buffer, BUFFSIZE*sizeof(buffer[0]), &wr);
#else
     //read data from file 
     rc = f_read(&fil, buffer, BUFFSIZE*sizeof(buffer[0]), &wr);
#endif
     uint32_t tb=micros();
     if (rc == FR_DISK_ERR) // IO error
     {  Serial.printf(" write FR_DISK_ERR at count # %d\n",count);
        // only option is to close file
        // force closing file
        count=MXRC;
     }
     else if(rc) die("write",rc);
    //    
     uint32_t dt=tb-ta;
     if(dt<dtwmin) dtwmin=dt;
     if(dt>dtwmax) dtwmax=dt;
     //
     count %= MXRC;
  }    
}
 
Changed this :
Code:
void setup()
{
  // wait for serial line to come up
  pinMode(13,OUTPUT);
  pinMode(13,HIGH);
  while(!Serial);
#if WR_RD == 1
  Serial.println("Test logger_RawWriteRead>Write");
#else
  Serial.println("Test logger_RawWriteRead>Read");
#endif

Must need new libs? Not seeing any function except initial print - no LED HIGH before and only thing after startup was not liking a 64GB flash drive? Same result on three T4's :(
 
Using updated version of both MSC and UDFS from github.com/wwatson4506/MSC

SAME RESULT on T_3.6 and T_4.0

with IDE 1.8.10 and TeensyDuino 1.49b4 I get the same no result?
Code:
Test logger_RawWriteRead>Write
uSDFS_VER:30_Jun_19_07_17

That prints but the LED #13 never lights - even is No Serial makes it wait????? Like there is an issue somewhere? Using USBHost_t36 from TD1.49b4:

Code:
Using library uSDFS at version 1.1.2 in folder: T:\tCode\libraries\uSDFS 
Using library MSC at version 1.0.0 in folder: T:\tCode\libraries\MSC 
Using library USBHost_t36 at version 0.1 in folder: T:\arduino_1.8.10\hardware\teensy\avr\libraries\USBHost_t36
 
Same result with USBHost_t36 from June that was in saved folder.

Not seeing this LED on when Serial disconnected in TyComm? When Serial returns it then prints and nothing more?
Code:
void setup()
{
  // wait for serial line to come up
  pinMode(13,OUTPUT);
  pinMode(13,HIGH);
  while(!Serial);

And I can't DOWNGRADE to TD 1.48 to test without doing another install just now
 
@defragster
Yeah - had the same problem. Figured out that you have to run logger_RawWrite_FS sketch first then run the read speed sketch. Then I will get with an SSD:
Code:
Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :8192

Dev Type :2:/

File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE READ SPEED

A_00001.dat

stat FR_OK 0
 opened FR_OK 0

................................................................

.................................... (4807 - 6816.725586 MB/s)
 (open: 3013 us; close: 0 us; write: min,max: 0 1 us)

A_00002.dat

stat FR_NO_FILE 0
 opened FR_NO_FILE 0

write: Failed with rc=FR_INVALID_OBJECT.
with a buffsize of 32K:
Code:
TESING DRIVE READ SPEED

A_00001.dat

stat FR_OK 0
 opened FR_OK 0

................................................................

.................................... (4841 - [COLOR="#FF0000"][B]27075.398438 MB/s[/B][/COLOR])
 (open: 3013 us; close: 0 us; write: min,max: 0 1 us)
 
I have just tried running the test on my 120gb SSD, which took me awhile to locate yesterday. Forgot I put it in my portable bag, with backup stuff, in case I wanted to do some programming on a previous trip...

But needed it yesterday (for the cable) as to clone my computers old SSD (256gb) to my new one (1TB). So I thought I would try it with the current stuff...

I am trying it on T4 with TallDogs adapter....

Code:
Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :8192

Dev Type :2:/

File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE READ SPEED

A_00001.dat

stat FR_NO_FILE 0
 opened FR_NO_FILE 0

write: Failed with rc=FR_INVALID_OBJECT.
I am wondering if it does not like the volume? The one ExFat is setup for the whole 120gb drive
 
I have just tried running the test on my 120gb SSD, which took me awhile to locate yesterday. Forgot I put it in my portable bag, with backup stuff, in case I wanted to do some programming on a previous trip...

But needed it yesterday (for the cable) as to clone my computers old SSD (256gb) to my new one (1TB). So I thought I would try it with the current stuff...

I am trying it on T4 with TallDogs adapter....

Code:
…..
Change drive

TESING DRIVE READ SPEED

A_00001.dat

stat FR_NO_FILE 0
 opened FR_NO_FILE 0

write: Failed with rc=FR_INVALID_OBJECT.
I am wondering if it does not like the volume? The one ExFat is setup for the whole 120gb drive

Morning @KurtE
See my previous post #366 => Have to run the logger_RawWrite sketch first in the uSDFS example folder. Ran into same issue
 
Morning, yep I probably should have made the edit Defragster mentiontioned as I saw the first line about which test...

Ok So ran the write program after I edited to drive 2...
Code:
Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :8192

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_NO_FILE 0
 opened FR_OK 0

................................................................

.................................... (4176991 - 7.844882 MB/s)
 (open: 18000 us; close: 9000 us; write: min,max: 3971 163963 us)

A_00002.dat

stat FR_NO_FILE 337b5
 opened FR_OK 0

................................................................

.................................... (4014990 - 8.161415 MB/s)
 (open: 17996 us; close: 9000 us; write: min,max: 3971 9962 us)

A_00003.dat

stat FR_NO_FILE 338af
 opened FR_OK 0

................................................................

.................................... (4014990 - 8.161415 MB/s)
 (open: 17998 us; close: 9000 us; write: min,max: 3971 9962 us)

A_00004.dat

stat FR_NO_FILE 339a9
 opened FR_OK 0

................................................................

.................................... (4026996 - 8.137083 MB/s)
 (open: 29992 us; close: 21000 us; write: min,max: 3971 9968 us)

A_00005.dat

stat FR_NO_FILE 33aa3
 opened FR_OK 0

................................................................

.................................... (4014991 - 8.161413 MB/s)
 (open: 26996 us; close: 9000 us; write: min,max: 3971 9963 us)

A_00006.dat

stat FR_NO_FILE 33b9d
 opened FR_OK 0

................................................................

.................................... (4014991 - 8.161413 MB/s)
 (open: 26997 us; close: 9000 us; write: min,max: 3971 9963 us)

A_00007.dat

stat FR_NO_FILE 33c97
 opened FR_OK 0

................................................................

.................................... (4014991 - 8.161413 MB/s)
 (open: 26997 us; close: 9000 us; write: min,max: 3971 9962 us)

A_00008.dat

stat FR_NO_FILE 33d91
 opened FR_OK 0

................................................................

.................................... (4014990 - 8.161415 MB/s)
 (open: 26998 us; close: 9000 us; write: min,max: 3971 9962 us)

A_00009.dat

stat FR_NO_FILE 33e8b
 opened FR_OK 0

................................................................

.................................... (4032996 - 8.124977 MB/s)
 (open: 38992 us; close: 21000 us; write: min,max: 3971 9972 us)

A_00010.dat

stat FR_NO_FILE 33f85
 opened FR_OK 0

................................................................

.................................... (4014991 - 8.161413 MB/s)
 (open: 35996 us; close: 9000 us; write: min,max: 3971 9963 us)

openDir FR_OK
Arduino 0 2019-07-14 17:08:06
Ascii 0 2020-01-03 12:08:44
A_00001.dat 32768000 2020-01-04 05:14:30
A_00002.dat 32768000 2020-01-04 05:14:34
A_00003.dat 32768000 2020-01-04 05:14:38
A_00004.dat 32768000 2020-01-04 05:14:42
A_00005.dat 32768000 2020-01-04 05:14:46
A_00006.dat 32768000 2020-01-04 05:14:50
A_00007.dat 32768000 2020-01-04 05:14:54
A_00008.dat 32768000 2020-01-04 05:14:58
A_00009.dat 32768000 2020-01-04 05:15:02
A_00010.dat 32768000 2020-01-04 05:15:06
unmount FR_OK

And now the read...
Code:
Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :8192

Dev Type :2:/

File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE READ SPEED

A_00001.dat

stat FR_OK 0
 opened FR_OK 337b5

................................................................

.................................... (3000989 - 10.919067 MB/s)
 (open: 12001 us; close: 1 us; write: min,max: 2998 3987 us)

A_00002.dat

stat FR_OK 337b5
 opened FR_OK 338af

................................................................

.................................... (2999986 - 10.922718 MB/s)
 (open: 12002 us; close: 1 us; write: min,max: 2985 3000 us)

A_00003.dat

stat FR_OK 338af
 opened FR_OK 339a9

................................................................

.................................... (2999984 - 10.922725 MB/s)
 (open: 12005 us; close: 1 us; write: min,max: 2982 3000 us)

A_00004.dat

stat FR_OK 339a9
 opened FR_OK 33aa3

................................................................

.................................... (2999994 - 10.922688 MB/s)
 (open: 17995 us; close: 1 us; write: min,max: 2992 3000 us)

A_00005.dat

stat FR_OK 33aa3
 opened FR_OK 33b9d

................................................................

.................................... (2999991 - 10.922699 MB/s)
 (open: 17998 us; close: 1 us; write: min,max: 2990 3000 us)

openDir FR_OK
Arduino 0 2019-07-14 17:08:06
Ascii 0 2020-01-03 12:08:44
A_00001.dat 32768000 2020-01-04 05:14:30
A_00002.dat 32768000 2020-01-04 05:14:34
A_00003.dat 32768000 2020-01-04 05:14:38
A_00004.dat 32768000 2020-01-04 05:14:42
A_00005.dat 32768000 2020-01-04 05:14:46
A_00006.dat 32768000 2020-01-04 05:14:50
A_00007.dat 32768000 2020-01-04 05:14:54
A_00008.dat 32768000 2020-01-04 05:14:58
A_00009.dat 32768000 2020-01-04 05:15:02
A_00010.dat 32768000 2020-01-04 05:15:06
unmount FR_OK
 
This is funny. After @KurtE's post went back and seems to be hanging on me after it creates the first file:
Code:
Test logger_RawWriteRead>Write

Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :8192

Dev Type :2:/

File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE WRITE SPEED

A_00001.dat

stat FR_OK 0
 opened FR_OK 0
 
Ok. Just loaded my cruz 4gb memory stick and it hung right after it created the file name like it did with the SSD. If I load up my drive info sketch it does recognize the drive properly:
Code:
Test Drive Inquiry with uSDFS

Waiting For Device: 2:/

Change drive

Do Device Inquiry
Removable Device: YES
        VendorID: SanDisk 
       ProductID: U3 Cruzer Micro 
      RevisionID: 4.04

Get Device Capacity Specs
    Sector Count: 8013456
     Sector size: 512
   Disk Capacity: 8013456 * 512 Bytes

Device Inquiry Test Finished.
 
Something NOT right - the LED won't go HIGH ?!?!?! Same looking here with ...\libraries\uSDFS\examples\logger_RawWrite_FS\logger_RawWrite_FS.ino

As noted and Kurt found - there is an #ifdef about line #48 that should create files when set as:
#define WR_RD 1


Something weird here I was getting compile errors on ethernet USB compile too ...
 
@all - Started from scratch with one of my computers using Linux. Using Arduino 1.8.10, TD 1.49B4 I cloned fresh copys of MSC and uSDFS.

Here is the results of writes and reads of both exFAT and FAT32 on a USB stick with the T36. (test_RawWrite.ino)

USB stick exFAT format, WRITE:

Code:
Test logger_RawWrite
uSDFS_VER:30_Jun_19_07_17
BUFFSIZE :8192
Dev Type :2:/
File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 64 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE WRITE SPEED

A_00001.dat
stat FR_OK 0
 opened FR_OK 0

................................................................
.................................... (7327927 - 4.471660 MB/s)
 (open: 10020 us; close: 10000 us; write: min,max: 3855 1144860 us)

A_00002.dat
stat FR_OK 6
 opened FR_OK 0

................................................................
.................................... (8476928 - 3.865551 MB/s)
 (open: 6987 us; close: 12999 us; write: min,max: 3856 1154860 us)

A_00003.dat
stat FR_OK 3ee
 opened FR_OK 0

................................................................
.................................... (8470928 - 3.868289 MB/s)
 (open: 6996 us; close: 12999 us; write: min,max: 3856 1150860 us)

A_00004.dat
stat FR_OK 7d6
 opened FR_OK 0

................................................................
.................................... (7336928 - 4.466175 MB/s)
 (open: 6995 us; close: 9999 us; write: min,max: 3855 1151860 us)

A_00005.dat
stat FR_OK bbe
 opened FR_OK 0

................................................................
.................................... (7370933 - 4.445570 MB/s)
 (open: 33993 us; close: 27999 us; write: min,max: 3855 1147860 us)

openDir FR_OK
A_00001.dat 32768000 2020-01-04 09:11:12
A_00002.dat 32768000 2020-01-04 09:11:20
A_00003.dat 32768000 2020-01-04 09:11:28
A_00004.dat 32768000 2020-01-04 09:11:36
A_00005.dat 32768000 2020-01-04 09:11:42
unmount FR_OK


USB stick exFAT format, READ:

Code:
Test logger_RawWrite
uSDFS_VER:30_Jun_19_07_17
BUFFSIZE :8192
Dev Type :2:/
File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 64 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE READ SPEED

A_00001.dat
stat FR_OK 0
 opened FR_OK 6

................................................................
.................................... (2999931 - 10.922918 MB/s)
 (open: 3018 us; close: 2 us; write: min,max: 2927 2998 us)

A_00002.dat
stat FR_OK 6
 opened FR_OK 3ee

................................................................
.................................... (2999805 - 10.923377 MB/s)
 (open: 116 us; close: 2 us; write: min,max: 2801 2998 us)

A_00003.dat
stat FR_OK 3ee
 opened FR_OK 7d6

................................................................
.................................... (2999798 - 10.923402 MB/s)
 (open: 131 us; close: 3 us; write: min,max: 2793 2998 us)

A_00004.dat
stat FR_OK 7d6
 opened FR_OK bbe

................................................................
.................................... (2999783 - 10.923457 MB/s)
 (open: 147 us; close: 2 us; write: min,max: 2779 2998 us)

A_00005.dat
stat FR_OK bbe
 opened FR_OK fa6

................................................................
.................................... (2999977 - 10.922750 MB/s)
 (open: 8953 us; close: 2 us; write: min,max: 2971 2998 us)

openDir FR_OK
A_00001.dat 32768000 2020-01-04 08:38:34
A_00002.dat 32768000 2020-01-04 08:38:44
A_00003.dat 32768000 2020-01-04 08:38:54
A_00004.dat 32768000 2020-01-04 08:39:00
A_00005.dat 32768000 2020-01-04 08:39:10
unmount FR_OK

USB stick FAT32 format, WRITE:

Code:
Test logger_RawWrite
uSDFS_VER:30_Jun_19_07_17
BUFFSIZE :8192
Dev Type :2:/
File System FS_FAT32
Free Disk Size 1854762 clusters
Cluster Size 32 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE WRITE SPEED

A_00001.dat
stat FR_OK 0
 opened FR_OK 0

................................................................
.................................... (13684987 - 2.394449 MB/s)
 (open: 266955 us; close: 54999 us; write: min,max: 6855 4165855 us)

A_00002.dat
stat FR_OK 8422
 opened FR_OK 0

................................................................
.................................... (14405988 - 2.274610 MB/s)
 (open: 351926 us; close: 46999 us; write: min,max: 6855 4243860 us)

A_00003.dat
stat FR_OK 8bf2
 opened FR_OK 0

................................................................
.................................... (14319987 - 2.288270 MB/s)
 (open: 370936 us; close: 41999 us; write: min,max: 6855 4204860 us)

A_00004.dat
stat FR_OK 3681
 opened FR_OK 0

................................................................
.................................... (9839987 - 3.330086 MB/s)
 (open: 296934 us; close: 52999 us; write: min,max: 6859 119860 us)

A_00005.dat
stat FR_OK 5301
 opened FR_OK 0

................................................................
.................................... (14570987 - 2.248852 MB/s)
 (open: 389938 us; close: 39999 us; write: min,max: 6859 4235860 us)

openDir FR_OK
A_00001.dat 32768000 2020-01-04 09:11:18
A_00002.dat 32768000 2020-01-04 09:11:32
A_00003.dat 32768000 2020-01-04 09:11:46
A_00004.dat 32768000 2020-01-04 09:11:56
A_00005.dat 32768000 2020-01-04 09:12:12
unmount FR_OK

USB stick FAT32 format, READ:

Code:
Test logger_RawWrite
uSDFS_VER:30_Jun_19_07_17
BUFFSIZE :8192
Dev Type :2:/
File System FS_FAT32
Free Disk Size 1854762 clusters
Cluster Size 32 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE READ SPEED

A_00001.dat
stat FR_OK 0
 opened FR_OK 8422

................................................................
.................................... (6047985 - 5.418003 MB/s)
 (open: 17959 us; close: 2 us; write: min,max: 5993 8998 us)

A_00002.dat
stat FR_OK 8422
 opened FR_OK 8bf2

................................................................
.................................... (6050986 - 5.415316 MB/s)
 (open: 17940 us; close: 3 us; write: min,max: 5992 8998 us)

A_00003.dat
stat FR_OK 8bf2
 opened FR_OK 3681

................................................................
.................................... (6053986 - 5.412632 MB/s)
 (open: 17948 us; close: 3 us; write: min,max: 5993 8998 us)

A_00004.dat
stat FR_OK 3681
 opened FR_OK 5301

................................................................
.................................... (6053986 - 5.412632 MB/s)
 (open: 17947 us; close: 3 us; write: min,max: 5993 8998 us)

A_00005.dat
stat FR_OK 5301
 opened FR_OK 43f1

................................................................
.................................... (6056984 - 5.409953 MB/s)
 (open: 17949 us; close: 3 us; write: min,max: 5993 8998 us)

openDir FR_OK
A_00001.dat 32768000 2020-01-04 08:40:06
A_00002.dat 32768000 2020-01-04 08:40:22
A_00003.dat 32768000 2020-01-04 08:40:36
A_00004.dat 32768000 2020-01-04 08:40:50
A_00005.dat 32768000 2020-01-04 08:41:06
unmount FR_OK

When I get back from work today I am going to start testing with HD's, SD card readers and the T4.

Kinda confused about the problems others are having.
 
@all - Started from scratch with one of my computers using Linux. Using Arduino 1.8.10, TD 1.49B4 I cloned fresh copys of MSC and uSDFS.

Here is the results of writes and reads of both exFAT and FAT32 on a USB stick with the T36. (test_RawWrite.ino)

...

When I get back from work today I am going to start testing with HD's, SD card readers and the T4.

Kinda confused about the problems others are having.

Confusing to say the least - the LED HIGH in setup doesn't even happen before SerMon online?

Just deleted hardware Teensy AVR folder and did TD 1.49 b4 reinstall and build - still acts the same with the MSC and uSDFS downloaded last night.

Not sure what other pollution I could have - other sketches work ( except the ethernet USB dongle )

Last T4 was PJRC final Beta breakout - the most used prior IIRC.

Moved to TallDog latest and i2c SSD1306 works as does FRDM board also with SSD1306.

But on both of those boards running sketch this does not work to power the LED - like it didn't on prior logger testing ?!?!?!
Code:
void setup() {
  Serial.begin(9600);
[B]  pinMode(13,OUTPUT);
  pinMode(13,HIGH);
[/B]  while ( !Serial && millis() < 4000);

:confused:

<EDIT> but running ...\HiLowTest\HiLowTest.ino when it does the INPUT_PULLUP on pin #13 the LED is lit?
 
@wwatson
Something indeed strange. Just downloaded fresh copies of both libraries and retested on a T3.6

Cruz 4GB drive:
Code:
Test logger_RawWriteRead>Write

Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :32768

Dev Type :2:/

File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 64 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE WRITE SPEED

A_00001.dat

stat FR_OK 0
 opened FR_OK 0

120GB SDD:
Code:
Test logger_RawWriteRead>Write

Test logger_RawWrite

uSDFS_VER:30_Jun_19_07_17

BUFFSIZE :32768

Dev Type :2:/

File System FS_EXFAT
Free Disk Size -1 clusters
Cluster Size 256 sectors
Sector Size 512 bytes

Change drive

TESING DRIVE WRITE SPEED

A_00001.dat

stat FR_OK 0
 opened FR_OK 0
Both stop at same place on both the T4 and the T3.6.
 
Back
Top