0

我正在开发基于 STM32F746 的定制板,该板与 LCD 和 ADV7180 视频解码器 IC 集成。

我将 ADV7180 配置为在自由运行模式下运行。使用 DCMI 获取相机数据到指定的缓冲区。

我正在尝试将 YCbCr 4:2:2 数据转换为 RBG 数据。我正在获取线路事件。. 从实时事件中,我正在执行以下代码将其转换为 RGB,然后使用 ARGB888 将其加载到 LCD。

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);
      }
    }
  } 
}

我已经用 LCD_FRAME_BUFFER 初始化了 LCD,并且我只使用单层。

我正在转换数据并使用中间 LCD_FRAME_BUFFER_LAYER1 缓冲区将其复制到 LCD_FRAME_BUFFER。

DCMI --> CAMERA_FRAME_BUFFER --> 转换 --> LCD_FRAME_BUFFER_LAYER1 --> DMA -> LCD_FRAME_BUFFER

但是,我没有将自由运行模式屏幕作为蓝屏。

在此处输入图像描述

4

1 回答 1

0

当您使用 0xC0000000 配置为外部 RAM 时,请确保 FMC 已配置并初始化为自刷新。

确保 FMC 配置为 FMC_SDRAM_CAS_LATENCY_3

尝试在 FMC init 末尾添加附加功能

void MX_SDRAM_InitEx(void)
{
  __IO uint32_t tmpmrd = 0;

  /* Step 1: Configure a clock configuration enable command */
  Command.CommandMode            = FMC_SDRAM_CMD_CLK_ENABLE;
  Command.CommandTarget          =  FMC_SDRAM_CMD_TARGET_BANK1;
  Command.AutoRefreshNumber      = 1;
  Command.ModeRegisterDefinition = 0;

  /* Send the command */
  HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);

  /* Step 2: Insert 100 us minimum delay */
  /* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
  HAL_Delay(1);

  /* Step 3: Configure a PALL (precharge all) command */
  Command.CommandMode            = FMC_SDRAM_CMD_PALL;
  Command.CommandTarget          = FMC_SDRAM_CMD_TARGET_BANK1;
  Command.AutoRefreshNumber      = 1;
  Command.ModeRegisterDefinition = 0;

  /* Send the command */
  HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);

  /* Step 4: Configure an Auto Refresh command */
  Command.CommandMode            = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
  Command.CommandTarget          = FMC_SDRAM_CMD_TARGET_BANK1;
  Command.AutoRefreshNumber      = 8;
  Command.ModeRegisterDefinition = 0;

  /* Send the command */
  HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);

  /* Step 5: Program the external memory mode register */
  tmpmrd = (uint32_t)SDRAM_MODEREG_BURST_LENGTH_1          |\
                     SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL   |\
                     SDRAM_MODEREG_CAS_LATENCY_3           |\
                     SDRAM_MODEREG_OPERATING_MODE_STANDARD |\
                     SDRAM_MODEREG_WRITEBURST_MODE_SINGLE;

  Command.CommandMode            = FMC_SDRAM_CMD_LOAD_MODE;
  Command.CommandTarget          = FMC_SDRAM_CMD_TARGET_BANK1;
  Command.AutoRefreshNumber      = 1;
  Command.ModeRegisterDefinition = tmpmrd;

  /* Send the command */
  HAL_SDRAM_SendCommand(&hsdram1, &Command, SDRAM_TIMEOUT);

  /* Step 6: Set the refresh rate counter */
  /* Set the device refresh rate */
  HAL_SDRAM_ProgramRefreshRate(&hsdram1, REFRESH_COUNT);
}
于 2020-05-11T07:31:15.543 回答