cancel
Showing results for 
Search instead for 
Did you mean: 

Who's got success with DCMI ?

stm322399
Senior
Posted on April 28, 2014 at 15:36

Hi there,

I am struggling capturing WXGA(1280x1024) images with STMF429 and ov2640 (from STM324x9I-EVAL1 board).

SDRAM bandwidth looks just enough to cope with DCMI data and I often catch DMA FIFO errors (shall they be considered fatal, or is this possible to recover ?).

In the case I simply missed an essential parameter, I give hereafter my DMA configuration, but I am very interested in your experiences with DCMI (successes or fails).

DMA_DeInit(DMA2_Stream1);

DMA_StructInit(&dma_init);

dma_init.DMA_Channel = DMA_Channel_1;

dma_init.DMA_PeripheralBaseAddr = DCMI_BASE + 0x28;

dma_init.DMA_Memory0BaseAddr = 0xc0000000;

dma_init.DMA_BufferSize = DMA_STRIDE/4;

dma_init.DMA_DIR = DMA_DIR_PeripheralToMemory;

dma_init.DMA_PeripheralInc = DMA_PeripheralInc_Disable;

dma_init.DMA_MemoryInc = DMA_MemoryInc_Enable;

dma_init.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;

dma_init.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;

dma_init.DMA_Mode = DMA_Mode_Normal;

dma_init.DMA_Priority = DMA_Priority_High;

dma_init.DMA_FIFOMode = DMA_FIFOMode_Enable;

dma_init.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;

dma_init.DMA_MemoryBurst = DMA_MemoryBurst_Single;

dma_init.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;

DMA_DoubleBufferModeCmd(DMA2_Stream1, ENABLE);

DMA_DoubleBufferModeConfig(DMA2_Stream1, 0xc0000000+DMA_STRIDE, DMA_Memory_0);

DMA_Init(DMA2_Stream1, &dma_init);

DMA_ITConfig(DMA2_Stream1, DMA_IT_TC|DMA_IT_TE|DMA_IT_FE, ENABLE);

Note that due to the limitation of DMA transfer counter, I splitted my 2*1280*1024 bytes images into 64 pieces, each 2*1280*16 bytes.

Thanks.

1 REPLY 1
stm322399
Senior
Posted on May 05, 2014 at 09:32

If anyone is interested in, here are my final thoughts. I finally found a solution to get images reliably. The hardware as the following limitation:

When DMA2 transfer DCMI data to SDRAM, the DMA2 AHB master port competes with CPU AHB port and SDRAM controller (for data refresh). If the DMA2 transfer is delayed too much, the internal DMA2 FIFO become full and a the next ready data from DCMI, a FIFO error happen.

IMHO, the DMA2 FIFO is too small (only 16B) to cope with SDRAM latency, which is a pity because SDRAM is a natural target for DCMI data, given the size of pictures.

Note that when the CPU does not access SDRAM for code or data, the DMA2 FIFO is just enough and pictures are correctly grabbed every time. Unfortunately, one may alos need network or USB stack, other larges buffer, and eventually decide to use SDRAM, which drops the reliability of image capture. sadly.