cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with AR0144 Sensor Integration Using DCMI-DMA on STM32

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:

  • MCU: STM32L4A6VGY6PTR
  • Image Sensor: AR0144CS (AR0144CSSC00SUKA0-CPBR)
  • Interface: DCMI with DMA
  • Software: STM32 HAL with FreeRTOS

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:

  1. The image buffer receives data, but some frames are incomplete.
  2. Zeros are padded at the end of the buffer and then few consecutives frames are 0 and then whole process is repeated.
  3. The HAL_DCMI_FrameEventCallback is triggered, but not always as expected.
  4. The issue persists even after trying different buffer sizes and memory alignment configurations.

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!

 

0 REPLIES 0