Debugging power-related firmware

How do I investigate and/or fix LPC firmware related to power and batteries?

Since beginning of April MNT Reform is my daily driver. At the same time I feel it is behaving strangely (I might be wrong here) - or at least I cannot understand its mode of operation.

Just before FOSDEM (beginning of February, when I was still treating MNT Reform more as an experiment) it stopped working: it was not turning on and when I connected power supply (both USB-C PD 20V and enclosed one 24V) D9 LED was dark and D8 was blinking few times a second. Lucas looked at it, did not find anything obvious and advised to send it for deeper investigation. Before I managed to do that - I disassembled everything, disconnecting batteries, and after one day “offline” everything started working again.

Beginning of April - my previous laptop died so I started using MNT Reform daily.

Beginning of May - batteries (still original ones) were discharging quickly. I disconnected everything, used “Analyze” mode of my external charger (fully charge, discharge, charge again) which fixed situation.

Then, beginning of July, one of original accumulators discharged fully, to 0.0V (I do not have new battery pack with discharge protection). My attempts to recover it failed, so I changed all accumulators to Eremit 2000mAh and recompiled firmware to take this change of capacity into consideration. OLED shows firmware version as MREF2LPCR320230703.

After that I can observe rather strange behavior, as if new firmware cannot keep charging state. When I turn on laptop after longer period of it being turned off (longer than 2-3h) OLED shows ???. When I connect
power supply and laptop charges fully, OLED displays 100%, and when I disconnect it, charge drops to 98%, 97%, and so on. If I connect power, charge grows. When I turn off laptop, and then turn it back on after 1h or so - charge is displayed properly. Only when laptop is turned off for longer time, it looks like it “forgets” charge state. Situation is the same for almost 2 months, so much longer than potential “learning period”. I even disconnected everything (including removal of small CR battery from motherboard) and left it over the weekend - it didn’t help. I noticed another strange behaviour. USB-PD 20V from Ada Fruit does not work (I described it shortly here). When I connect it, D9 stays dark while D8 blinks few times a second, similar to situation I described earlier. Laptop works otherwise, it’s just not being charged. OTOH 12V converter works without any problems. I’m not sure if this is problem with power supply or motherboard: from time to time, when I connect normal power source (24V), D8 is on while D9 is blinking once every few seconds (few seconds on, few seconds off). During such behaviour I can observe that OLED shows 0.00A and -1.47A. After few minutes normal charging resumes - but sometimes with -0.7A (or similar) and not usual -1.4A.

I tried to read source (reform2-lpc-fw/src/boards/reform2/board_reform2.c) but haven’t noticed anything obvious. OTOH I do not have experience with such hardware - I was not even able to determine if D8 and D9 are steered by firmware or directly by hardware.

Basically I’m a bit lost. I’m not sure if this is normal behavior or signs of potential problems. And if it’s latter - how can I check what is going on? I can compile new versions of firmware and observe its behavior but lack knowledge to know what to safely change. Any tips will be appreciated. If not - I’ll post if something changes.

Hi, some thoughts:

D8 blinks few times a second

This normally happens when the power adapter is not delivering enough current to Reform. It is advised to use a stronger power supply.

D8 is on while D9 is blinking once every few seconds (few seconds on, few seconds off).

This sounds normal, it should be the balancing behavior. Charging is turned off during balancing (when discharging overvolted cells).

D9 will go on when the LPC firmware turns off charging, see:

When I turn on laptop after longer period of it being turned off (longer than 2-3h) OLED shows ???.

I also have this recently. I would like to fix it, but didn’t have the time yet due to a perfect storm here of a lot of new products/batches being readied for testing and shipment.

I suspect it is the brownout reset being a bit overzealous. I activated it in a relatively recent version of LPC firmware to make sure the LPC never crashes/freezes/is able to recover from undervoltage crashes. Perhaps one can tweak its sensitivity. See the LPC11U24 reference manual.

See also:

LPC11U24 manual:

Also, when rereading i see that you don’t have the protected battery boards. I strongly, strongly suggest to get them.