Configuring GPIO EDMA Events
IntroductionMost TI devices with a 64x+ or 674x processor core use the same GPIO module.
Devices with this module (as of May 22, 2009):
This article is intended to give detailed instructions on how to generate EDMA events when using this GPIO module. Note that this article is not intended as a tutorial for programming the EDMA. Following the steps in this article would result in an EDMA event being latched in the Event Register (ER/ERH) of the EDMA peripheral. The proper handling of that event would be covered by documentation relevant to EDMA.
Device Level Configuration
- Make sure that pins you want configured as GPIO are configured in the device-wide pin-muxing registers to be GPIO function and not some other peripheral function.
- For example, in C6424 this would be done in the registers PINMUX0 and PINMUX1 as described in the C6424 datasheet.
Power, Reset, Clock
- These devices have a module called the Power and Sleep Controller (PSC) that controls power, reset, and clock to all the peripherals. Make sure the peripheral is powered and in an "enabled" state, i.e. peripheral clock enabled and peripheral out of reset.
- Generally the gel file corresponding to a given device will turn on all peripheral domains when you connect to the device with the emulator. When transitioning from development to production this duty would shift from the gel file to the bootloader.
- Configure the GPIO pin as an input by writing 0 to its respective bit in the DIRxy register.
- Enable a rising edge and/or falling edge EDMA event by writing to the appropriate bit in the SET_RIS_TRIGxy/SET_FAL_TRIGxy register.
- Enable the EDMA event by writing to BINTEN.ENn where n is the bank number. Note: This step must be performed regardless of whether you're planning to ultimately use a "direct" event (GPINTx) or the "bank" event (GPBNKINTy). The ENn bit gates all events from the GPIO module.
You should consult your device-specific EDMA User's Guide for information on this peripheral at the hardware level. For programming examples you can refer to an article Programming the EDMA3 using the Low-Level Driver (LLD) or for a register-level programming example you can refer to Programming EDMA without EDMA3LLD package. The focus of this article is only generating the proper event to the EDMA, not configuration of the EDMA nor the EDMA interrupt itself.
Avoiding Double EDMA Events
On some devices bank 0 has the capability of generating EDMA events for some of the individual GPIO pins as well as a shared event for the whole bank (as in this diagram). For devices like DM355 that have both direct events and a shared bank event associated with bank 0 you should use either direct events only or the shared bank 0 event. Using both will cause two EDMA events to be generated from one edge on a GPIO pin! This topic describes that scenario in much more detail. Although the wording focuses on interrupts, the same is true of EDMA events since the exact same signals are tied to both the interrupt controller and the EDMA.
Generally this sort of thing is not an issue as the "bank event" is not commonly used for generating an EDMA transfer. Typically one would only ever use the "direct" events to generate an EDMA transfer. Put another way, generally you would not want initiate a transfer based on an edge occurring on any pin within a given bank. Instead you want the transfer to occur due to a specific pin toggling.