Skip to main content
Associate III
September 20, 2023
Solved

STM32H7 - ADC to micro SD card with sampling frequency of 3.6 MHz possible?

  • September 20, 2023
  • 2 replies
  • 2081 views

Hi, I am new to STM32. I have a STM32H723 nuncleo board where I want to sample 8 bit data from the on-board ADC at the maximum frequency of 3.6 MHz. Then I want to directly transfer the data to a SD card using DMA with SPI. Preferably I would want to add a timestamp to each sample, where this can get tricky to combine with the use of DMA.

ADC -> Memory + adding timestamp (As a buffer)

Memory -> micro SD card 

I need some tips and tricks how to do this, and if it is even possible to do at these speeds.

Thanks for all answers!

This topic has been closed for replies.
Best answer by TDK

It's possible but microsd communication is subject to delays, so you'll need to buffer data and due to the speed, you will quickly run out of data.

With a 256 kB buffer, you'll run out in about 70 ms. There is no guarantee that the microsd card won't stall for longer than this, but it should work most of the time.

2 replies

AScha.3
Super User
September 20, 2023

so you want write about 30Mbit continuous data stream to SD.

why this frequency ? when stop data ? will be many MB in view seconds...

well, SD in 4-bit mode, at max. 50 mbit - could work.

but writing "timestamp" ...maybe too much delay; just try it !

"If you feel a post has answered your question, please click ""Accept as Solution""."
elsoAuthor
Associate III
September 20, 2023

Yes, 4-bit might be enough for the application. The data should be sampled based on some trigger signals, and stop on another trigger. Normally lasting less than 100 ms.

8 bit X 3.6 MHz = 28.8 Mbps

However the interval of the timestamps is not decided yet, but is preferred to be with about 100 ns precision with every sample, but could be done less frequently to fit with the maximum data rate.

AScha.3
Super User
September 20, 2023

so 100ms sampling - and pause, how long ?

100ms at 3,6M -> 360KB ---> store in internal ram ! then write relaxed with time stamp info to SD .

H723 has 432KB ram, so no problem.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDK
TDKBest answer
September 20, 2023

It's possible but microsd communication is subject to delays, so you'll need to buffer data and due to the speed, you will quickly run out of data.

With a 256 kB buffer, you'll run out in about 70 ms. There is no guarantee that the microsd card won't stall for longer than this, but it should work most of the time.

"If you feel a post has answered your question, please click ""Accept as Solution""."