Post History
Another solution which uses an ADC to read the three-state pin on the battery charger IC. The original question mentions GPIO, and doesn’t mention ADC. Maybe this will be useful for some other de...
#1: Initial revision
Another solution which uses an ADC to read the three-state pin on the battery charger IC. The original question mentions GPIO, and doesn’t mention ADC. Maybe this will be useful for some other design which has an ADC.  When the STAT pin of the MCP73831 is high-Z, the voltage at the ADC input is 1.6V . When the MCP73831 drives the STAT pin high, the voltage at the ADC input is 2.4V . When the MCP73831 drives the STAT pin low, the voltage at the ADC input is 1.2V . The microcontroller can sample this voltage with an ADC and determine the state of the STAT pin.