SLUAA04A june 2020 – may 2023 BQ25150 , BQ25155 , BQ25618 , BQ25619 , TS5A12301E , TS5A3157 , TS5A3159A , TS5A6542
When the MCU enters the ISR, it will first check to see if the interrupt was caused by VIN_PGOOD_FLAG. This is checked because the BQ25155 has many other interruptible flags that it can set, and for this application we are only using Vin flag. The end user can choose to take different actions for other flags that are set by the BQ25155.
If the Vin flag has been asserted, the internal ADC of the BQ25155 will be used to qualify the interrupt. This is done by reading Vin every 3 ms for 250 ms and comparing the comparing most recent three values. The interrupt will timeout if three consecutive values are not found to confirm the interrupt within 250 ms
If the interrupt is qualified, the Charge Complete register will then be checked. If the charging has been completed a charge complete bit will be transmitted. If the charging is not complete, the earbud battery voltage that was read in the main loop will be transmitted over UART. The transmission is completed by disabling the earbud load switch and enabling the analog switch. The data will then be pushed into the UART transmit buffer and sent to the case. The earbud will then immediately re-enter charging mode by toggling the switches. This prevents an accidental powering of the earbud logic pins when the case re-enters charging mode as a response to the communication. After this step, the earbud will return to the main loop.