2019-11-08 08:55 AM
Hello,
I'm having problems in getting the HAL_DCMI_FrameEventCallback called from the HAL layer.
I'm using the DCMI in snapshot mode and from what I understood reading the dcmi hal driver code, the frame interrupt for snapshot mode is enabled when the DCMI_IT_FRAME is disabled. This looks weird but this is what the next code (line 1305 to 1334 of stm32l4xx_hal_dcmi.c) seems to do. I suppose there is a reason for this.
/* if End of frame IT is disabled */
if((hdcmi->Instance->IER & DCMI_IT_FRAME) == 0x0U)
{
/* If End of Frame flag is set */
if(__HAL_DCMI_GET_FLAG(hdcmi, (uint32_t)DCMI_FLAG_FRAMERI) != 0x0UL)
{
/* Clear the End of Frame flag */
__HAL_DCMI_CLEAR_FLAG(hdcmi, DCMI_FLAG_FRAMERI);
/* When snapshot mode, disable Vsync, Error and Overrun interrupts */
if((hdcmi->Instance->CR & DCMI_CR_CM) == DCMI_MODE_SNAPSHOT)
{
/* Disable the Vsync, Error and Overrun interrupts */
__HAL_DCMI_DISABLE_IT(hdcmi, DCMI_IT_LINE | DCMI_IT_VSYNC | DCMI_IT_ERR | DCMI_IT_OVR);
hdcmi->State = HAL_DCMI_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hdcmi);
}
/* Frame Event Callback */
#if (USE_HAL_DCMI_REGISTER_CALLBACKS == 1)
/*Call registered DCMI frame event callback*/
hdcmi->FrameEventCallback(hdcmi);
#else
HAL_DCMI_FrameEventCallback(hdcmi);
#endif /* USE_HAL_DCMI_REGISTER_CALLBACKS */
}
}
However, the HAL_DCMI_FrameEventCallback never gets called from that code regardless the status of DCMI_IT_FRAME. Moreover, if I run the code in debug mode and I place a breakpoint and then I go on step-by-step, the execution goes to HAL_DCMI_FrameEventCallback which is called as expected.
So, how I get HAL_DCMI_FrameEventCallback called in snapshot mode?
Thank you,
Davide.
PS: The image is small (less than 65535 words)
2022-04-06 03:15 PM
Did you ever figure this out? I ran into the same issue. I'm wondering if it's some issue specific to certain cameras where ST's HAL doesn't properly detect the end-of-frame.