cancel
Showing results for 
Search instead for 
Did you mean: 

How to get and store image from camera to sd card.

sonhai26988
Associate II
Posted on June 15, 2012 at 05:05

Hi everyone.

Now I'm playing with DCMI module, with stm32220g-eval board.

The demo code of ST using DMA to get data and send direct to LCD.

I want to get data of 1 frame, and store to sd card.

But I'm not clear about DMA process, in demo code, the configuration is:

  DMA_InitStructure.DMA_Channel = DMA_Channel_1;  

  DMA_InitStructure.DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS;

  DMA_InitStructure.DMA_Memory0BaseAddr = FSMC_LCD_ADDRESS;

  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;

  DMA_InitStructure.DMA_BufferSize = 1;

  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;

  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;

  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;

  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;

  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;

  DMA_InitStructure.DMA_Priority = DMA_Priority_High;

  DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;

  DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;

  DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;

  DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;

Why buffersize=1? How many byte of 1 frame?

Do you have any idea?

Thanks and best regards. 

#dcmi #camera #stm3220g-eval #image
5 REPLIES 5
alok472
Associate II
Posted on June 15, 2012 at 05:46

Take the image to RAM instead of LCD (FSMC_LCD_ADDRESS) and then save to uSD card. If you want this image to be read by USB then you need file system to store the image.

Posted on June 15, 2012 at 19:57

''If you want this image to be read by USB then you need file system to store the image''

No, that's not true.

There are various ways to transfer data over USB - not all of them require a file system.
sonhai26988
Associate II
Posted on June 18, 2012 at 04:49

Thanks akolm and neil.andrew for your reply.

But I want to ask how to copy this data to RAM, and store in SD card?

The sample code just send data from DCMI address to LCD_FSMC_address?

I want to know how to catch frame data? I don't know exact how many bytes come?

http://blog.frankvh.com/2011/08/19/stm32f2xx-digital-camera-interface-dcmi/

Thanks and best regards.

amin23
Associate II
Posted on June 18, 2012 at 08:43

Hello,

See the previous threads [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Some more DCMI problems F207IG&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=365]here & [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/DCMI Issues, looking for insight&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx?Paged%3DTRUE%26p_StickyPost%3D%26p_DiscussionLastUpdated%3D20111212%252010%253a46%253a14%26p_ID%3D19852%26View%3D%257bF47A9ED8%252dE726%252d42BE%252dACED%252d732F13B66581%257d%26FolderCTID%3D0x012001%26PageFirstRow%3D121&currentviews=590]here.

alok472
Associate II
Posted on June 18, 2012 at 15:29

you need to go through the DMA rountine. The short suggestion is to change following line

DMA_InitStructure.DMA_Memory0BaseAddr = FSMC_LCD_ADDRESS;

and instead of FSMC_LCD_ADDRESS, put your RAM destination address