AnsweredAssumed Answered

Timer interrupt issue with CubeMX generated code, NucleoF722ZE board

Question asked by Brian Dang on Oct 13, 2017
Latest reply on Oct 14, 2017 by Vangelis Fortounas

NucleoF722ZE board, Stm32CubeMX ver 4.22.1, Eclipse Version: Neon.3 Release (4.6.3)


I wanted to setup TIM6 as timer interrupt for 400usec sampling loop. In CubeMX : TIM6 clocked at 1Mhz and ARR = 400,

TIM6 Configuration/NVIC settings/Enabled (TIM6 global interrupt), then in NVIC Configuration/enabled TIM6 global interrupt with Preemp Priority=10 and Sub Priority=0. Then Generate code.

 The generated code seemed to be OK, and it also had  set NVIC interrupt priority and enable as below.

HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 10, 0);


I added code to toggle the LED inside the ISR void TIM6_DAC_IRQHandler (void) and it never triggered.



TIM6  was counting OK (read TIM6.CNT and outputted on PWM pin for monitoring), but there was  no timer overflow interrupt generated.


However after adding TIM6.DIER = 1; // DMA/interrupt enable, then it worked.


What I need to add TIM6.DIER=1; instead of by CubeMX? or what I did wrong in my steps?