sd-cardnxp-microcontrollerfatfs

How to write large amount of data to sd card?


I use LPC54616 to write data on SD Card (FATFS library). The data that are written to SD card are generated in timer callback (~100B per 1ms). I use buffer (uint8_t buffer[6000];) to store this data and they are written to SD card (using f_write function) in main loop. In most cases, it manage to write data without problems (each write contains 100 - 200 Bytes in the buffer), but sometimes it take longer time to write data on SD card and the buffer overflows (more then 6000 Bytes are buffered).

Does somebody know how to solve this problem? Thank you for response.


Solution

  • That much data doesn't require a faster processor or multiple threads. A large buffer solves this problem (30kB in my case). Data must be written at once when the buffer is full.