2025-02-21 12:24 AM
I am currently integrating the AR0144 sensor with STM32 using the DCMI interface with DMA for image capture. The image data is being received, but the issue is that the data is incomplete, and zeros are padded at the end of the buffer.
Hardware and Setup:
Current DCMI and DMA Configuration:
Here are the DCMI and DMA configurations I am using:
DCMI Configuration:
CopyEdit
hdcmi.Instance = DCMI;
hdcmi.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE;
hdcmi.Init.PCKPolarity = DCMI_PCKPOLARITY_RISING;
hdcmi.Init.VSPolarity = DCMI_VSPOLARITY_HIGH;
hdcmi.Init.HSPolarity = DCMI_HSPOLARITY_LOW;
hdcmi.Init.CaptureRate = DCMI_CR_ALL_FRAME;
hdcmi.Init.ExtendedDataMode = DCMI_EXTEND_DATA_12B;
hdcmi.Init.JPEGMode = DCMI_JPEG_DISABLE;
hdcmi.Init.ByteSelectMode = DCMI_BSM_ALL;
hdcmi.Init.ByteSelectStart = DCMI_OEBS_ODD;
hdcmi.Init.LineSelectMode = DCMI_LSM_ALL;
hdcmi.Init.LineSelectStart = DCMI_OELS_ODD;
if (HAL_DCMI_Init(&hdcmi) != HAL_OK)
{
Error_Handler();
}
DMA Configuration:
c
CopyEdit
hdma_dcmi.Instance = DMA2_Channel5;
hdma_dcmi.Init.Request = DMA_REQUEST_4;
hdma_dcmi.Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_dcmi.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_dcmi.Init.MemInc = DMA_MINC_ENABLE;
hdma_dcmi.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
hdma_dcmi.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_dcmi.Init.Mode = DMA_NORMAL;
hdma_dcmi.Init.Priority = DMA_PRIORITY_HIGH;
if (HAL_DMA_Init(&hdma_dcmi) != HAL_OK)
{
Error_Handler();
}
__HAL_LINKDMA(&hdcmi, DMA_Handle, hdma_dcmi);
Observations:
Any suggestions on modifying the DMA or DCMI settings to get a complete image buffer?
Any insights or suggestions would be greatly appreciated. Thank you in advance!