[SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Working libraries, libraries being ported and related hardware
Post Reply
semicolonTransistor
Posts: 11
Joined: Sat Nov 24, 2018 8:02 am

[SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by semicolonTransistor » Sat Nov 24, 2018 8:47 am

Hi,
In my recent project, I have encountered weird HardwareTimer behaviour. The timer setup code is as follows:

Code: Select all

	Timer3.setPeriod(1000);
	Timer3.setChannel1Mode(TIMER_OUTPUT_COMPARE);
	Timer3.setCompare1(1);
	Timer3.attachCompare1Interrupt(tick);
	Timer3.refresh();
	Timer3.resume();
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.
Last edited by semicolonTransistor on Sun Nov 25, 2018 2:42 pm, edited 1 time in total.

semicolonTransistor
Posts: 11
Joined: Sat Nov 24, 2018 8:02 am

Re: Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by semicolonTransistor » Sun Nov 25, 2018 2:40 pm

Hi, um this is even weirder. It suddenly started working, I did not even reprogram it. Anyways, I'll mark this thread as solved. This is the most bizarre thing I have even seen,

User avatar
mrburnette
Posts: 3001
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: [SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by mrburnette » Sun Nov 25, 2018 7:21 pm

In my personal experience, breadboarding issues, power (wart), and/or AC induced voltages from fluorescent lighting, LED lighting 'hash', etc.

One should always do a littl' jig to humor the Low Induced Noise gods prior to any prototype tesiting.

Ray

MoDu
Posts: 114
Joined: Mon Jul 16, 2018 1:51 pm

Re: [SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by MoDu » Tue Nov 27, 2018 3:43 pm

All hail the Low Induced Noise gods!
:evil:

semicolonTransistor
Posts: 11
Joined: Sat Nov 24, 2018 8:02 am

Re: [SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by semicolonTransistor » Sat Dec 01, 2018 12:48 pm

mrburnette wrote:
Sun Nov 25, 2018 7:21 pm
In my personal experience, breadboarding issues, power (wart), and/or AC induced voltages from fluorescent lighting, LED lighting 'hash', etc.

One should always do a littl' jig to humor the Low Induced Noise gods prior to any prototype tesiting.

Ray
Definitely agrees with you, the noises always gets you when you least expect it.

User avatar
Bear in There
Posts: 31
Joined: Tue Nov 20, 2018 9:30 pm

Re: [SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by Bear in There » Sat Dec 22, 2018 6:35 pm

Copped this recently. Breadboard jumpers came as terminated ribbon cable that you split up as required, and there is always a temptation to keep the ribbon intact whether for looks or neatness. It's amassing how much 3.3v will induct into another wire over 20cm.
This is why it's not uncommon to see Gnd wires between signals on a ribbon cable. Also why I love my scope, I get to see.
Good artists copy; great artists steal. (Incorrectly accredited to Pablo Picaso by Steve Jobs)

MoDu
Posts: 114
Joined: Mon Jul 16, 2018 1:51 pm

Re: [SOLVED]Timer Interrupt not Working and Weird HardwareTimer behaviour

Post by MoDu » Sat Dec 29, 2018 3:19 pm

Doing electronics without a scope is like flying blind. Best money I ever spent on a tool.

Post Reply