7.2.1 Digital Input/Output
The main differences in the FR59xx general-purpose I/O (GPIO) pins are:
- All GPIOs have internal configurable pull-up and pull-down resistors.
- P3 and P4 ports are also interruptible in the FR59xx devices (only P1 and P2 in the F2xx devices)
- JTAG functionality in the FR59xx devices is multiplexed with GPIO pins on Port J
- Peripheral function select in the FR59xx devices uses two registers: Port x Function Selection Register 0 (PxSEL0) and Port x Function Selection Register 1 (PxSEL1). These two registers can be set or cleared simultaneously using the Port x Complement Selection Register (PxSELC) to avoid intermediate configurations.
NOTE
GPIOs will not function after reset until this change has been made to firmware.
By default, after BOR, all digital I/O are set as high-impedance with Schmitt triggers and their module functions disabled to prevent any cross current. This enables reduced power consumption when the device starts up.
The following code sequence is required to initialize GPIOs on reset and wakeup from LPMx.5:
- Initialize all port pin registers as required for function: Port x Direction Register (PxDIR), Port x Pullup or Pulldown Resistor Enable Register (PxREN), Port x Output Register (PxOUT), Port x Select Register 0 (PxSEL0), Port x Select Register 1 (PxSEL1), and Port x Interrupt Edge Select Register (PxIES).
- Clear the LOCKLPM5 bit.
PM5CTL0 &= ~LOCKLPM5
- If not waking up from LPMx.5, clear all Port x Interrupt Flag Register (PxIFG) to avoid erroneous port interrupts.
- Enable port interrupts using Interrupt Port x Interrupt Enable Register (PxIE).
For more information, see the Configuration After Reset section of the Digital I/O chapter in the MSP430FR58xx, MSP430FR59xx, MSP430FR68xx, and MSP430FR69xx Family User's Guide.