Problems with DCMI DMA callback registration. Environment: MCU: STM32MP157/M4; SW: STM32Cube FW_MP1 V1.6.0; Engineering Boot Mode
Hi all!
Environment:
I use MX to configure the DCMI Peripheral including DMA!
MX generates MX_DMA_Init() and MX_DCMI_Init()
After DCMI initialization in main with the above mentioned functions I use the functions
HAL_DMA_RegisterCallback(&hdma_dcmi, HAL_DMA_XFER_CPLT_CB_ID, &DcmiDmaFullCplt) and HAL_DMA_RegisterCallback(&hdma_dcmi, HAL_DMA_XFER_HALFCPLT_CB_ID, &DcmiDmaHalfCplt) to register Halffull and Full DMA Callbacks.
Both callbacks are registered in the hdma_dcmi structure. Everthing ok so far.
Problem:
But when I execute
HAL_DCMI_Start_DMA(&hdcmi, DCMI_MODE_CONTINUOUS, (uint32_t) ae_dma_buffer, AE_DMA_BUFFER_SIZE); to start the peripheral, the function overwrites the dma full function pointer. Therefore the HAL callback is used and not my dma full callback function (half full works fine). Otherwise if I try to register the callbacks after calling HAL_DCMI_Start_DMA(), the registration is refused because the hdma-->state is different to HAL_DMA_STATE_READY.
So how sould I register the callbacks correctly now?
I wrote a work around to register the callback ("brutally" by hand) just after calling HAL_DCMI_Start_DMA() with the following instruction:
hdma_dcmi.XferCpltCallback = &DcmiDmaFullCplt;
This works fine but I think it doesn't fit smartly into the HAL concept!
So how shall I register full dma callbacks according to the HAL concept?
Thanks in advance.
Regards
Manfred
