cancel
Showing results for 
Search instead for 
Did you mean: 

High speed Sampling and saving on SD card

Javad
Associate III
Posted on November 26, 2015 at 09:49

hello

I need help about my new project. I want to sample from 2Mhz signal with 10Mhz sampling rate about a minutes by a 12bit parallel external ADC (AD9035). since the number of samples will be too many, I need to save them on sd card so that after 1 minutes I use them.  now I want to know how can I write my samples on SD with high speed (more that 20 M Byte/s). using DMA, is good idea?

I am pleased if you help me and suggest any algorithms.

I use STM32f407.

26 REPLIES 26
Javad
Associate III
Posted on December 20, 2015 at 18:01

I can achieve to writing speed of more than 10MBps by chang Q of the PLL to 5. in this situation I check the SDIO_CK. its about 35MHz.

I write on this SD card in my pc with speed of more than 20MBps. in addition in othe SD that is Class 4, in PC I Write on it with speed of about 10MBps but in ST board with this program, I can write on it with speed of about 5MBps. I think there is another option that I can Increase writing speed!! 

Posted on December 20, 2015 at 18:08

Ok, you initialize it in 1-bit mode and transition to 4-bit when you enable the wide bus.

Initialization should be done at 400 KHz, it goes to 24 MHz later. There is an errata preventing the use of BYPASS mode. To get beyond 24 MHz you need to change the Q-tap of the PLL which is usually at 48 MHz (ie 24 x2)

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Javad
Associate III
Posted on December 22, 2015 at 13:39

in my program, is it necessary that I use ''SD_WriteMultiBlocks'' function, each time I want to write on SD? I think this function set SDIO and DMA each time. can I write faster? is there any way that it write automatically? for example it trigger with timer and write automatic. 

DMA can trigger with TIMx but here it connect to SDIO! I'm made confused! 

Posted on December 22, 2015 at 14:20

These are things you'll need to experiment with yourself. I don't think they will materially improve the write bandwidth, which needs to exceed the rate at which you are generating data.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Javad
Associate III
Posted on December 27, 2015 at 07:01

although it's a question for me that why in pc I can write on SD with 20MBps and in my board that's about 13MBps, this speed is OK.

in addition I use DMA for reading GPIO, it has high speed too.

the problem is that both of GPIO and SD use DMA2!! any idea to solve this problem? I check TIM1 interrupt and EXTI, I couldn't read GPIO in ther interrupt routine!  

Javad
Associate III
Posted on December 27, 2015 at 07:07

I can reduce my sampling rate to 7MSps. thats why I said 13MBps is OK for SD speed writing.

Posted on December 27, 2015 at 15:10

It's pretty hard to do an apples-to-apples comparison of the bandwidth/resources of a 3 GHz PC with gigs of RAM, against a micro-controller running at l68 MHz (ie ~20x slower)

The PC is probably clocking the SDIO bus at 50 MHz, and caching/writing 128KB blocks, on buses that can provide hundreds of MBps in bandwidth.

May be there is something in the MMC/SD specs that explains what's required to sustain Class 10 streaming.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..