cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 DCMI snapshot HAL issues?

YLi.3
Associate

Recently I am interfacing a image sensor with the DCMI interface on my STM32H743VIT6. I am using the STM32H7 HAL library 1.7.0, generated with STM32CubeMX 5.6.0, compiling using ARM GCC 9.2.1. I have encountered some issue with using the DCMI driver in the HAL library.

My application requires to take a image of 640x484 pixels (each pixel of uint8_t) with DCMI connected to a image sensor while it is constantly streaming video. To do so, I used the function call below:

HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_SNAPSHOT, (uint32_t)pixdata, 77440);

While the image is being received, my application is supposed to do processing for each line collected on the fly. As such, I implemented a counter in the override HAL callback function:

void HAL_DCMI_LineEventCallback (DCMI_HandleTypeDef *_hdcmi) {
  rowCounter++;
}

Now the issue is, after reset, only during the first frame the HAL_DCMI_LineEventCallback will be invoked. I have debugged my code and inspected the HAL implementation. It is found that:

  • All the DCMI interrupts are enabled during initialisation (stm32h7xx_hal_dcmi.c:252, in HAL 1.7.0, same below);
  • The HAL_DCMI_Start_DMA function does not tweak the interrupt settings;
  • The interrupt handler disables all interrupts upon frame interrupt under snapshot mode (line 665);
  • The HAL_DCMI_Stop function does not tweak the interrupt settings.

I am wondering wouldn't it be more appropriate for the HAL_DCMI_Start_DMA function to enable interrupt instead of in its initialisation, or if I am using HAL the wrong way?

P.s. Currently I am calling HAL_DCMI_Stop inside HAL_DCMI_FrameEventCallback, as the underlying DMA stream does not terminate automatically upon completion. This way works so far, but it appears to be a bit awkward for me, not sure if this is the intended way.

0 REPLIES 0