HAL_DMA_XferCpltCallback not triggered after DMA transfer complete
Post edited by ST moderator to be inline with the community rules for the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code.
Hallo,
I am trying to measure the frequency of rectangular signals. the borad I am using is stm32f411-disco
I used the timer 2 channel 1 for input capture. at every capture the timer value will be sent to memery by uing DMA. The DMA seems working, because I printed the captured value periodically. the DMA-Buffer is two, and it is working in a circular mode.
I try to do some calculation in the interruption-function: "void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma)" like this:
void HAL_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma)
{
if (hdma->Instance == DMA1_Stream5) // MCU-abhängig!
{
uint32_t first = IC_Values[0];
uint32_t second = IC_Values[1];
if (second >= first)
diff = second - first;
else
diff = (0xFFFFFFFF - first + second);
/* Timer läuft mit 1 MHz → 1 µs pro Tick */
Frequency = 1e6f / diff;
}
}
But this interruption is not triggered.
so my question is, shouldn't this function be triggered after the DMA transfer complete?
complete script please see the attachment:
