In my recent project, I have encountered weird HardwareTimer behaviour. The timer setup code is as follows:
Code: Select all
It sets up TIM3 with a period of 1ms and calls the function tick at 1kHz. This timer interrupts stopped working after I ported the code to use U8G2 as its display library. It appears to only call tick once. The display is an SH1106 connected via SPI1. Interestingly the code works fine if I change Timer3 to Timer2, however, I need Timer2 for a future feature of the project. I also tried Timer4 but got the exact same result as with Timer3. I have no idea why the timers, which should be identical, is behaving differently. Has anyone experienced similar behaviour before? and what are some possible causes? The full source code is here
and the code snippet above is line 96-101 in main.cpp in the src folder. Thanks to everyone in advance.