Skip to main content
Javad
Associate III
November 26, 2015
Question

High speed Sampling and saving on SD card

  • November 26, 2015
  • 26 replies
  • 4201 views
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.

    This topic has been closed for replies.

    26 replies

    sanaz
    Associate II
    January 1, 2015
    Tesla DeLorean
    Guru
    November 26, 2015
    Posted on November 26, 2015 at 14:53

    I don't think the F4 has the horse power to achieve this. I definitely feel the 4-bit SDIO will not hit anywhere near 20 MBps writing.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Javad
    JavadAuthor
    Associate III
    November 26, 2015
    Posted on November 26, 2015 at 15:28

    I found SDHC with writing speed of 40 MB/s (Sony 8GB UHS-I 94MB/Sec SDHC Card).  can I write on it with 20MB/sec by DMA?  

    Tesla DeLorean
    Guru
    November 26, 2015
    Posted on November 26, 2015 at 16:39

    I would be surprised if you could.

    Yes, you'd use DMA to hit the bandwidth limit, but I think that's much lower than you think it is. The card is only one factor in the system performance.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Javad
    JavadAuthor
    Associate III
    November 27, 2015
    Posted on November 27, 2015 at 10:43

    many thanks Clive for your answer. I think I can say its result till Tuesday.

    Javad
    JavadAuthor
    Associate III
    December 9, 2015
    Posted on December 09, 2015 at 07:02

    unfortunately, I could not found microSD with that speed! but I found Compact flash. it has high speed and I can run it with FSMC.

    now I think to this algorithm: I can read pins with DMA with 10Mhz frequency that trigger with TIM1 and I writ them in CF by FSMC.

    any idea about this algorithm?

    in addition I  found FPGA. I can get samples from ADC and write them to DRAM with FPGA and then transmit them to my ST and analyse them. but in this way the cost is a little high.

     

    Tesla DeLorean
    Guru
    December 9, 2015
    Posted on December 09, 2015 at 16:47

    I think it is a bit flawed. You wouldn't be writing to the CF at 10 MHz, you are SAMPLING at 10 MHz. You need to write to the CF faster than that, as you will have command overhead as you interact with it. I'd expect you'd just use a memory-to-memory DMA over the FSMC to get the data blocks to the media as fast as possible.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Tesla DeLorean
    Guru
    December 9, 2015
    Posted on December 09, 2015 at 16:50

    Can you use the FPGA to provide the data transfer to an SDIO or CF directly, and just have the STM32 manage them?

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Javad
    JavadAuthor
    Associate III
    December 10, 2015
    Posted on December 10, 2015 at 11:18

    yes, you're right clive, I have to write faster than 10MBps on memory.

    yes I can use FPGA (OR CPLD FOR ITS LOWER COST) to write data in memory. in addition if I use fpga, I can connect it to DRAMs that have more capacity with low cost. maybe it's more better for future of my design. 

    sanaz
    Associate II
    December 14, 2015
    Posted on December 14, 2015 at 07:17

    hi

    I have almost the same problem. I need to read my 12 bit external ADC and logging them in sd card. my sampling rate is 1MS/p. I test my SD on PC. its writing speed is more than 5MB/S.

    I found some similar code written by Cvile but I don't know how I have to change them. is it possible to help me for writting its code? i bought stm32f407 board recently.