3.10 GPIO Host Communication
MTCH2120 provides an option to configure up to 13 GPIOs. Out the 13 pins, 12 are multiplexed with button functionality, one pin is dedicated GPIO. Users can activate or deactivate the GPIO capabilities on a per-pin basis.
Operation
On power up, MTCH2120 configures the selected pins as GPIO based on the GPIO.PIN register. If a GPIO is enabled, the IN/OUT in the GPIO is configured as Input or Output based on the IN/OUT register values. The device may require up to 2 milliseconds to update the GPIO.IN and GPIO.OUT registers.
The GPIO capabilities for twelve pins are multiplexed with button functions. The users must disable the button operations before the pins are configured as GPIO. GPIOs will not function correctly if the Button is not disabled.
Initialization
After the Reset, the GPIO configuration will load from the Non-Volatile Memory (NVM). Then, save the GPIO configuration.
Steps to Configure a Button Pin as a GPIO Pin
- Disable the Button n by writing
bit
0
in SENCTRLn.EN register. - Configure the Button n pin as
GPIO by writing
1
in GPIO.PIN register. - The GPIO.PIN and SENCTRLn.EN instructions will be configured during the initial setup of the device. Thus, it is crucial to save the configuration and perform a device reset (which might include either a hardware or software reset).
Steps to Configure the GPIO Pin as Output
- Enable the output driver for pin
n by writing
1
to bit n in the GPIO.DIR register.- Ensure the button option is disabled and the GPIO pin n is enabled by reading the corresponding bit from the SENCTRLn.EN and GPIO.PIN registers
- Set the output driver for pin n
to high or low level respectively by writing
1
or0
to bit n in the GPIO.OUT register.
Steps to Configure the GPIO Pin n as Input
- Enable the input driver for pin n
by writing
0
to bit n in the GPIO.DIR register.- Ensure the button option is disabled and the GPIO pin n is enabled by reading the corresponding bit from the SENCTRLn.EN and GPIO.PIN registers
- Read the input of pin n by reading bit n in the GPIO.IN register.