GPIO Tiva C® Series

Download Report

Transcript GPIO Tiva C® Series

Tiva C® Series
Raul Cabrera
Khaldon Batnij
Isaac Zavala
Introduction to GPIO
 General-purpose input/output (GPIO) peripherals
provide pins that can be configured for either input or
 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
General Information
 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
TM4C123GH6PM I/O pins
GPIO Driver
 The GPIO module allows you to manage General
Purpose I/O pins and ports via simple and portable
 The application needs to supply a GPIO_Config
structure to the module.
 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
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.
 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
 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
References and further reading
 TM4C123GH6PM Data sheet
 TI-RTOS User guide