cancel
Showing results for 
Search instead for 
Did you mean: 

YCbCr Video Input STM32F746

Kishore1
Associate II

I am working on STM32F746 based custom board which is integrated with LCD and a ADV7180 video decoder IC.

I Configured the ADV7180 to run in the free run mode. Getting the Camera data using DCMI to a specified buffer.

I am trying to Convert the YCbCr 4:2:2 data to the RBG data. I am getting the Line Events. .

From the Live events I am executing the below piece of code to convert it to the RGB and then load the it to the LCD using ARGB888.

LCD_FRAME_BUFFER 0xC0000000

LCD_FRAME_BUFFER_LAYER1 0xC0130000

CAMERA_FRAME_BUFFER 0xC0260000

void LCD_LL_Test(void *pSrc, void *pDst, uint32_t lcd_offset, uint32_t cam_offset)
{ 
 
  uint32_t * pTempDest = (uint32_t *)(LCD_FRAME_BUFFER_LAYER1);
  uint32_t * pTempSource = (uint32_t *)(CAMERA_FRAME_BUFFER+cam_offset);
   
  uint32_t * pFinalDest = (uint32_t *)(LCD_FRAME_BUFFER+lcd_offset);
  uint32_t * pFinalSource = (uint32_t *)(LCD_FRAME_BUFFER_LAYER1);
 
  for(uint32_t i = 0; i < (480/2) ; i++ ){
    uint32_t te =  *pTempSource;   
    // CB Y1 CR , RESULT  
    toRGB( (te>>0),(te>>8),(te>>16) ,(uint32_t *)pTempDest);
    pTempDest++;
    // CB Y2 CR , RESULT 
    toRGB( (te>>0),(te>>24),(te>>16) ,(uint32_t *)pTempDest);
    pTempDest++;
    pTempSource++;
  }
  static DMA2D_HandleTypeDef hDma2dEval;  
 
  hDma2dEval.Init.Mode         = DMA2D_M2M_PFC;
  hDma2dEval.Init.ColorMode    = DMA2D_OUTPUT_ARGB8888;
  hDma2dEval.Init.OutputOffset = 0;     
 
  hDma2dEval.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
  hDma2dEval.LayerCfg[1].InputAlpha = 0xFF;
  hDma2dEval.LayerCfg[1].InputColorMode = DMA2D_RGB888;
  hDma2dEval.LayerCfg[1].InputOffset = 0;
 
  hDma2dEval.Instance = DMA2D; 
 
  /* DMA2D Initialization */
  if(HAL_DMA2D_Init(&hDma2dEval) == HAL_OK) 
  {
    if(HAL_DMA2D_ConfigLayer(&hDma2dEval, 1) == HAL_OK) 
    {
      if (HAL_DMA2D_Start(&hDma2dEval, (uint32_t)pFinalSource, (uint32_t )(pFinalDest), BSP_LCD_GetXSize()*4, 1) == HAL_OK)
      {
        /* Polling For DMA transfer */  
        HAL_DMA2D_PollForTransfer(&hDma2dEval, 10);
      }
    }
  } 
}

I have initialised the LCD with LCD_FRAME_BUFFER and I am using single layer only.

I am converting the data and copying it to the LCD_FRAME_BUFFER using an intermediate LCD_FRAME_BUFFER_LAYER1 buffer.

DCMI --> CAMERA_FRAME_BUFFER --> CONVERSION --> LCD_FRAME_BUFFER_LAYER1 --> DMA -> LCD_FRAME_BUFFER

But, I am not getting the free run mode screen as BLUE Screen.

0690X00000ArjOUQAZ.jpg

Can body point me where I am going wrong.

0 REPLIES 0