The Power System IC controls the battery charging and USB power supply. We use I2C to communicate with it, regularly asking about the current charge status.
The charge status is needed to enable or disable the USB UART (CDC) stack.
Problem
The run loop polls the power IC for the USB charge status too often. This triggers I2C communication on every run loop iteration, significantly slowing down the app execution. The CPU spends most of it cycles polling the power IC about the charging status - which is a waste.
Solution
We should utilize the power IC capability to send the CPU interrupt upon charging changes. This will eliminate the need for run loop polling.
Note: We will still need to poll the power IC on system POR and wake from sleep.
The Power System IC controls the battery charging and USB power supply. We use I2C to communicate with it, regularly asking about the current charge status.
The charge status is needed to enable or disable the USB UART (CDC) stack.
Problem
The run loop polls the power IC for the USB charge status too often. This triggers I2C communication on every run loop iteration, significantly slowing down the app execution. The CPU spends most of it cycles polling the power IC about the charging status - which is a waste.
Solution
We should utilize the power IC capability to send the CPU interrupt upon charging changes. This will eliminate the need for run loop polling.
Note: We will still need to poll the power IC on system POR and wake from sleep.