DCMI Camera interface – max Resolution Camera
Hello at all…
I’m developing a camera that acquires a frame when it has a trigger and stores the data in the external ram with the DMA.
The camera has a relolution 1280 x 1024 pixel (each one of 16bit) and all pins signal are compatibles with the DCMI interface on the micro STM32F207.
I begun with the DCMI example in the ST-library but it’s work with low resolution 320×240 pixel.
I configured the DMA as below:
DMA_InitTypeDef DMA_InitStructure;
/* Enable DMA2 clock */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2, ENABLE);
DMA_ClearFlag(DMA2_Stream1, DMA_FLAG_FEIF1 | DMA_FLAG_DMEIF1 | DMA_FLAG_TEIF1 | DMA_FLAG_HTIF1 | DMA_FLAG_TCIF1);
/* DMA2 Stream3 or Stream6 disable */
DMA_Cmd(DMA2_Stream1, DISABLE);
/* DMA2 Stream3 or Stream6 Config */
DMA_DeInit(DMA2_Stream1);
DMA_InitStructure. DMA_Channel = DMA_Channel_1;
DMA_InitStructure. DMA_PeripheralBaseAddr = DCMI_DR_ADDRESS;
DMA_InitStructure. DMA_Memory0BaseAddr = (uint32_t) pBufferPtr;
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_Enable;
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;
DMA_Init(DMA2_Stream1, & DMA_InitStructure);
DMA_FlowControllerConfig(DMA2_Stream1,
DMA_FlowCtrl_Peripheral);
My problem is that the max resolution that I can use is 128 x 1024 = 131072 pixel.
I suppose that the reason is the DMA counter limitations on 16 bit (65536) because each transfer on DMA is of 2 pixel (32 bit) and the max tranfer is 131072 pixel
The flow controller is configured to acquire the data controlled by the peripheral.
Could anyone suggest me any solution to increase the acquiring resolution?
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
You are using DMA in a circular fashion, you should be able to specify a smaller DMA buffer, and then copy the data to it’s final destination on the TC (Full/Half) interrupts.
Bandwidth might be an issue with 2MB+ of streaming data, but you might be able to address that with an FPGA, or a more appropriate micro.
It never ceases to amaze me that in 2011 chip designers can’t use 32-bit counters and timers on a 32-bit micro.
– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
Hi Clive thank for your reply.
I read on the RM that there is a possibility to use the double buffer in the DMA, but I don’t find any example code to understand how it works.
Do you think that it can be a solution?
Do you know where I can find example code on double buffer in the DMA?
Many thanks.