cancel
Showing results for 
Search instead for 
Did you mean: 

DCMI with DMA in Double Buffer Mode

43102399
Associate II
Posted on October 30, 2016 at 23:19

Hello everybody,

I've got a NTSC camera with decoder which delivers me 480x272 image data in 4:2:2 YCbCr format. NTSC has the characteristic to transmit every second line. First the odd frame 1, 3, 5, ..., 271 (480x136). Then the even frame 2, 4, 6, ..., 272 (480x136). I receive everything and in single buffer mode it's working fine. I have to work on the frame to extract the luminance channel (later on calculate RGB) and it begins flickering a little bit when I use both frames. With only one it's working fine. So I want use DMA in double buffer mode that I can work on one frame during the other is coming in. That odd and even frames are stored in different buffers.

My hardware is the STM32F746 Discovery board. For single buffer mode I use the function

HAL_DCMI_Start_DMA(&hDcmiHandler, DCMI_MODE_CONTINUOUS, CAMERA_BUFFER, 0x7F80);

inside this function it calls the

HAL_DMA_Start_IT(hdcmi->DMA_Handle, (uint32_t)&hdcmi->Instance->DR, (uint32_t)pData, Length);

for double buffer mode I changed it to

HAL_DMAEx_MultiBufferStart_IT(hdcmi->DMA_Handle, (uint32_t)&hdcmi->Instance->DR, (uint32_t)pData, (uint32_t)0xC0020000, Length);

where I added the second memory address to store the even frames.

Through debugging I saw that I get DMA FIFO Error with the first transfer complete interrupt and a Transfer Error with the following transfer complete interrupt. Then DMA is disabled by the error handler. On my display I can see that I receive one image. Do I have to do anything in the error callback?

Does anybody see what I am doing wrong? Or what I can do better. I don't have an idea.

Greets Jan

#dma #dma #dcmi #double-buffer #circular-mode
2 REPLIES 2
slimen
Senior
Posted on October 31, 2016 at 18:10

Hello,

Have a look to the working examples under

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef7.html

 :

STM32Cube_FW_F7_V1.5.1\Projects\STM32756G_EVAL\Examples\DCMI

You can get inspired from the available example which can help you on your application.

You can refer to this

http://www.st.com/content/ccc/resource/training/technical/product_training/group0/90/5a/91/24/1a/14/4b/40/STM32F7_Peripheral_DCMI/files/STM32F7_Peripheral_DCMI.pdf/jcr:content/translations/en.STM32F7_Peripheral_DCMI.pdf

about STM32F7 DCMI.

For DCMI with DMA in Double Buffer Mode,  you can refer to the DMA section in the STM32F7 reference manual.

I hope that this brings some help to you.

Regards
43102399
Associate II
Posted on November 02, 2016 at 13:55

Hello, I red the manuals before. They don't help a lot. Also I tried to set up the DMA for double buffering mode manually. It works until I enable one of the interrupts. For example the transfer complete interrupt. But the interrupt is necessary that the memory buffer addresses (M0AR, M1AR) are swapped or not? Or does it happen anywhere else? Because the image I get looks more or less good.

But with interrupt I still have the FIFO Error and Transfer Error. Does anybody had the same issues? :(