Skip to main content
Associate III
June 10, 2025
Question

STM32N6: DCMIPP

  • June 10, 2025
  • 12 replies
  • 2087 views

Hello,

I want to use the TW9992 NTSC/PAL Video Decoder for STM32N6 to transfer an NTSC camera (720x480 resolution) to the MCU via MIPI-CSI and display it on the screen. I have attached the code below.

static void MX_DCMIPP_Init(void)
{
 
 /* USER CODE BEGIN DCMIPP_Init 0 */
 
 /* USER CODE END DCMIPP_Init 0 */
 
 DCMIPP_CSI_PIPE_ConfTypeDef pCSI_PipeConfig = {0};
 DCMIPP_CSI_ConfTypeDef pCSI_Config = {0};
 DCMIPP_PipeConfTypeDef pPipeConfig = {0};
 
 /* USER CODE BEGIN DCMIPP_Init 1 */
 
 /* USER CODE END DCMIPP_Init 1 */
 hdcmipp.Instance = DCMIPP;
 if (HAL_DCMIPP_Init(&hdcmipp) != HAL_OK)
 {
 Error_Handler();
 }
 
 /** Pipe 0 Config
 */
 pCSI_PipeConfig.DataTypeMode = DCMIPP_DTMODE_DTIDA;
 pCSI_PipeConfig.DataTypeIDA = DCMIPP_DT_RGB565;
 pCSI_PipeConfig.DataTypeIDB = DCMIPP_DT_RGB565;
 if (HAL_DCMIPP_CSI_PIPE_SetConfig(&hdcmipp, DCMIPP_PIPE0, &pCSI_PipeConfig) != HAL_OK)
 {
 Error_Handler();
 }
 pCSI_Config.PHYBitrate = DCMIPP_CSI_PHY_BT_1600;
 pCSI_Config.DataLaneMapping = DCMIPP_CSI_PHYSICAL_DATA_LANES;
 pCSI_Config.NumberOfLanes = DCMIPP_CSI_ONE_DATA_LANE;
 if (HAL_DCMIPP_CSI_SetConfig(&hdcmipp, &pCSI_Config) != HAL_OK)
 {
 Error_Handler();
 }
 pPipeConfig.FrameRate = DCMIPP_FRAME_RATE_ALL;
 pPipeConfig.PixelPipePitch = 1440;
 pPipeConfig.PixelPackerFormat = DCMIPP_PIXEL_PACKER_FORMAT_RGB565_1;
 if (HAL_DCMIPP_PIPE_SetConfig(&hdcmipp, DCMIPP_PIPE0, &pPipeConfig) != HAL_OK)
 {
 Error_Handler();
 }
 HAL_DCMIPP_CSI_SetVCConfig(&hdcmipp, 0U, DCMIPP_CSI_DT_BPP16);
 /* USER CODE BEGIN DCMIPP_Init 2 */
 
 /* USER CODE END DCMIPP_Init 2 */
 
}
if (HAL_DCMIPP_CSI_PIPE_Start(&hdcmipp, DCMIPP_PIPE0, DCMIPP_VIRTUAL_CHANNEL0 ,
 AXISRAM4_ADDRESS, DCMIPP_MODE_CONTINUOUS) != HAL_OK)
 {
 Error_Handler();
 }
while(1){
 /* Start DMA2D transfer*/
 if(HAL_DMA2D_Start_IT(&hdma2d,
 (uint32_t)AXISRAM4_ADDRESS, /* camera data */
 (uint32_t)BUFFER_ADDRESS, /* LCD frame buffer address */
 FRAME_WIDTH,
 FRAME_HEIGHT) != HAL_OK)
 {
 Error_Handler();
 }
 }

Is the parameter pCSI_Config.PHYBitrate = DCMIPP_CSI_PHY_BT_1600; correct for the camera used in our application?

pPipeConfig.PixelPipePitch = 1440;

HAL_DCMIPP_CSI_SetVCConfig(&hdcmipp, 0U, DCMIPP_CSI_DT_BPP16);

When using 16-bit, does it become 720 or 1440?

Also, Pipe 1 has an ISP, but we don't need to use it (the camera has its own ISP). Therefore, we chose Pipe 0 so what would you recommend about it?

Best regards,

Egemen Aksoy

12 replies

Associate III
August 30, 2025

Hello~

May I ask a question which camera model was used and whether the MCU is a DK development board or something else?

This is because I have encountered a similar issue in my own project: I used the VD55G1, but couldn’t receive images after enabling stream transmission via I2C control. Therefore, I hope to explore some possible solutions.

Visitor II
March 25, 2026

Hi Clyasenth,

I know this topic is old but did you finally succeed to correctly display the camera image on the screen? I'm currently working on the same hardware configuration i.e. TW9992 NTSC + STM32N657 and facing the same problem. In fact, I have a bigger problem than just the deinterlace as I'm unable to get the right color decoding in both RGB565 and YUV422. I was wondering if you could share how you configured the TW9992 registers values and order of initialization. On the N6 side, did you only used CubeMX to configure the CSI and DCIMPP or you added extra HAL function calls? I'm also looking for the right frequency clock for the DCMIPP.  So any informations you could give would be really appreciated... or maybe tell me you gave-up to use the TW9992.

Best regards,

Sylvain Brousseau