Closed MattCummings0517 closed 2 years ago
This bug manifested on V2.1 Tag 3 - the tag discharged all the way down to the hardware UV safety. The protection would not allow charging initially, but was able to recover by applying a voltage to VMID and got it to start taking charge. One of the cells had gone all the way to 1.9V. We were fortunate to revive this Tag.
2.1-4 addresses this by using the FPGA and a new monitor program that samples the battery voltage once per minute. If the voltage drops below the critical threshold (currently 3V), the monitor sends a command to cetiTagApp via named pipe. This command arms the FPGA to shutoff if it detects a GPIO flag from the Pi going low. Then the script powers the Pi down with shutdown -P +1.
In the cetiTagSensors.c file (at or about line 483) the attempt to gracefully turn off the Pi when the battery goes below critical is not working as intended. A return value of -1 (error) comes back. The design idea is to just shutdown the Pi if the program arrives at this point, but something is blocking the attempt.
The device just keeps going. Eventually the battery reaches 5.2 V at which point the hardware undervoltage protection engages. There is no evidence that the Pi tries to reboot on any residual charge or oscillation of the UV condition, however running the battery all the way down is not desirable in general.