USB host msd project with heap on SDRAM speed issue (IMXRT1176)

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

USB host msd project with heap on SDRAM speed issue (IMXRT1176)

1,387 Views
ahmedhrabi
Contributor IV

Hi, 

I have some problems with USB host msd on imxrt1176.

I'am using the project 'evkmimxrt1170_host_msd_fatfs_freertos_cm7' of the SDK, but i have moved heap, stack, and global data to SDRAM.

As a know issue,  when we put the heap on cached memory like OCRAM or SDRAM, much of the middleware does not function correctly. So i applied the corrections of the following link and it works: 

https://community.nxp.com/t5/i-MX-RT-Knowledge-Base/Using-NonCached-Memory-on-i-MXRT/ta-p/1183369

But by activating cache with the macro “DATA_SECTION_IS_CACHEABLE=1”, the transfer becomes too slow, about 200Ko/S

The original SDK project have a transfer speed of about 4Mo/S.

Is there any recommendations (solution) to maintain the speed and put the heap on the SDRAM at the same time?

 

Regards.

 

 

0 Kudos
Reply
4 Replies

1,327 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @ahmedhrabi :

 

could you please let me know which version of SDK you are using?

 

Regards

Daniel

0 Kudos
Reply

1,321 Views
ahmedhrabi
Contributor IV
Hi @danielchen,

The SDK version is 2.12.1

Regards.
0 Kudos
Reply

1,283 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

For this performance issue, it is caused by that the USB buffer was configured in a non-cache section in SDRAM, compared with TCM, the cpu and dma access the sdram will take more time, so the performance is substantially reduced.  so we need to set the buffer to cacheable memory and configure the memory as shareable.

1,274 Views
ahmedhrabi
Contributor IV

Hi @danielchen,

Thank you for the response, it will be great to have more details (sample project, tutorial...) for how to implement the solution.

I tried to implement it by this way but it doesn't work (enumeration failed):

  • Setting SDRAM shareable
    MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);

 

  • Set DMA buffer in SDRAM : #define USB_GLOBAL USB_LINK_USB_GLOBAL_BSS
    #define USB_BDT USB_LINK_USB_BDT_BSS
    #define USB_DMA_DATA_NONINIT_SUB USB_LINK_NONCACHE_NONINIT_DATA
    #define USB_DMA_DATA_INIT_SUB
    #define USB_CONTROLLER_DATA USB_LINK_NONCACHE_NONINIT_DATA

The only solution that i have found to boost USB performances and keep heap on SDRAM was this patch (that was not validated from NXP team): 

ahmedhrabi_0-1679658815783.png

 

Here is a link of the patch: 

https://community.nxp.com/t5/i-MX-RT/USB-Host-enumeration-fails/m-p/1436138

It will be great to have a confirmation for the patch.

 

Regards.

0 Kudos
Reply