Texas Instruments Incorporated and its subsidiaries (TI) reserve the right to make corrections, modifications,
enhancements, improvements, and other changes to its products and services at any time and to discontinue
any product or service without notice. Customers should obtain the latest relevant information before placing
orders and should verify that such information is current and complete. All products are sold subject to TI’s terms
and conditions of sale supplied at the time of order acknowledgment.
TI warrants performance of its hardware products to the specifications applicable at the time of sale in
accordance with TI’s standard warranty. Testing and other quality control techniques are used to the extent TI
deems necessary to support this warranty . Except where mandated by government requirements, testing of all
parameters of each product is not necessarily performed.
TI assumes no liability for applications assistance or customer product design. Customers are responsible for
their products and applications using TI components. To minimize the risks associated with customer products
and applications, customers should provide adequate design and operating safeguards.
TI does not warrant or represent that any license, either express or implied, is granted under any TI patent right,
copyright, mask work right, or other TI intellectual property right relating to any combination, machine, or process
in which TI products or services are used. Information published by TI regarding third-party products or services
does not constitute a license from TI to use such products or services or a warranty or endorsement thereof.
Use of such information may require a license from a third party under the patents or other intellectual property
of the third party, or a license from TI under the patents or other intellectual property of TI.
Reproduction of information in TI data books or data sheets is permissible only if reproduction is without
alteration and is accompanied by all associated warranties, conditions, limitations, and notices. Reproduction
of this information with alteration is an unfair and deceptive business practice. TI is not responsible or liable for
such altered documentation.
Resale of TI products or services with statements different from or beyond the parameters stated by TI for that
product or service voids all express and any implied warranties for the associated TI product or service and
is an unfair and deceptive business practice. TI is not responsible or liable for any such statements.
Following are URLs where you can obtain information on other Texas Instruments products and application
solutions:
ProductsApplications
Amplifiersamplifier.ti.comAudiowww.ti.com/audio
Data Convertersdataconverter.ti.comAutomotivewww.ti.com/automotive
DSPdsp.ti.comBroadbandwww.ti.com/broadband
Interfaceinterface.ti.comDigital Controlwww.ti.com/digitalcontrol
Logiclogic.ti.comMilitarywww.ti.com/military
Power Mgmtpower.ti.comOptical Networkingwww.ti.com/opticalnetwork
Microcontrollersmicrocontroller.ti.comSecuritywww.ti.com/security
Telephonywww.ti.com/telephony
Video & Imagingwww.ti.com/video
Wirelesswww.ti.com/wireless
This document describes the general-purpose input/output (GPIO) peripheral
in the digital signal processors (DSPs) of the TMS320C645x™ DSP family.
Notational Conventions
This document uses the following conventions.
- Hexadecimal numbers are shown with the suffix h. For example, the
- When referencing specific register bits, the X in the register bit name is
- Registers in this document are shown in figures and described in tables.
Preface
Read This First
following number is 40 hexadecimal (decimal 64): 40h.
replaced with the bit number; for example, GPXDIR refers to the bit field
of the GPIO direction register and GP15DIR refers to bit 15 of GPDIR.
J Each register f igure s hows a r ectangle d ivided i nto f ields t hat r epresent
the fields of the register. Each field is labeled with its bit name, its
beginning and ending b it n umbers a bove, a nd i ts r ead/write properties
below. A legend explains the notation used for the properties.
J Reserved bits i n a register figure designate a bit that is used for future
device expansion.
Related Documentation From Texas Instruments
The following documents describe the C6000™ devices and related support
tools. Copies of these documents are available on the Internet at www .ti.com.
Tip: Enter the literature number in the search box provided at www.ti.com.
TMS320C6000 CPU and Instruction Set Reference Guide (literature
number SPRU189) gives an introduction to the TMS320C62xt and
TMS320C67xt DSPs, development tools, and third-party support.
TMS320C6455 T echnical Reference (literature number SPRU965) gives an
introduction to the TMS320C6455t DSP and discusses the application
areas that are enhanced.
3General-Purpose Input/Output (GPIO)SPRU724
Trademarks
Related Documentation From Texas Instruments / Trademarks
TMS320C6000 Programmer’s Guide (literature number SPRU198)
describes ways to optimize C and assembly code for the
TMS320C6000t DSPs and includes application program examples.
TMS320C6000 Code Composer Studio Tutorial (literature number
SPRU301) introduces the Code Composer Studiot integrated development environment and software tools.
Code Composer Studio Application Programming Interface Reference
Guide (literature number SPRU321) describes the Code Composer
Studiot application programming interface (API), which allows you to
program custom plug-ins for Code Composer.
TMS320C64x+ Megamodule Reference Guide (literature number
SPRU871) describes the TMS320C64x+ digital signal processor (DSP)
megamodule. Included is a discussion on the internal direct memory access (IDMA) controller, the interrupt controller, the power−down controller, memory protection, bandwidth management, and the memory and
cache.
This document describes the general-purpose input/output (GPIO) peripheral
in the digital signal processors (DSPs) of the TMS320C645x™ DSP family.
The general-purpose input/output (GPIO) peripheral provides dedicated
general-purpose pins that can be configured as either inputs or outputs. When
configured as an output, you can write to an internal register to control the state
driven on the output pin. When configured as an input, you can detect the state
of the input by reading the state of an internal register.
In addition, the GPIO peripheral can produce CPU interrupts and EDMA
synchronization events in different interrupt/event generation modes.
Figure 1 shows the GPIO peripheral in the TMS320C645x™ DSP. Figure 2
shows the GPIO peripheral block diagram.
9General-Purpose Input/Output (GPIO)SPRU724
Overview
Figure 1.TMS320C645x DSP Block Diagram
L1P
cache/SRAM
EMIFA
DDR2 memory
controller
PLL2
GPIO
Other
peripherals
EDMA
controller
Boot
configuration
L2 memory
Switched central resource
PLL2
L2 memory
controller
Cache
control
Bandwidth
management
Memory
protection
External
memory
controller
Configuration
registers
Master
DMA
Slave
DMA
L1 program memory controller
Cache control
Bandwidth management
Memory protection
C64x+ CPU
IDMA
16/32−bit instruction dispatch
Data path A
L1S1 M1 D1
Register file A
L1 data memory controller
Cache control
Memory protection
Bandwidth management
L1D
cache/SRAM
Instruction fetch
SPLOOP buffer
Instruction decode
Data path B
D2
Register file B
Advanced
event
triggering
(AET)
S2M2L2
Interrupt
and exception
controller
Power control
Some GPIO p ins a re M UXed w ith o ther d evice p ins. R efer t o t he d evice-specific
datasheet for details on specific MUXing and for the availability of the register
bits. GPINT[0:15] are all available as synchronization events to the EDMA
controller and as interrupt sources to the CPU.
General-Purpose Input/Output (GPIO)10SPRU724
Figure 2.GPIO Peripheral Block Diagram
GPIO peripheral
Data input/output
Overview
Direction
Set
data
Output
data
Clear
data
Input
data
SET_DATA
OUT_DATA
CLR_DATA
IN_DATA
EDMA event and interrupt
generation
Set rising
edge trigger
Rising edge
trigger
Clear rising
edge trigger
Set falling
edge trigger
SET_RIS_TRIG
RIS_TRIG
CLR_RIS_TRIG
SET_FAL_TRIG
DIR
†
GPn
Peripheral clock
(CPU/6)
Synchronization
logic
Edge detection
logic
§
Interrupt and
EDMA event
(GPINTn
‡
)
Falling edge
trigger
Clear falling
edge trigger
†
Some of the GPn pins are MUXed with other device signals. Refer to the device-specific datasheet for details.
‡
All GPINTn can be used as CPU interrupts and synchronization events to the EDMA controller.
§
The RIS_TRIG and FAL_TRIG registers are internal to the GPIO module and are not visible to the CPU.
FAL_TRIG
CLR_FAL_TRIG
§
11General-Purpose Input/Output (GPIO)SPRU724
GPIO Function
2GPIO Function
You can independently configure each GPIO pin (GPn) as either an input or
an output using the GPIO direction registers. The GPIO direction register
(DIR) specifies the direction of each GPIO signal. Logic 0 indicates the GPIO
pin is configured as output, and logic 1 indicates input.
When configured as output, writing a 1 to a bit in the set data register drives
the corresponding GPn to a logic-high state. Writing a 1 to a bit in the clear data
register drives the corresponding GPn to a logic-low state. The output state of
each GPn can also be directly controlled by writing to the output data register.
For example, to set GP8 to a logic-high state, the software can perform one
of the following:
- Write 0x100 to the SET_DATA register
- Read in OUT_DATA register, change the eighth bit to 1, and write the new
value back to OUT_DATA
To set GP8 to a logic-low state, the software can perform one of the following:
- Write 0x100 to the CLR_DATA register
- Read in OUT_DATA register, change the eighth bit to 0, and write the new
value back to OUT_DATA
Note that writing a 0 to bits in the set data and clear data registers does not
affect the GPIO pin state. Also, for GPIO pins configured as input, writing to
the set data, clear data, or output data registers does not affect the pin state.
For a GPIO pin configured as input, reading the input data register (IN_DATA)
will return the pin state.
Reading the SET_DATA register or the CLR_DAT A data register will return the
value in OUT_DATA, not the actual pin state. The pin state is available by
reading the input data register.
General-Purpose Input/Output (GPIO)12SPRU724
3Interrupt and Event Generation
Each GPIO pin (GPn) can be configured to generate a CPU interrupt (GPINTn)
and a synchronization event to the EDMA controller (GPINTn). The interrupt
and EDMA event can be generated on the rising-edge, falling-edge, or on both
edges of the GPIO signal. The edge detection logic is synchronized to the
GPIO peripheral clock.
The direction of the GPIO pin does not need to be input when using the pin to
generate the interrupt and EDMA event. When the GPIO pin is configured as
input, transitions on the pin trigger interrupts and EDMA events. When the
GPIO pin is configured as output, software can toggle the GPIO output register
to change the pin state and in turn trigger the interrupt and EDMA event.
Two internal registers, RIS_TRIG and FAL_TRIG, specify which edge of the
GPn signal generates an interrupt and EDMA event. Each bit in these two
registers corresponds to a GPn pin. Table 1 describes the CPU interrupt and
EDMA event generation of GPn pin based on the bit settings of the RIS_TRIG
and FAL_TRIG registers.
Table 1.GPIO Interrupt and EDMA Event Configuration Options
Interrupt and Event Generation
RIS_TRIG bit n FAL_TRIG bit n CPU Interrupt and EDMA Event Generation
00GPINTn interrupt and EDMA event is disabled
01GPINTn interrupt and EDMA event is triggered on falling edge of GPn
signal
10GPINTn interrupt and EDMA event is triggered on rising edge of GPn
signal
11GPINTn interrupt and EDMA event is triggered on both rising and falling
edge of GPn signal
RIS_TRIG and FAL_TRIG are not directly accessible or visible to the CPU.
These registers are accessed indirectly through four registers:
SET_RIS_TRIG, CLR_RIS_TRIG, SET_FAL_TRIG, and CLR_FAL_TRIG.
Writing 1 to a bit on the SET_RIS_TRIG register sets the corresponding bit on
the RIS_TRIG register. Writing 1 to a bit of CLR_RIS_TRIG register clears the
corresponding bit on the RIS_TRIG register. Writing to SET_FAL_TRIG and
CLR_FAL_TRIG works the same way on the FAL_TRIG register.
13General-Purpose Input/Output (GPIO)SPRU724
Emulation Halt Operation
Interrupt and Event Generation / Interrupts and Events
Reading the SET_RIS_TRIG or CLR_RIS_TRIG register returns the value of
RIS_TRIG register. Reading from SET_FAL_TRIG and CLR_FAL_TRIG
register returns the value of FAL_TRIG register.
To use the GPIO pins as sources for CPU interrupts and EDMA events, bit 0
in the bank interrupt enable register (BINTEN) must be set to 1.
4Emulation Halt Operation
The GPIO peripheral is not affected by emulation halts.
General-Purpose Input/Output (GPIO)14SPRU724
Registers
5Registers
The GPIO peripheral is configured through the registers listed in Table 2. See
the device-specific datasheet for the memory address of these registers.
Table 2.GPIO Registers
OffsetsAcronymRegister NameSection
0008BINTENInterrupt Per-Bank Enable Register5.1
0010DIRDirection Register5.2
0014OUT_DATAOutput Data Register5.3
0018SET_DATASet Data Register5.4
001CCLR_DATAClear Data Register5.5
0020IN_DATAInput Data Register5.6
0024SET_RIS_TRIGSet Rising Edge Interrupt Register5.7
0028CLR_RIS_TRIGClear Rising Edge Interrupt Register5.8
002CSET_FAL_TRIGSet Falling Edge Interrupt Register5.8
0030CLR_FAL_TRIGClear Falling Edge Interrupt Register5.9
15General-Purpose Input/Output (GPIO)SPRU724
Registers
5.1Interrupt Per-Bank Enable Register (BINTEN)
To use the GPIO pins as sources for CPU interrupts and EDMA events, bit 0
in the bank interrupt enable register (BINTEN) must be set. BINTEN is shown
in Figure 3 and described in Table 3.
The GPIO direction register (DIR) determines if a given GPIO pin is an input
or an output. The GPDIR is shown in Figure 4 and described in Table 4. By
default, all the GPIO pins are configured as input pins.
When GPIO pins are configured as output pins, the GPIO output buffer drives
the GPIO pin. If it is necessary to place the GPIO output buffer in a
high-impedance state, the GPIO pin must be configured as an input pin
(DIRn = 0). At reset, GPIO pins default to input mode.
Legend: R = Read only; R/W = Read/Write; -n = value after reset
DIR6DIR5DIR4DIR3DIR2DIR1DIR0
Table 4.Direction Register (DIR) Field Descriptions
BitFieldValueDescription
31−16 Reserved0Reserved. The reserved bit location is always read as 0. A value written to
this field has no effect.
15−0DIRnControls the direction of the GPn pin.
0GPn pin configured as output pin
1GPn pin configured as input pin
17General-Purpose Input/Output (GPIO)SPRU724
Registers
5.3Output Data Register (OUT_DATA)
The GPIO output data register (OUT_DATA) indicates the value to be driven
on a given GPIO output pin. The OUT_DA TA registers are shown in Figure 5
and described in Table 5.
Figure 5.Output Data Register (OUT_DATA)
3116
Reserved
R-0
15141312111098
OUT15
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
76543210
OUT7OUT6OUT5OUT4OUT3OUT2OUT1OUT0
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Legend: R = Read only; R/W = Read/Write; -n = value after reset
OUT14OUT13OUT12OUT11OUT10OUT9OUT8
Table 5.Output Data Register (OUT_DATA) Field Descriptions
BitFieldValueDescription
31−16 Reserved0Reserved. The reserved bit location is always read as 0. A value written to
this field has no effect.
15−0OUTnControls the drive state of the corresponding GPn pin. These bits do not
affect the state of the pin when the pin is configured as an input. Reading
these bits returns the value of this register, not the state of the pin.
General-Purpose Input/Output (GPIO)18SPRU724
Registers
5.4Set Data Register (SET_DATA)
The GPIO set data register (SET_DATA) is shown in Figure 6 and described
in Table 6. SET_DATA provides an alternate means of driving GPIO outputs
high. Writing a 1 to a bit of SET_DATA sets the corresponding bit in
OUT_DATA. Writing a 0 has no effect. Reading SET_DATA returns the
contents of OUT_DATA.
Figure 6.Set Data Register (SET_DATA)
3116
Reserved
R-0
15141312111098
SET15SET14SET13SET12SET11SET10SET9SET8
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
76543210
SET7SET6SET5SET4SET3SET2SET1SET0
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Legend: R = Read only; R/W = Read/Write; -n = value after reset
Table 6.Set Data Register (SET_DATA) Field Descriptions
BitFieldValueDescription
31−16 Reserved0Reserved. The reserved bit location is always read as 0. A value written to
this field has no effect.
15−0SETnWriting 1 sets the corresponding bit the OUT_DATA register. Reading this
register returns the contents of the OUT_DATA register. Writing a 0 has no
effect.
0No effect
1Sets the corresponding bit in OUT_DATA
19General-Purpose Input/Output (GPIO)SPRU724
Registers
5.5Clear Data Register (CLR_DATA)
The GPIO clear data register (CLR_DATA) is shown in Figure 7 and described
in Table 7. CLR_DATA provides an alternate means of driving GPIO outputs
low. Writing a 1 to a bit of CLR_DATA clears the corresponding bit in
OUT_DATA. Writing a 0 has no effect. Reading CLR_DATA returns the
contents of OUT_DATA.
Figure 7.Clear Data Register (CLR_DATA)
3116
Reserved
R-0
15141312111098
CLR15CLR14CLR13CLR12CLR11CLR10CLR9CLR8
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
76543210
CLR7CLR6CLR5CLR4CLR3CLR2CLR1CLR0
R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0R/W-0
Legend: R = Read only; R/W = Read/Write; -n = value after reset
Table 7.Clear Data Register (CLR_DATA) Field Descriptions
BitFieldValueDescription
31−16 Reserved0Reserved. The reserved bit location is always read as 0. A value written to
this field has no effect.
15−0CLRnWriting 1 clears the corresponding bit the OUT_DATA register. Reading this
register returns the contents of the OUT_DATA register. Writing a 0 has no
effect.
0No effect
1Clears the corresponding bit in OUT_DATA
General-Purpose Input/Output (GPIO)20SPRU724
Registers
5.6Input Data Register (IN_DATA)
The GPIO input data register (IN_DATA) reflects the state of the GPIO pins.
The IN_DATA register is shown in Figure 8 and described in Table 8. When
read, IN_DATA returns the state of the GPIO pins regardless of the state of the
corresponding bits in the DIR and OUT_DATA registers.
The GPIO rising trigger register (RIS_TRIG) configures the edge detection
logic to trigger GPIO interrupts and EDMA events on the rising edge of GPIO
signals. Setting a bit to 1 in RIS_TRIG causes the corresponding GPIO
interrupt and EDMA event (GPINTn) to be generated on the rising edge of
GPn. RIS_TRIG is not directly accessible by the CPU; it must be configured
using the GPIO set rising trigger and clear rising trigger registers.
The GPIO set rising trigger register (SET_RIS_TRIG) is shown in Figure 9 and
described in Table 9. Writing a 1 to a bit of SET_RIS_TRIG sets the
corresponding bit in RIS_TRIG. Writing a 0 has no effect. Reading
SET_RIS_TRIG returns the value in RIS_TRIG.
The GPIO rising trigger register (RIS_TRIG) configures the edge detection
logic to trigger GPIO interrupts and EDMA events on the rising edge of GPIO
signals. Setting a bit to 1 in RIS_TRIG causes the corresponding GPIO
interrupt and EDMA event (GPINTn) to be generated on the rising edge of
GPn. RIS_TRIG is not directly accessible by the CPU; it must be configured
using the GPIO set rising trigger and clear rising trigger registers.
The GPIO clear rising trigger register (CLR_RIS_TRIG) is shown in Figure 10
and described in Table 10. Writing a 1 to a bit of CLR_RIS_TRIG clears the
corresponding bit in RIS_TRIG. Writing a 0 has no effect. Reading
CLR_RIS_TRIG returns the value in RIS_TRIG.
The GPIO falling trigger register (FAL_TRIG) configures the edge detection
logic to trigger GPIO interrupts and EDMA events on the falling edge of GPIO
signals. Setting a bit to 1 in FAL_TRIG causes the corresponding GPIO
interrupt and EDMA event (GPINTn) to be generated on the falling edge of
GPn. FAL_TRIG is not directly accessible by the CPU; it must be configured
using the GPIO set falling trigger and clear falling trigger registers.
The GPIO set falling trigger register (SET_FAL_TRIG) is shown in Figure 11
and described in Table 11. Writing a 1 to a bit of SET_FAL_TRIG sets the
corresponding bit in FAL_TRIG. Writing a 0 has no effect. Reading
SET_FAL_TRIG returns the value in FAL_TRIG.
The GPIO falling trigger register (FAL_TRIG) configures the edge detection
logic to trigger GPIO interrupts and EDMA events on the falling edge of GPIO
signals. Setting a bit to 1 in FAL_TRIG causes the corresponding GPIO
interrupt and EDMA event (GPINTn) to be generated on the falling edge of
GPn. FAL_TRIG is not directly accessible by the CPU; it must be configured
using the GPIO set falling trigger and clear falling trigger registers.
The GPIO clear falling trigger register (CLR_FAL_TRIG) is shown in Figure 11
and described in Table 11. Writing a 1 to a bit of CLR_FAL_TRIG clears the
corresponding bit in FAL_TRIG. Writing a 0 has no effect. Reading
CLR_FAL_TRIG returns the value in FAL_TRIG.