Writing 16-bit data to an SD card at 44 kHz

I am using an STM32F4 microcontroller with a microSD card. I collect analog data through DMA.

I use a double buffer, taking 1280 (10 * 128 - 10 FFT) samples at a time. When one buffer is full, I set the flag, and then look at 128 samples at a time and run the FFT calculation on it. It all works well.

The data is taken with the frequency I want, and the FFT calculation will be what I expected. If I just let the program run for one second, I see that it launches the FFT approximately 343 times (44000/128).

But the problem is that I would like to save 64 values ​​from this FFT to the SD card.

  • I am using the HCC file system library.
  • Each FFT calculation cycle I copy 64 values ​​to an array.
  • After every 10 calculations, I write the contents of this array to a file and start over.
  • The array stores 640 float_32 values ​​(10 * 64).

This works great for a one second test run. I get 22,000 values ​​stored on an SD card.

But as I increase the time, I begin to lose counts, as the SD card takes longer to record. I need an SD card to store more than 87 bps (4 bytes * 64 * 343 = 87808). I tried to increase the sample size of the DMA buffer, and then the number of times it writes, but did not find this to help.

I use an 8G microSD card, class 4. I formatted the SD card to the default FAT32 distribution block size by default of 2048.

? , . ? , - ?

, clifford , , SD- 16- 48 ksamples/s?.

+3
3

, - . RAM , .

RTOS, , , .

RTOS, , 64*sizeof(float_32), , ; , 343, 1 87 . , , , .

DMA , DMA.

0

, . 3 , 3 4 . , , . 16 (32 / * 64 / * 4 /). 5 6 , SD-.

, 1280 ; . , CPU ( Flash)

0

, .

SD- SPI (, , ) 512 , SD, ( ). SPI SD- , , (, ).

API, , . - , , , , , . , , . , , (, 2-3 ), , . , .

SD.

0

All Articles