cancel
Showing results for 
Search instead for 
Did you mean: 

DCMI, SDIO and DMA2 confusion

ch2
Associate II
Posted on February 11, 2014 at 12:05

Hi I am working with stm32f4 DCMI and SDIO interface. Both peripherals are connected to DMA2. I need to store data taken (from DCMI) by DMA2  to SDIO. I have set the following configurations. 

DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(DCMI_BASE + DCMI->DR);  // Source Address 1st location

DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t) (SDIO->FIFO); // Destination address 1st location

DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToMemory; // DCMI FIFO (4 words) to SDIO FIFO (32 words)

DCMI DMA is configured in ping pong mode. DCMI FIFO is only 4 words deep where as SDIO FIFO is 32 words deep. I also want to configure SDIO Fifo in ping pong mode. 

This has created confusion for me and after a lot of browsing I am still confused. Does any body have an idea how I achieve this? i.e. Data from DCMI to SDIO using DMA2. Thanks

Baber

#sdio #stm32f4 #dcmi-dma-camera
6 REPLIES 6
francescatodiego
Associate II
Posted on February 11, 2014 at 12:27

ST manual par. 10.3.1 General Description

 

It can carry out the following transactions:

 

• peripheral-to-memory

 

• memory-to-peripheral

 

• memory-to-memory

I think you can't move data from peripheral to peripheral using DMA

But wait also replies from experts

Posted on February 11, 2014 at 14:02

Does any body have an idea how I achieve this?

It's an interesting experiment, but I suspect doomed to fail.

I think you'd want to go through a RAM based buffer, permitting the SDIO to throttle it's requests, as you're almost certainly not going to have the rates align cleanly. Is the take up rate of your SD card in write mode going to  be adequate?

Also you need to understand what an address is, because the values you're passing to the DMA controller are incorrect.

DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)(&DCMI->DR);

DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t) (&SDIO->FIFO);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ch2
Associate II
Posted on February 11, 2014 at 15:34

Thanks guys for guidance; this is what i have thaught but i just wanted to be sure. Mr.Clive how do I achieve this? DCMI to RAM buffer using DMA2 and then from RAM to SDIO agiain using DMA2. 

ch2
Associate II
Posted on February 11, 2014 at 15:36

Thanks guys for guidance; this is what i have thaught but i just wanted to be sure. Mr.Clive how do I achieve this? DCMI to RAM buffer using DMA2 and then from RAM to SDIO again using DMA2. Keeping clock rate high. Am i thinking in correct way!

Posted on February 11, 2014 at 16:54

Well the SDIO side of it, you're almost certainly want to use an SDIO driver, with a file system implementation like FatFs stuck on top. I've posted examples of this before, both as a SDIO+FATFS implementation, and as an ADC to SDIO+FATFS.

I haven't worked with the camera interface, but you'd set you DCMI DMA transfers to occur to memory buffers, and then transfer that data in 8K or 32K chunks to the file system side, which would handle all the SDIO/DMA itself.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ch2
Associate II
Posted on February 12, 2014 at 05:26

Thanks Mr. Clive. Any links to ''

ADC to SDIO+FATFS

'' example.