Close

Bug fix: interrupt priority

A project log for Electronic Ornament 2025 with EFM8SB1 Sleepy Bee

This EFM8-based ornament is an improvement on my PIC16-based design from 2024

zachary-murtishiZachary Murtishi 04/14/2025 at 22:490 Comments

I noticed that the RTC alarms were failing to put the ornament into sleep mode whenever light patterns that depended on Timer0 interrupts were on. I figured that this may be due to the fact that the Timer0 held priority over the RTC alarm interrupt and consequently it could not be pre-empted by an RTC alarm interrupt if they coincided.

I updated the program to shift the Timer0 interrupt to a low priority and the RTC alarm to a high priority.

Initial tests show that this solution seems to work, but I have yet to test it with the intended time sequence (4 hours on, 20 hours off).

I have a few other optimizations I can perform left, such as getting rid of the modulo operations and replacing them with conditionals. This would decrease the program size at the expense of data memory, which I have plenty of left.

Discussions