Skip to main content

Calibrating the MFM Emulator's voltage sensor

Recently, we had a customer complain that their MFM Emulator would get stuck in a boot loop whenever they enabled automatic startup of emulation on boot (as you might like to do when permanently installing the MFM Emulator in an old computer). We've been scratching our heads as to what might have gone wrong - and finally reproduced the issue in our lab. It turned out that wo issues were at fault here:

  1. Our most recent units (S/N 070 and newer) have a slight resistor value change, and

  2. This particular customer's 12V line in their vintage computer was sagging at 11.6V.


When enabling the MFM Emulator's "start emulating on boot" functionality, the powerfail program is started in the background. powerfail monitors the 12V line to see if it drops below 11.5V. If so, the program exits emulation and forces a shutdown, syncing all data to the flash/USB drives attached.

The BeagleBone senses the 12V line through a simple resistor divider, divided down to about 1.4V because the BeagleBone's analog-to-digital converter can accept a maximum of 1.8V. However, in the lab, the latest unit out of assembly read the 12.00V line at 11.6V! Because of the small resistor values used, a difference of just 20 ohms accounts for this major variation in sensitivity. And for our unfortunate customer, 11.6V read 0.4V low would be well below the 11.5V threshold, forcing a reboot - and ending up in a boot loop.

The change of resistor value was forced by the global supply chain shortage in components, meaning we were unable to source one particular resistor. Unfortunately, this resistor acts as a divider on the 12V line, feeding the analog-to-digital converter on the BeagleBone, which is used to detect a power failure situation.

The great news is that users of the MFM Emulator can fix this themselves in software. Simply edit the file /etc/mfm_emu.conf and change the line

PowerFailOptions=""

to

PowerFailOptions="--scale 0.1213"

We've updated the pack-in letter to call out this change for anyone who may need it.

If you want to fully calibrate your unit's voltage measurement, you'll need a voltmeter. Here's how:

  1. Power the MFM Emulator via the 4-pin Molex connector, and ssh to your MFM emulator as root.

  2. Run the following commands:

    echo cape-bone-iio > /sys/devices/bone_capemgr.*/slots

    cd ~/powerfail

    ./powerfail --debug --powercmd true --threshold 0 --scale 0.1253

  3. With your voltmeter, measure the voltage at the P3 (!2V) test point on the emulator.

  4. If the printed value does not match within 0.02V of the measured value, adjust the scale value. Decreasing the scale value will increase the value measured by powerfail.

Thanks to our customer for helping us debug this issue.