cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected timers beahavior with DMA

MCarp
Associate

Hello everyone,

I'm having really hard times using timers in my project. I am using STM32F401RE with CubeMX and AC6 as workbench. Let's go in order: i have some ADC conversions to perform that are triggered by timer firing, then the converted values are transferred in a buffer with DMA. I also need 3 other timers to generate interrupts at different timing intervals, in my case 20Hz, 1Hz and 1/60Hz. I noticed some, at least for my knowledge, very strange issues, that are:

  • CubeMX code puts MX_ADC1_Init() before MX_DMA_Init(). By doing so in debugging mode I verify that HAL_ADC_ConvCpltCallback is called only once, which supposedly means that the timer commanding ADC conversion, TIM3 in my case, fires only once or that other problems arise. My other three timers, TIM11, TIM10, TIM9 behave correctly and generate interrupts with no problems.
  • If I put MX_DMA_Init() before MX_ADC1_Init() ADC conversion is performed regularly, as I was expecting, because HAL_ADC_ConvCpltCallback is called repeatedly. Misteriously one of the three timers, TIM10 doesn't fire any interrupt anymore .

So my doubt is that MX_DMA_Init() creates some problems in my code but I cannot realize what, where and why.

I'm attaching some code, well note that in my project there are many other source files, If you think that some of them may cause this failure I wil post it.

0 REPLIES 0