cancel
Showing results for 
Search instead for 
Did you mean: 

OV5640 over DCMI odd artifcacting at 720p with Jpeg compression

fihes47572
Associate

I'm running into a pixel mismatch issue when trying to capture frames over DCMI from a [B-CAMS_OMV with an OV5640 sensor board attached. I've used CubeMX and the stm32-disco F746 development board to successfully collect RGB565 and JPEG image compression data in various formats and resolutions.

Below is my CubeMX generated DCMI configuration:

hdcmi.Instance = DCMI;
hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_HIGH;
hdcmi.Init.CaptureRate = DCMI_CR_ALTERNATE_4_FRAME;
hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_8B;
hdcmi.Init.JPEGMode = DCMI_JPEG_ENABLE;
hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL;
hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD;
hdcmi.Init.LineSelectMode = DCMI_LSM_ALL;
hdcmi.Init.LineSelectStart = DCMI_OELS_ODD;

 

The OV5640 board is attached to an ST module, and I've written a driver heavily influenced by the [VISION-AI](https://www.st.com/en/embedded-software/fp-ai-vision1.html)  example typically used with the H7 discovery board.

Using a FreeRTOS task to start the frame capture in snapshot mode, the frame is DMAed (highest priority)  to external SDRAM. Once the HAL_DCMI_FrameEventCallback is triggered, the data can be analyzed.

I can successfully capture images in RGB565 at 640x480, and JPEG compression by the sensor at 640x480, 800x480, and almost 1200x720. However, I'm seeing some odd but consistent pixelation/artifacting, and I can't figure out the cause (see horizontal stripe pixalition in picture below). This always appears in a similar spot toward the left side of the frame.

I have tried multiple cameras and multiple DCMI ribbon cables, including very short ones (under 4 inches). Since the image is clear, the camera register values seem to be correct. The frame size is often less than uncompressed 640x480 RGB 565, so It doesn't seem to be an issue with frame size, or dmaing that amount of data.
Access to data in the external sdRam is mutex protected and only DCMI is ever  writing to that memory.

Any help or guidance would be appreciated.



3 REPLIES 3
KDJEM.1
ST Employee

Hello @fihes47572 and welcome to the Community :),

Could you please try to improve the DCMI frame rate, may this article "How to improve DCMI frame rate: An example using a ov5640 camera modulecan help you.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

LeHaiAnh
Associate II

Hello @KDJEM.1 , im working with the same projetcs and hardware like @fihes47572 , im wondering how to set up the resolution and color mode to 480*272 and RGB888 on LTDC. Thank you very much!

KDJEM.1
ST Employee

Hello @LeHaiAnh and welcome to STCommunity :),

 

You can used the STM32CubeMx tool chain to configure the LTDC.

For that I recommend you to take a look at AN4861 application note and precisely 7.2.4 LTDC peripheral configuration section. This section provides an LTDC example configuration with STM32CubeMx. You can refer to this example and get inspired to configure the LTDC. 

I hope this help you!

Thank you.

Kaouthar

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.