Demo for USB High speed on K26 (FRDM K66)

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

Demo for USB High speed on K26 (FRDM K66)

Jump to solution
1,189 Views
PO220
Contributor IV

Hi

 

I'm looking for an application with SD card and High speed USB on MK26

I plan to test with the FRDM-K66 demo board.

 

I need to simultaneously have a COM port and a mass storage disk : For this I found the example usb_device_composite_cdc_msc_sdcard

 

But I can not find an example with high speed (Required for mass storage with the SD card)

 

> Is there an example in high speed ?

> Is this a simple parameter in the example usb_device_composite_cdc_msc_sdcard ? Or another totally different way ?

 

thank you in advance

Labels (1)
0 Kudos
1 Solution
611 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi PO220

So, we couldn't say a exact value for transfers. In theory, a ideal bus with 512-bytes bulk transfers in High speed can transfer up to 53.248 MB/s, so this is the maximum limit for a HS bus, but real-world performance varies by other factors. This performance can vary with the bandwidth, host controllers, host architecture, latencies included when access to system memory, etc,

Now, you are not changing USB transfer speed, you are changing Buffer size for access to memory, since you have more data available to transfer, transfer speed will "increase". If you run at HSRUN mode with 180MHz clock, SDHC clock could be 45MHz to get more performance. But from my test, there is barely such a performance gain when buffer size is small. So the main bottleneck is how much RAM buffer you can allocate for store read or write data.


Hope this information helps you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
5 Replies
611 Views
PO220
Contributor IV

Hi

Sorry for my late reply.

I'm trying to run with HSRUN

I replace

//  BOARD_BootClockRUN();

by

BOARD_BootClockHSRUN();

I had to change this in void BOARD_BootClockHSRUN(void)

 //   CLOCK_SetInternalRefClkConfig(kMCG_IrclkEnableInStop, kMCG_IrcSlow, 0U);

by
    CLOCK_SetInternalRefClkConfig(kMCG_IrclkEnable, kMCG_IrcSlow, 0U);

I win about 0.5MB/s.

I look for the SD speed now

Thank you very much

0 Kudos
611 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi PO220

In order to change between high speed and full speed drivers in our USB Stack you could find a usb_device_config.h file, this has the macros that need to change, EHCI = High speed drivers and KHCI =  Full Speed drivers, hence, if you want to load your example as High speed you should have something like:

/*! @brief KHCI instance count */
#define USB_DEVICE_CONFIG_KHCI (0U)

/*! @brief EHCI instance count */
#define USB_DEVICE_CONFIG_EHCI (1U)
‍‍‍‍‍

This definition would change all your project as High speed
Hope this information helps you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
611 Views
PO220
Contributor IV

Thank you for your answer

In my demo project EHCI is already ON.

I do not know what stupidity I made Monday... now High speed works well with the same "usb_device_msc_sdcard/freertos" demo project !

The speed is directly related to the size of  USB_DEVICE_MSC_READ_BUFF_SIZE and USB_DEVICE_MSC_WRITE_BUFF_SIZE.

Whith

#define USB_DEVICE_MSC_READ_BUFF_SIZE (512U)

I get a speed of 650 kB/s for a large file reading (500MB)

Whith

#define USB_DEVICE_MSC_READ_BUFF_SIZE (54784U) //107*512

I get a speed of 6 - 6.5MB/s for a large file reading

Whith

#define USB_DEVICE_MSC_READ_BUFF_SIZE (145920U) //285*512

(Need to declare the buffer on SRAM_U)

I get a speed of 7MB/s for a large file reading

The size of the buffer has no influence beetween 54784 and 145920. Is 7MB/s the maximum limit for Hs module ? Or are there other parameters to optimize?

Thank you in advance

0 Kudos
612 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi PO220

So, we couldn't say a exact value for transfers. In theory, a ideal bus with 512-bytes bulk transfers in High speed can transfer up to 53.248 MB/s, so this is the maximum limit for a HS bus, but real-world performance varies by other factors. This performance can vary with the bandwidth, host controllers, host architecture, latencies included when access to system memory, etc,

Now, you are not changing USB transfer speed, you are changing Buffer size for access to memory, since you have more data available to transfer, transfer speed will "increase". If you run at HSRUN mode with 180MHz clock, SDHC clock could be 45MHz to get more performance. But from my test, there is barely such a performance gain when buffer size is small. So the main bottleneck is how much RAM buffer you can allocate for store read or write data.


Hope this information helps you
Have a great day,
Jorge Alcala

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
611 Views
PO220
Contributor IV

Hi

I bought the FRDM-K66F

I'm testing demo project for High speed module benchmark..

usb_device_msc_sdcard or usb_device_composite_cdc_msc_sdcard it's the same :

220ko/s max to transfer a large file (20 or 180Mo) (a bad full speed...)

I modified disk_sdcard.c

g_msc.speed = USB_SPEED_FULL;

with

g_msc.speed = USB_SPEED_HIGH ; //USB_SPEED_FULL;

bm or freertos it's the same

USB_SPEED_FULL; or USB_SPEED_HIGH ; it's the same

With USB_DEVICE_MSC_READ_BUFF_SIZE and USB_DEVICE_MSC_WRITE_BUFF_SIZE to 5120U (instead 512)

The flow rate increases to 577ko/s

>> What is the max (good) value for USB_DEVICE_MSC_READ_BUFF_SIZE and USB_DEVICE_MSC_WRITE_BUFF_SIZE ?

>>Are there other parameters to optimize ?

thanks in advance

0 Kudos