Dear community,

I would like to ask for some advice on a project. I'm trying to log data to a SD card from an ADC and some IMUs running over SPI. I'm logging data for 24 hours. The ADC is sampled at 1 kHz and the IMUs at 100 Hz. I'm using a T4.1 and SdFat-beta. My program is a modification of the ExFatLogger. I have formatted the SD card using the ExFatFormatted before a datalogging session. The ADC spits out 24 bytes of data that needs to read every 1 ms. I'm not to concerned with IMUs as they only need to be read every 10 ms.

I have managed to "miss" only about 30 seconds of data for the whole 24 hr period by using an old Samsung micro-SD card. So I get 99.96% of the data. I have tried several other micro SD-cards (including SanDisk Industrial and Greenliant using SLC memory) but their performance is worse. It annoys me a bit that I do not get all of the data. I'm going to miss samples when writing to the SD card takes more than 1 ms.

I'm leaning toward using the DMASPI library for the SPI communication and as long as the DMA buffers are large enough the processor should have enough time to write data to the SD-card. I have not used the DMASPI library or DMA before and the examples for the DMASPI library are a bit difficult to interpret and that is why I'm asking.

Does anyone have (other) suggestions of how to make this work?