USB 4.0.3 stack performance

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB 4.0.3 stack performance

Jump to solution
790 Views
nmay
Contributor III

I'm using the USB 4.0.3 stack in Host mode on a Coldfire V1 MCF51JM128 processor (DEMOJM board) and the performance is slower than I expected.  The code is the example for the MSD MFS generic code from Freescale.  And instead of running the full FAT demo code, I just use the following code and measure the time it takes to open a file, write a string and close the file.  The time to perform these actions (which are in the while loop below) is 109 ms.  I have a 1GB USB Freescale flash drive attached to the DEMOJM board.

 

void diskSpeedTest(void)

{

   volatile FRESULT returnCode = FR_OK; /* return code */

    FATFS fatfs;            /* File system object */

   FATFS *fs = NULL;

      uint_32 fre_clust = 0, size;

    FIL fil;                /* File object */

 

   pfLogInit();

   LED_PutVal(TRUE);

   

   time_delay(1000);

   LED_PutVal(FALSE);

 

   returnCode = f_mount(0, &fatfs);

    disk_initialize(0);

   time_delay(1000);

 

   LED_PutVal(TRUE);

 

   pfLog(PF_APPMGR,0x10);

   returnCode = f_getfree("0:", &fre_clust, &fs);

   pfLog(PF_APPMGR,0x11);

 

   while (1)

   {

      LED_PutVal(FALSE);

 

      returnCode = f_open(&fil,"NewFile1.dat",FA_WRITE|FA_CREATE_ALWAYS);

      pfLog(PF_APPMGR,0x12);

      returnCode = f_write(&fil,"Line 1: Write data to  file uses f_write function \n\r",52,&size);

      pfLog(PF_APPMGR,0x13);

      returnCode = f_sync(&fil);

      pfLog(PF_APPMGR,0x14);

      returnCode = f_close(&fil);

      pfLog(PF_APPMGR,0x15);

 

      LED_PutVal(TRUE);

      time_delay(100);

   }

}

 

Has anyone performed any benchmarks on the USB 4.0.3 stack?


How much performance can I expect out of this stack?  I believe this stack does not use a buffer for the transmit/receive data, so that would help some, but I'm afraid not enough to get me to our product needs.


To get a faster stack, do I need to look at other sources?


Thanks,

--Norm


Labels (1)
1 Solution
542 Views
TomE
Specialist II

I would suggest changing your benchmark to measure different operations.

As fine as measuring the execution times of every file-system call.

I'd also suggest performing some "bulk writes". Write 512 bytes of binary data, or 1k or even 10k if the interface supports it and measure the "bulk write" speed.

If that is high enough you might be able to buffer the data in your code and write it out a block at a time.

You need to work out what performance you require before finding if the system can deliver it.

Speed? We're using the stack we bought from SMX. It consists of three parts, USBD, USBH and SMXFS:

http://www.smxrtos.com/rtos/usb/smxusbd.htm

We're nearly maxing out the 12MHz USB port on an MPC5329 and getting about 800 kbytes/second during bulk writes.

Tom

View solution in original post

0 Kudos
4 Replies
542 Views
Monica
Senior Contributor III

Norm, how is the project going?

Was this useful?

Keep us posted!

Regards!

0 Kudos
543 Views
TomE
Specialist II

I would suggest changing your benchmark to measure different operations.

As fine as measuring the execution times of every file-system call.

I'd also suggest performing some "bulk writes". Write 512 bytes of binary data, or 1k or even 10k if the interface supports it and measure the "bulk write" speed.

If that is high enough you might be able to buffer the data in your code and write it out a block at a time.

You need to work out what performance you require before finding if the system can deliver it.

Speed? We're using the stack we bought from SMX. It consists of three parts, USBD, USBH and SMXFS:

http://www.smxrtos.com/rtos/usb/smxusbd.htm

We're nearly maxing out the 12MHz USB port on an MPC5329 and getting about 800 kbytes/second during bulk writes.

Tom

0 Kudos
542 Views
nmay
Contributor III

I found that the 4.0.3 USB stack has much more overhead than the CMX stack we were using.  (I'm not really surprised by this since the new stack does so much more.)  To make the system work, I did have to buffer up the writes to and call f_sync() rather than f_close()/f_open() for each write.  With these changes the throughput is adequate.  So Tom was right on with the need to buffer up the data.  Thanks!

--Norm

542 Views
Monica
Senior Contributor III

AWESOME Norm, keep it up! :smileyhappy:

0 Kudos