2025-06-10 7:40 AM
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
2025-06-20 5:02 AM
No I don't use second pipe.
2025-06-20 5:27 AM
Hello,
Could be the video is interlaced video?
How can I deinterlace the video?
Is the STM32N6's ISP supports that such application?
Best regards,
2025-06-23 7:51 AM
Yes, that is possible.
To deinterlace video, you have these options:
Using Different Virtual Channels (VC) for Odd and Even Fields on a Single Pixel Pipe with the Same Data Type:
Since a single pixel pipe can process only one VC at a time, you need to reconfigure it every frame to handle odd and even fields on different VCs by:
Using Two Pixel Pipes for Interlaced Video:
Additionally, you can use Pipe0 together with one pixel pipe if image processing is not required in your application.
For more details see part Interlaced video inthe chapter CSI2 camera sendor module
Please add more details/datasheet about the sensor configuration
2025-06-24 6:26 AM
Hello,
If I use second method (Using Two Pixel Pipes for Interlaced Video) and for example assigning even ones into a x address and even ones into the y address how can I use them to obtain single (progressive) image in our display?
Best regards,
2025-06-24 6:37 AM
To get a full frame, you need to merge these two fields line by line:
2025-06-26 12:18 AM
Hello,
Could I use HPDMA and/or GPDMA for transferring the frame buffer to deinterlace the image?
Can this application be implemented without overloading the MCU?
Best regards,
2025-06-26 9:46 AM
Yes, sure, you can use the DMA to transfer the data from the Odd/Even destinations to the new output buffer dedicated for the progressive frame instead of overloading the MCU.
For synchronization, you can use the dedicated DCMIPP - GPDMA or HPDMA triggers available for the events generated by the DCMIPP (lines, frames, VSYNC, etc.).
See HPDMA/GPDMA triggers sections in the referance Manual