Hi,
I am using a CC430F5137 connected directly to an SD card via SPI.
One of my design objectives is to perform a 40kHz ADC sample on a single channel for four seconds continuously and store it on the SD card.
I am thinking this is not possible to do with SD card write speeds on one CPU, but I would like to ask the internet to make sure before moving forward.
My code has two 512 byte buffers in RAM and uses the ADC interrupt service routine to place the sample data into one buffer until it is full, then switch buffers and initiate a DMA write via SPI to the SD card on the full buffer.
I believe the bottleneck here is the DMA write speed, which takes two MCLK cycles per byte. This results in a 17MHz write speed to the SD card. This would be fine except for this excerpt from the CC430 User Guide DMA Operation:
During a block transfer, the CPU is halted until the complete block has been transferred. The block
transfer takes 2 × MCLK × DMAxSZ clock cycles to complete. CPU execution resumes with its previous
state after the block transfer is complete.
Doesn't this defeat the purpose of DMA? Which is to perform memory transfer while leaving the CPU available to perform other tasks?
If the CPU is indeed halted, then the 1024 clocks cycles it takes to perform a 512 byte SD block write will stop the sampling data transfer in the ADC ISR.
I have successfully taken a little over 9000 samples (about 19000 bytes of data) of a 1000kHz sine wave and have observed periodic interruptions in the waveform.
Any advice? Is a 40kHz ADC sampling rate written to the SD card achievable?