AnsweredAssumed Answered

DCMI with DMA in Double Buffer Mode

Question asked by hoevener.jan on Oct 30, 2016
Latest reply on Nov 2, 2016 by hoevener.jan
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

Outcomes