GPIO Tiva C ® Series Raul Cabrera Khaldon Batnij Isaac Zavala

Preview:

Citation preview

GPIOTiva C® Series

Raul CabreraKhaldon BatnijIsaac Zavala

General-purpose input/output (GPIO) peripherals provide pins that can be configured for either input or output.

Output: able to write to an internal register to control the state driven on the output pin.

Input: can detect the state of the input by reading the state of an internal register

Introduction to GPIO

6 GPIO ports 48 GPIO pins PC0-PC3 are protected against accidental

programming for JTAG/SWD PD7&PF0 Non Maskable Interrupts NMI GPIO Blocks are labeled as Port A-F All pins are only 5v tolerant except PD4, PD5,

PB0, PB1 which are limited to 3.6v

General Information

TM4C123GH6PM I/O pins

The GPIO module allows you to manage General Purpose I/O pins and ports via simple and portable APIs.

The application needs to supply a GPIO_Config structure to the module.

GPIO Driver

EK_TM4C123GXL_initGPIO() function needed to initialize the board specified GPIO peripheral settings.

Declares the GPIO_config structure for pin input/output configuration

Configurations should be set before calling GPIO_init()

EK_TM4C123GXL.c

The following are the GPIO APIs: #include <ti/drivers/GPIO.h>

• GPIO_init() sets up the configured GPIO ports and pins.

• GPIO_read() gets the current state of the specified GPIO pin.

• GPIO_write() sets the state of the specified GPIO pin to on or off.

• GPIO_toggle() toggles the state of the specified GPIO pin.

• GPIO_setupCallbacks() sets up the hardware interrupt and callback table for a GPIO port.

• GPIO_clearInt() clears the interrupt flag for the specified GPIO pin.

• GPIO_disableInt() disables interrupts on the specified GPIO pin.

• GPIO_enableInt() enables interrupts on the specified GPIO pin for the specified pin event.

APIs

Provides a simple graphical way to initialize port pins with collision and error control

Gives users the ability to select from a list of supported peripherals and automatically generate code for the required peripheral functions

Provides protection for JTAG pins Generates fully-commented code that implements Driver Library

API calls to enable the required peripheral clocks and to configure the pins for the chosen function

Allows manual selection of port functions and automatic selection of peripherals with the ability to lock/unlock specific port functions

PinMux

Example

Example

Questions?

TM4C123GH6PM Data sheet - http://www.keil.com/dd/docs/datashts/ti/tm4c123/tm4c123gh6pm.pdf

TI-RTOS User guide- http://www0.egr.uh.edu/Courses/ECE/

ECE4437/labsupport/TI-RTOS/spruhd4f_TIRTOS_UG_2.0.pdf

References and further reading