4.8. GPIO¶
4.8.1. Introduction¶
GPIO module allows application to manage General Purpose I/O instances and pins via simple portable APIs. Because of its simplicity, APIs are pin based and does not follow model of other drivers inside PDK which requires handle abstraction.
Modes of Operation
Following modes of operations are supported Input or Output Each gpio pin can be configured as either input: GPIO_CFG_INPUT or output: GPIO_CFG_OUTPUT. If it is configured as an output then pin level can be additionally configured
Interrupt support Each gpio pin can be configured to generate interrupts based on event type GPIO_CFG_IN_INT_XXX configuration. To generate interrupt, gpio pin has to be configured as input pin.
Driver Configuration
Board Specific Configuration
All board specific configurations like enabling clock and pin-mux are required before calling any driver APIs. By default Board_Init() API available under board module supports all initialization sequence for TI supported EVMs. In addition it initializes UART instance for Console/STDIO. Refer PDK Board Support for additional details.
GPIO Configuration Structure
GPIO_soc.c binds driver with hardware attributes on the board. Hardware attributes includes base address, interrupt number etc. GPIO pin behavior can be configured statically, or alternatively dynamically during runtime.
GPIO_init () API triggers all static configuration information available through hardware attributes. Once initialization is complete additional APIs can be used to configure and access pins.
4.8.2. User Interface¶
For details about individual fields of this library structure, see the PDK doxygen documentation
4.8.2.1. APIs¶
API reference for Application:
#include <ti/drv/gpio/GPIO.h>
Below sequence indicates API calling sequence for a simple use case of LED toggling
...
Board_init(boardCfg);
GPIO_init();
While(1)
{
GPIO_write(Board_LED1, GPIO_PIN_VAL_HIGH);
Delay();
GPIO_write(Board_LED1, GPIO_PIN_VAL_LOW);
Delay();
}
4.8.3. Application¶
4.8.3.1. Examples¶
Refer SDK Release Note for GPIO support across different EVMs.
Name | Description | Expected Results
|
SoC Supported | Build Type |
---|---|---|---|---|
GPIO_LedBlink | Simple example demonstrating LED Toggling | Following LED
blinks based on EVM
being used.
AM335x
ICEv2:
USER LED 1
AM437x
EVM:
USER LED 1
AM572x IDK :
STATUS LED 1 Yellow
AM572x GP
EVM : USER LED1
AM574x IDK :
STATUS LED 1 Yellow
AM572x GP
EVM : USER LED1
AM571x IDK :
Industrial LED 3
Red
K2H EVM:
USER LED 2 Blue
K2E EVM:
USER LED 1 Blue
K2G EVM:
USER LED 1 Yellow
AM65xx EVM:
USER LD16, LD17
J721E EVM:
USER LED 1
J7200 EVM:
USER LED 1
AM64x EVM:
USER LED 1
|
AM335x, AM437x, AM571x, AM572x, AM574x, k2g, k2hk, k2l, k2e, c6657, c6678, omapl137, | CCS project |
am65xx j721e tpr12 j7200 am64x | makefile |