2024-10-19 06:40 AM
I have a HAL/Cube based project where I am currently using TIM2 for counting edges, and TIM16 for timing.
I am now trying to add more timers but have found that when I enable TIM1 orTIM17, and enable ALL the associated interrupts, that I never get any interrupts for these timers. But interrupts continue just fine for TIM2 and TIM16.
2024-10-19 07:00 AM
Not sure how we'd debug this remotely with this much information.
Dump the related RCC and TIMx registers. Those of the NVIC
Show Code for the Vector Table and Handlers.
Show Code for initialization.
2024-10-19 07:47 AM
Given that its entirely HAL/Cube generated code I mostly assumed I had a fundamental misunderstanding about the timers (i.e. something like "you simply can't do that").
Here's what I could grab easily. I'll have to read the documentation some more to get the relevant RCC and NVIC registers.
TIM17 cube config
TIM17 cube nvic config:
Generated init code, its exactly the same as the TIM16 code:
Here is a subset of my interrupt handler code. There's a large if-else block in here that checks TIM2, TIM16, and TIM17.
Cube auto generates these functions, which I believe are the actual interrupt vectors. HAL_TIM_IRQHandler will call HAL_TIME_PeriodElapsedCallback. TIM1_TRG_COM_TIM17_IRQHandler is never called.
In the startup assembly file you can see the TIM16 and 17 blocks:
Here's the TIM17 registers right after the config is done, and then here it is after the program has run for a bit:
Also, here's a grab of every register that contained the word "tim17"