I'm currently designing a PCB at which I have an lithium ion battery (4.3V max) attached. The battery is charged via USB (5V).
The charging controller is enabled by a microcontroller which should detect when USB is attached. Due to power saving and money saving design considerations the plus-pole of the battery and the 5V-USB pole are connected to each other (diode is there for direct-charging-protection).
Anyway, before I had these design re-considerations I had a simple voltage divider at the 5V-USB (150k/100k) to detect a connected USB charging cable directly by the microcontroller via a simple GPIO interrupt.
Now I have to detect without an ADC (already used) if the voltage on the line is sourced by USB (5V) or by the lithium ion battery (4.3V). Is the microcontroller's analog comparator (ACMP, using SiLabs, EFM32G222 microcontroller) an option to use? Then I could just compare if the signal is below or above 4.3 V (or let's say 4.4 V to add some safety space)? I would use a voltage divider to scale down the 4.3 V/4.4 V to the voltage are of the microcontroller (2.1 V).
Is this a reasonable idea?
Many thanks in advance for your help!
EFM32G Reference Manual: https://www.silabs.com/documents/public/reference-manuals/EFM32G-RM.pdf
Used Specific MCU Datasheet: http://www.farnell.com/datasheets/2170296.pdf