M.2 UPS PMH - configuration and test notes - manual V14 / firmware V88

Default bus/address examples require the matching application firmware.
Keep the normal daemon running during UPS tests.

NORMAL TIMED UPS MODE
sudo i2cset -y 1 0x6b 0x13 0x00 b
sleep 3
sudo i2cget -y 1 0x6b 0x13 b
sudo i2cget -y 1 0x6b 0x01 b
Expected 0x00, 0x01. Default: about 70 s battery runtime before
FSSD starts, then about 30 s grace time. Low battery can act earlier.

OPTIONAL ON/OFF SWITCH MODE
sudo i2cset -y 1 0x6b 0x13 0xaa b
sleep 3
sudo i2cget -y 1 0x6b 0x13 b
sudo i2cget -y 1 0x6b 0x01 b
Expected 0xaa, 0xff. Unlimited elapsed runtime still has battery protection.
Only use on an assembly with the supported switch and Pi button connection.

PI EEPROM FOR SWITCH-CONTROLLED STANDBY
sudo rpi-eeprom-config
For the supported direct USB-C standby arrangement, the manual calls for:
POWER_OFF_ON_HALT=1
WAIT_FOR_POWER_BUTTON=1
Review the actual EEPROM version and preserve other settings. These settings
belong to Raspberry Pi EEPROM; the M.2 board does not write them itself.
Use sudo rpi-eeprom-config --edit to change them deliberately, then reboot.

RTC
Identify the UPS device from /sys/class/rtc/rtc*/name first.
Example only if it is rtc1:
sudo hwclock --show --rtc=/dev/rtc1
The daemon normally handles UTC writes after NTP. Avoid unnecessary concurrent
manual writes. If a write fails, preserve the UART/kernel/daemon logs before
repeating it. A historical error count differs from a growing error count.

LOG CAPTURE
uptime
sudo systemctl show M2_PMH_i2c.service -p ActiveState -p NRestarts
sudo journalctl -u M2_PMH_i2c.service -b --no-pager > ~/M2_current_boot.log
sudo journalctl -k -b --no-pager > ~/M2_kernel_current_boot.log

COMMISSIONING
Test stable cable operation and charging, battery takeover, timed FSSD,
cable return before FSSD, return during the final seconds of FSSD, and at
least five complete shutdown/restart cycles. Test switch OFF/ON separately.
Record battery, supply, firmware and exact cable timing with serial captures.

Do not use repeated i2cdetect scans as a continuous monitor. The kernel-owned
RTC may appear as UU. Do not force I2C access to a kernel-owned address.

EXTENDED NORMAL RUNTIME
With normal switch mode already selected:
sudo i2cset -y 1 0x6b 0x01 0xff b
sleep 3
sudo i2cget -y 1 0x6b 0x01 b
0xFF removes the elapsed-time limit only. Values 0x00–0xFE give a threshold
of about 10 + 60 * value seconds. Selecting normal mode 0x00 again restores
runtime 0x01. Low battery and manual shutdown remain active.

READ-ONLY MONITOR
cd ~/M2_UPS_PMH_Manual_V91
sudo python3 optional_monitor/M2_PMH_status_05.py
The monitor is updated for V88. Stop it for host-inactivity tests and upload.
