Processor SDK RTOS GPIO

From Texas Instruments Wiki
Jump to: navigation, search


RTOS Software Developer Guide GPIO



Overview

User Interface

Application

Debug


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 Processor SDK RTOS 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.

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();
}

Examples

Refer SDK Release Note for GPIO support across different EVMs.

Name
Description
Expected Results
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 EVM :  STATUS LED 1 Yellow
AM572x GP EVM :   USER LED 1

AM571x IDK EVM :  Industrial LED 3 Red

K2H EVM:              USER LED 2 Blue

K2E EVM:                 USER LED 1 Blue

K2G EVM:                 USER LED 1 Yellow

NOTE

There are no user mode LEDs directly connected to GPIO pins on K2L, C6678 and C6657 EVMs.


Additional References

Document Location
API Reference Manual $(TI_PDK_INSTALL_DIR)\packages\ti\drv\gpio\docs\doxygen\html\index.html
Release Notes $(TI_PDK_INSTALL_DIR)\packages\ti\drv\gpio\docs\ReleaseNotes_GPIO_LLD.pdf