Unfortunately, due to limited board real estate the Vusb signal is not connected to the SoC. You could use a voltage divider to drop the voltage down to 3V and connect it to a GPIO input. The battery charger IC will prevent backflow from the battery to Vusb when unconnected, so doing this will not affect the idle/standby current draw.
Alternatively, if you are only interested in knowing if the battery is actively charging, and you are comfortable with soldering very small wires, there is a charging status output from the battery charger. This would not need a voltage divider, and should be used with the GPIO active high pull up. When the battery is charging (Vusb connected, and the battery is not fully charged) it will pull the signal low. The GPIO pin change event can be used for notifications when the status changes.
You might consider a 3rd approach using software -- whenever Vusb is plugged in, there will be an uptick in the battery voltage due to the charge current. This of course is only reliable when the battery if partially discharged. In the near future we will release a raw battery voltage endpoint which is a more direct proxy for this capability than the battery charge %.
Your second suggestion is very interesting, it would save a bit of work but if I got it correctly the charging status pin will pull the GPIO low only when the battery is charging, right?
So when the battery is charged the battery charger will not pull my GPIO input down, right?
Would I get an event when the USB is disconnected regardless if the battery is charged or not?
This is what I want to do: receive an event whenever the USB is connected or disconnected, independently of the status of the battery.
At the end I attached a voltage divider (both resistors are 1k) between GND, Vusb and GPIO 3, configuring the input as PULLDOWN.
I tried to use GPIO 1 or 2 but I had problems, the interrupt was not reliable, the pin was going high and low unpredictably and I couldn't figure out why.
Comments