
Generally, anything that you’d control with a digitalWrite or monitor using a digitalRead, measure through an ADC, or talk to using I2C – these are things handled by the EC. This one even has some extra signals for media buttons that were left out in hardware! But of course, it’s not just power management – there’s a whole lot of things in a laptop you need GPIOs for. Instead, these are devices like power switches, the charger chip, and various current monitors, since these have to work correctly even when the chipset and CPU are powered off.

Not devices connected to USB, LVDS/eDP or PCIe, because those would fall within the purview of the chipset. The EC controls a whole bunch of devices in your laptop. Why have we not been reprogramming our ECs all this time? That’s a warranted question, too, and I will tell you all about it. In Apple land, you might know them as SMC, but their function is the same. You can find an EC in every x86 computer, including laptops, managing your computer’s lower-level functions like power management, keyboard, touchpad, battery and a slew of other things. Wait… Microcontroller code? GPIOs? This brings us to the question – what is the EC, really? To start with, it’s just a microcontroller. In a comment section of HackerNews, a Framework representative has speculated that you could add GPIOs to a Framework motherboard through EC firmware hacking.

Now, there’s a repository of microcontroller code that you can compile yourself, and flash your Framework laptop’s motherboard with. The EC that the Framework uses is a MEC1521 chip from Microchip, and earlier this year, they open-sourced the firmware for it. He walks us through adding custom code to your laptop’s EC firmware and integrate it properly into the various routines the EC runs.


He shows us how to reuse the Caps Lock LED, instead making it indicate the F1-F12 key layer state – also known as “Fn lock”, AKA, “Does your F1 key currently work as F1, or does it regulate volume”. Recently, I stumbled upon a cool write-up by, about reprogramming a Framework laptop’s Embedded Controller (EC).
