Initialization and Configuration
618
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Micro Direct Memory Access (µDMA)
Table 8-11. Channel Control Word Configuration for Peripheral Ping-Pong Receive
Example (continued)
Field in DMACHCTL
Bits
Value
Description
XFERSIZE
13:4
63
Transfer 64 items
NXTUSEBURST
3
0
N/A for this transfer type
XFERMODE
2:0
3
Use Ping-Pong transfer mode
NOTE:
In this example, it is not important if the peripheral makes a single request or a burst request.
Because the peripheral has a FIFO that triggers at a level of 8, the arbitration size is set to 8.
If the peripheral does make a burst request, then 8 bytes are transferred, which is what the
FIFO can accommodate. If the peripheral makes a single request (if there is any data in the
FIFO), then one byte is transferred at a time. If it is important to the application that transfers
only be made in bursts, then the Channel Useburst SET[8] bit should be set in the DMA
Channel Useburst Set (DMAUSEBURSTSET) register.
8.4.4.3
Configure the Peripheral Interrupt
An interrupt handler should be configured when using ping-pong mode. However, ping-pong mode can be
configured without interrupts by polling. The interrupt handler is triggered after each buffer is complete.
1. Configure and enable an interrupt handler for the peripheral.
8.4.4.4
Enable the µDMA Channel
Now the channel is configured and is ready to start.
1. Enable the channel by setting bit 8 of the DMA Channel Enable Set (DMAENASET) register.
8.4.4.5
Process Interrupts
The µDMA controller is now configured and enabled for transfer on channel 8. When the peripheral
asserts the µDMA request signal, the µDMA controller makes transfers into buffer A using the primary
channel control structure. When the primary transfer to buffer A is complete, it switches to the alternate
channel control structure and makes transfers into buffer B. At the same time, the primary channel control
word mode field is configured to indicate Stopped, and an interrupt is generated in the peripheral's raw
interrupt status register.
When an interrupt is triggered, the interrupt handler must determine which buffer is complete and process
the data or set a flag that the data must be processed by non-interrupt buffer processing code. Then the
next buffer transfer must be set up.
In the interrupt handler:
1. Read the primary channel control word at offset 0x088 and check the XFERMODE field. If the field is
0, this means buffer A is complete. If buffer A is complete, then:
1. Process the newly received data in buffer A or signal the buffer processing code that buffer A has
data available.
2. Reprogram the primary channel control word at offset 0x88 according to
.
2. Read the alternate channel control word at offset 0x288 and check the XFERMODE field. If the field is
0, this means buffer B is complete. If buffer B is complete, then:
1. Process the newly received data in buffer B or signal the buffer processing code that buffer B has
data available.
2. Reprogram the alternate channel control word at offset 0x288 according to
8.4.5 Configuring Channel Assignments
Channel assignments for each µDMA channel can be changed using the DMACHMAPn registers. Each 4-
bit field represents a µDMA channel. For channel assignments, see the device-specific data sheet.