Hi,
I am trying to find a good way to detect the transition from VIN to BATT on the BQ25121A part. I read all registers at an interval of 3s. When on battery power, I drive CD high to enable I2C and read the registers. When VIN is detected, the I2C interface is enabled and CD needs to be pulled down to enable charging. I pull CD low as long as VIN is available to enable charging. Now to my main question: Upon VIN removal, last known status of the CD is "low" with power available. In the next read, when the device is actually on battery power, my read fails as I assumed VIN was still available. Can you suggest an method to handle this transition?