cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F407, DCMI_DMA,USART_DMA

Nagesh K
Associate II
Posted on February 24, 2017 at 08:19

I am transferring 240x320 image in RGB565 format to USART.

But unable to get full image because USART speed is not matching with DCMI

Pixel Clock for DCMI_DMA:12MHz

USART speed:921600

I am using DCM_DMA in snapshot,circular mode & USART_DMA in normal mode

in main,

HAL_DCMI_Start_DMA(&hdcmi,(uint32_t)DCMI_MODE_SNAPSHOT ,(uint32_t)image,9600);

In IRQ, (void DMA2_Stream1_IRQHandler(void))

HAL_UART_Transmit_DMA(&huart2,ptr,38400);

I am attaching my output image,

How should I solve this problem??

#usart #dcmi #camera #stm32
1 REPLY 1
S.Ma
Principal
Posted on February 25, 2017 at 09:55

If there is a refresh rate on the camera, maybe use a double buffer scheme with a flag to validate the copy from DCMI buffer to the SRAM RS232 buffer. The transfer from DCMI Frame memory to USART Frame memory is done, a bit is set and the USART interrupt transfer is enabled. Once the USART interrupt transfer is complete, clear the bit and stop the USART transfer interrupt. This probably will cause subsampling and lower refresh rate, however it should work for any RS232 speed even slow ones.

Once working, some tricks to reduce SRAM could be implemented using double buffering scheme of the DMA.