Skip to main content
NS.9
Associate II
June 14, 2022
Question

10bit Camera interface with STM32F7508-DK

  • June 14, 2022
  • 8 replies
  • 3140 views

Hello,

We are working on interface of OV6946 camera with STM32F7508 development kit. We need to capture image and stream on STM32F7508 Display. Camera which we are using provides 10bit output with 400x400 resolution in Bayer’s format.

The connections are done as mentioned below:

Camera Pin Controller Pins

DCMI_D0            -             PH9

DCMI_D1            -             PH10

DCMI_D2            -             PH11

DCMI_D3            -             PH12

DCMI_D4            -             PH14

DCMI_D5            -             PD3

DCMI_D6            -             PE5

DCMI_D7            -             PE6

DCMI_D8            -             PI1

DCMI_D9            -             PI2

DCMI_PIXCLK   -             PA6

DCMI_HSYNC   -             PA4

DCMI_VSYNC   -             PG9

DCMI_SDA         -             PB9

DCMI_SCL          -             PB8

We are using example code from STM32 Cube example project named “Camera�?.

We are getting black and white scrolling image for the configuration given below

static void LCD_LL_ConvertLineToARGB8888(void *pSrc, void *pDst)
{ 
 /* Enable DMA2D clock */
 __HAL_RCC_DMA2D_CLK_ENABLE();
 
 /* Configure the DMA2D Mode, Color Mode and output offset */
 hdma2d_eval.Init.Mode = DMA2D_M2M_PFC;
 hdma2d_eval.Init.ColorMode = DMA2D_OUTPUT_ARGB8888;
 hdma2d_eval.Init.OutputOffset = 0;
 
 /* Foreground Configuration */
 hdma2d_eval.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
 hdma2d_eval.LayerCfg[1].InputAlpha = 0x00;
 hdma2d_eval.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB888;
 hdma2d_eval.LayerCfg[1].InputOffset = 0;
 
 hdma2d_eval.Instance = DMA2D;
 
 /* DMA2D Initialization */
 if(HAL_DMA2D_Init(&hdma2d_eval) == HAL_OK)
 {
 if(HAL_DMA2D_ConfigLayer(&hdma2d_eval, 1) == HAL_OK)
 {
 if (HAL_DMA2D_Start(&hdma2d_eval, (uint32_t)pSrc, (uint32_t)pDst, 200, 1) == HAL_OK)
 {
 /* Polling For DMA transfer */
 HAL_DMA2D_PollForTransfer(&hdma2d_eval, 100);
 }
 }
 }
 else
 {
 /* FatFs Initialization Error */
 while(1);
 }
}

Please refer the link below for output reference:

https://drive.google.com/file/d/1ATyK06csLdJNzLO_H6x2dtP0buMR2cGr/view?usp=sharing

Please guide us, what are the built in configurations are need to be used for converting 10bit Bayer image input to RGB LCD output.

Thanks & Regards,

Ayaz Ahmed,

Riosh Technologies,

Bangalore.

This topic has been closed for replies.

8 replies

KDJEM.1
ST Technical Moderator
June 14, 2022

Hi @NS.9​ ,

The “Application note Digital camera interface (DCMI) for STM32 MCUs�? (AN5020), mentioned an example with RGB data capture.

I advise you to refer to this application note to resolve the problem.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
NS.9
NS.9Author
Associate II
June 14, 2022

The camera output is in raw Bayer format like below

0693W00000NrqIKQAZ.pngHow do we convert this to RGB format. We had referred the same document, can you please point out in the document where we can refer RAW data to RGB conversion.

NS.9
NS.9Author
Associate II
June 27, 2022

From the example code 'CAMERA' for STM32F7508-DK.

main.c/ "static void LCD_LL_ConvertLineToARGB8888(void *pSrc, void *pDst)" function we have configured DMA2D_Input_Color_Mode macro to DMA2D_INPUT_RGB888 and we are getting color image but the colors are not identical, in the place of yellow color we ara getting blue color and in the place of blue we are getting yellow color. This may be because of Bayer's color format. We tried all the macros mentioned below under DMA2D_Input_Color_Mode.

DMA2D_INPUT_ARGB8888    0x00000000U 

DMA2D_INPUT_RGB888      0x00000001U 

DMA2D_INPUT_RGB565      0x00000002U

DMA2D_INPUT_ARGB1555    0x00000003U

DMA2D_INPUT_ARGB4444    0x00000004U 

DMA2D_INPUT_L8        0x00000005U 

DMA2D_INPUT_AL44       0x00000006U 

DMA2D_INPUT_AL88       0x00000007U 

DMA2D_INPUT_L4        0x00000008U 

DMA2D_INPUT_A8        0x00000009U 

DMA2D_INPUT_A4        0x0000000AU 

Can you please share the configuration for Bayer format.

Andrew Neil
Super User
July 5, 2022
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
NS.9
NS.9Author
Associate II
June 16, 2022

We have successfully able to print color image on the display. But the Video streaming is scrolling vertically slowly.

Can you please share your view on this, what might be the cause for scrolling.

KDJEM.1
ST Technical Moderator
June 16, 2022

Hi @NS.9​ ,

Glad to know that initial issue is already fixed.

Regarding the new issue: could you please share the code that can help to reproduce it so that I can investigate on my side?

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
NS.9
NS.9Author
Associate II
June 22, 2022

.

NS.9
NS.9Author
Associate II
June 22, 2022

.

KDJEM.1
ST Technical Moderator
July 20, 2022

Hi @NS.9​ ,

When you refer to the RM0385 section 9.3.4 Table 35, you can conclude that the DMA2D can't support the Raw Bayer format input. So, you can't do the conversion from Raw Bayer format to RGB format.

Kaouthar

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.
Andrew Neil
Super User
July 20, 2022

@KDJEM.1​ "So, you can't do the conversion from Raw Bayer format to RGB format"

Or, rather, you'll have to do it in software.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.