Hi,
can you please tell what maximal sustained data writing speed can be achieved with SD card in RT600 processor?
I know that the top supported mode is SDR104. This means 104 MBps peak transfer rate with 208 MHz clock. In the examples the clock is reduced down to 198 MHz. This should give peak rate 99 MBps.
When I tried to write 3.5-MByte blocks of data to a file using FAT FS, I could reach only 30.20 MBps. MCU was clocked by 297 MHz. Tested micro SD card was SanDisk Ultra 128GB "red-blue". In USB3.0 reader it demonstrated higher write speed ~33 MBps. When I tested performance of another card (from Samsung) writing in RT600 gave very similar result 29.44 MBps, in spite of declared by Samsung write rate 90 MBps. In USB3.0 card reader this Samsung Evo Plus "white-red" (old type) micro SD card has demonstrated write rate ~80 MBps that is close to claimed 90 MBps. Thus, the problem is in SDHC of RT600. I have to note that in this test in the background of the card writing process there was DMA transfer of data from flexSPI with the rate 10.56 MBps. This background DMA data transfer occupies small processor core time (1.51%, for DMA configuring in the interrupt) and memory bus bandwidth (estimate?). Thus, it should not affect measurement drastically.
Investigation of the source code of f_write() command has shown that it uses ADMA2 for data transfer. In accordance with the microcontroller description this is the most advanced mode supported by the current SDHC.The sequence of procedural calls is relatively long:
f_write() in "ff.c" -> disk_write() in "disko.c" -> sd_disk_write() in "fsl_sd_disk.c" ->
SD_WriteBlocks() in "fsl_sd.c" -> SD_Write() in "fsl_sd.c" -> SD_Transfer() in "fsl_sd.c ->
SDMMCHOST_TransferFunction() in "fsl_sdmmchost.c" ->
here setting .dmaMode = kUSDHC_DmaModeAdma2; ->
USDHC_TransferNonBlocking() in "fsl_usdhc.c".
However, such a long sequence should not be a problem for a 300 MHz MCU, but additional computations definitely took place when FAT is used. Thus, raw ADMA2 transfer should be definitely faster. The question is how fast it can be?
When I have tested writing speed of uSD card in Cypress PSoC 6 MCU running at 100 MHz with 95 MHz SD bus clock, SDR, I have got 32.412 MBps writing 2MB blocks by ADMA2. Cypress MCU SDHC also supports ADMA3, and endless data flow can be sent by one command CMD25. In theory endless data flow can be sent also by ADMA2, but in Cypress ADMA2 in the default mode the number of sectors to be written is coded by 16 bits. This limit transfer size by 32 Mbytes. For some reason, I failed to switch Cypress ADMA2 to 32-bit coding of the number of transmitted sectors. Cypress ADMA3 has 32-bit coding of the number of sectors to transmit. This limit transfer by 2TB that exceeds capacities of modern SD cards. For this reason it is like “unlimited”.
In spite of support of more modern standard ADMA3 by Cypress MCU, I would expect higher data rate from RT600 because of its much higher 300 MHz clock. Linear scaling from ADMA2 Cypress performance gives expected write rate about 90 MBps. This is about 3x more than measured FAT FS write rate. I definitely shall try pure ADMA2 in RT600, but would be thankful if you could share your experience about it. For instance, I am curious to know whether RT600 ADMA2 supports 32-bit coding of the number of sectors to transmit.
With best regards, Alexei
Hi @Vyssotski ,
You can refer to this post.
https://community.nxp.com/t5/i-MX-RT/how-can-make-MSC-and-SDMMC-faster/m-p/1377250
Regards,
Jing