SLUUCH2 March 2021 BQ40Z50-R2
The BQ40Z50-R4 supports GPIO capability on the three LED pins and the DISP pin when they are not used for LED operation.
GPIO and LED functionality cannot coexist: It is not possible for some pins to function for the gauge LED operation, while others are used as GPIOs. However, when the pins are used as GPIOs, the user can attach an LED and control the pin manually using the commands described below.
When ManufacturingStatus()[LED_EN] = 0 and IO Config()[GPIO_EN] = 1, then the LED and DISP pins can be used as GPIOs.
The DF byte GPIO Sealed Access Config is provided to determine whether the GPIO can be controlled or read when the gauge is SEALED. In some cases, they will be preferred controllable while SEALED, and not in other cases.
A GPIO that is configured as an output can also be read. A GPIO that is configured as an input cannot be written to drive high or low. The DF byte Flag Map Set Up holds the default configuration for the four GPIO pins.
When the read-only subcommand GPIORead() is sent by the host, the level of the GPIO pins is reflected in the data read back. When GPIO mode is selected and the write-only subcommand GPIOWrite() is sent by the host, the pins may be configured as outputs driven low, outputs driven high, or hi-Z (which is the setting that will generally be used if the pins are intended to be used as inputs).
The LED pins and the DISP pin are different, in that when driving high, the LED pin will provide a level = BAT. The DISP pin can only provide a weak pullup with maximum ~6 V and a minimum of 1.8 V while sourcing 10 µA.
When the gauge goes into SHUTDOWN mode, these pins will be set to hi-Z.
In addition, assertion of pins can be controlled via the Flag Map Set Up scheme to assert upon particular status bits in the device. There are four such configurations for use described in Flag Map Set Up 1..4.