Close

Unoptimized firmware build #1

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/13/2025 at 15:080 Comments

I banged out an unoptimized firmware build for implementing some light patterns and the power-saving mode. So far, we have for light patterns:

  1. Candlelight: bottom LEDs off, top LED flickers
  2. Solid: bottom LEDs on at 100% brightness, top LED flickers
  3. Blink (slow): bottom LEDs blink at a 1 Hz rate, top LED flickers
  4. Blink (fast): bottom LEDs blink at a 2 Hz rate, top LED flickers
  5. LED chaser
  6. Software flicker: all LEDs flicker at different offsets from the source RNG array; bottom LEDs flicker in software, top LED flickers in hardware with PCA0-based PWM generator
  7. Half-brightness: bottom LEDs are set to a reduced brightness through software PWM, top LED flickers

So far, I've implemented a crude power saving function that shuts off all LEDs and places the CPU in idle mode, where all interrupts may wake the CPU. Unfortunately, this is not ideal as the way I implement timekeeping is through Timer2 driven by the RTC crystal divided by 8, so the CPU will wake up every 1 second and need to be put back to sleep.

Ideally, I can place the CPU into sleep mode, where all peripherals and the core are both off. This would cut power consumption even more, but require me to re-implement several features:

This will require some re-writing of the code, so I'm going to dump what I have in my files for now.

Discussions