Affected GPIO Ports for TM4C123x Devices:
- Port C0, C1, C2, C3
- Port D7
- Port F0
The I/O port will not operate as a GPIO when trying to change output levels or read input signals.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Solution: The Port Pins C0-3, D7 and F0 are locked pins for specific functionality of JTAG, NMI and NMI respectively. To use them in GPIO or any other function they need to be unlocked and commit register be set. The following example function shows how to unlock and commit the Pins "before" calling any GPIO Pin Configuration Function.
Note: With the release of TivaWare Version 184.108.40.2065, an API has been added to DriverLib to address this need: GPIOUnlockPin
An example of proper API usage would be:
Former method for older TivaWare Versions:
Step 1) Include Header files:
#include "inc/hw_types.h" #include "inc/hw_gpio.h" #include "inc/hw_memmap.h"
Step 2) Use the following code based on the required port and target device
HWREG(GPIO_PORTC_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTC_BASE+GPIO_O_CR) |= (GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
HWREG(GPIO_PORTD_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTD_BASE+GPIO_O_CR) |= GPIO_PIN_7;
HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY; HWREG(GPIO_PORTF_BASE+GPIO_O_CR) |= GPIO_PIN_0;