RT1160 SD card writing throughput in rtos

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

RT1160 SD card writing throughput in rtos

1,196件の閲覧回数
MaxChung
Contributor I

Hi, 

I modified sample codes of evkmimxrt1160_sdcard_fatfs_freertos_cm7 and test SD card writing speed in rtos, the file system were exFAT and FAT32, respectively. But the speed is very slow, so I would like to learn if this is a bug or a limitation.

Described as follows:

Hardware: MIMXRT1160-EVK
SDK version: SDK_2_12_0_MIMXRT1160-EVK
Micro SD card: SanDisk SDXC U1 A1 64GB
Sample codes: sdmmc_examples/evkmimxrt1160_sdcard_fatfs_freertos_cm7

1. exFAT
I formated SD card as an exFAT format on PC first, then I modified source codes as following
a) ffconf.h
#define FF_USE_MKFS 0
#define FF_USE_LFN 3
#define FF_LBA64 1
#define FF_FS_EXFAT 1

b) sdcard_fatfs_freertos.c
uint8_t *pubBuf = NULL;
uint16_t uiCount = 1000U;
uint32_t uiSize = 1024 * 16U;
uint32_t uiStartTick = 0U, uiEndTick = 0U;

pubBuf = OSA_MemoryAllocate(uiSize);
pubBuf[0] = 't';
pubBuf[1] = 'a';
pubBuf[2] = 's';
pubBuf[3] = 'k';
pubBuf[4] = '1';

.... (ignore some original codes)

PRINTF("\r\nBegin testing SD throughput ...\r\n");
uiStartTick = OSA_TimeGetMsec();
while (uiCount > 0)
{
    error = f_write(&g_fileObject1, pubBuf, uiSize, &bytesWritten);
    uiCount--;
    if (uiCount % 100 == 0)
    {
        uiEndTick = OSA_TimeGetMsec();
        PRINTF("Write 100 times, total size = %u (bytes), need ticks = %u (ms)\r\n", uiSize*100, uiEndTick - uiStartTick);

        uiStartTick = uiEndTick;
    }
}

c) Let FileAccessTask2 idle, only write SD card in FileAccessTask1

The output was 

=====================================
SDCARD fatfs freertos example.

Start CardDetectTask.

Card inserted.

Create directory......
Directory exists.

Begin testing SD throughput ...
Write 100 times, total size = 1638400 (bytes), need ticks = 3314 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3501 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3284 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3267 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3268 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3267 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3282 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3271 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3395 (ms)
Write 100 times, total size = 1638400 (bytes), need ticks = 3207 (ms)
TASK1: finished.
=====================================

So the writing speed is about 0.48 MiB/s
I also modified ffconf.h to test the writting speed of FAT32, but it was bad as well.

The source codes ("source" directory of evkmimxrt1160_sdcard_fatfs_freertos_cm7) of testing exFAT format is attached, please check if it's a bug or a limitation, thanks.

タグ(1)
0 件の賞賛
返信
6 返答(返信)

1,131件の閲覧回数
MaxChung
Contributor I

Hi Carlos,

Thanks for the reply and sorry for late reply.
I don't have a standalone PC installed Linux (I use VirtualBox if need to use Linux), so I cannot use dd or f3write now. But I test read/write throughput by CrystalDiskMark on Windows 10, the result is as attachment

SEQ1M Q8T1: Sequential 1MiB, Queues = 8, Threads = 1
SEQ1M Q1T1: Sequential 1MiB, Queues = 1, Threads = 1
RND4K Q32T1: Random 4KiB, Queues = 32, Threads = 1
RND4K Q1T1: Random 4KiB, Queues = 1, Threads = 1

By the way, I also copy a file about 100 MB from other folder to SD card on Windows 10, it needs about 4~5 seconds.

Thanks.

0 件の賞賛
返信

1,109件の閲覧回数
CarlosGarabito
NXP TechSupport
NXP TechSupport

@MaxChung , if you run the SDK example for SD read or SD write, did you have errors of the speed too? Or it only occurred with your code?

0 件の賞賛
返信

1,104件の閲覧回数
MaxChung
Contributor I

Hi Carlos,

I run SDK example evkmimxrt1160_sdcard_fatfs_freertos_cm7 ( rtos + fatfs, or rtos + exfat) to write to SD card, but the original example only writes few bytes (7 bytes) so we cannot realize it's very slow. For this reason, I added some codes to write more data to SD and measured its spent time, I think I just added a little bit of codes and will not cause any problem, could you please take a look over this problem?

We need to record audio data to files on SD card continuously, at least 2.5 MB per second, so if the writing speed is very slow, we cannot meet this requirement. Thus, I would like to know if it is possible to meet this on RT1160 and the writting SD problem I described is a bug or limitation.

Thanks.

0 件の賞賛
返信

1,089件の閲覧回数
CarlosGarabito
NXP TechSupport
NXP TechSupport

Hi, in this case, I need your code in order to try to reproduce your problem, I am sending by other way this requirement, could you please answer and send us the code?

0 件の賞賛
返信

1,078件の閲覧回数
MaxChung
Contributor I

Hi Carlos,

I had replied that support case just moment, please help to check, thank you!

0 件の賞賛
返信

1,147件の閲覧回数
CarlosGarabito
NXP TechSupport
NXP TechSupport

Hi @MaxChung 

Well, first off all, did you test your card in a pc?, check this links to make a test on pc to see if the problem isn't a SD Card

https://handyman.dulare.com/testing-sd-card-capacity-and-speed-in-linux/

https://handyman.dulare.com/a-quick-way-to-check-sd-card-speed-in-linux-command-line/

 

0 件の賞賛
返信