From page 438 in annotated K20P64M72SF1RM manual (MK20DX128 processor used on Teensy 3.1/3.2).
21.5.1 eDMA initialization
To initialize the eDMA:
- Write to the
CR
if a configuration other than the default is desired.
- e.g., set arbitration scheme to round-robin or fixed-priority.
- Write the channel priority levels to the
DCHPRIn
registers if a configuration other than the default is desired.- Enable error interrupts in the
EEI
register if so desired.- Write the 32-byte TCD for each channel that may request service.
- Enable any hardware service requests via the ERQ register.
- Request channel service via either:
- Software: setting the
TCDn_CSR[START]
- Hardware: slave device asserting its eDMA peripheral request signal
After any channel requests service, a channel is selected for execution based on the arbitration and priority levels written into the programmer's model. The eDMA engine reads the entire TCD, including the TCD control and status fields, as shown in the following table, for the selected channel into its internal address path module. As the TCD is read, the first transfer is initiated on the internal bus, unless a configuration error is detected. Transfers from the source, as defined by
TCDn_SADDR
, to the destination, as defined byTCDn_DADDR
, continue until the number of bytes specified byTCDn_NBYTES
are transferred.When the transfer is complete:
- The eDMA engine's local
TCDn_SADDR
,TCDn_DADDR
, andTCDn_CITER
are written back to the main TCD memory- Any minor loop channel linking is performed, if enabled
If the major loop is exhausted, further post processing executes, such as interrupts, major loop channel linking, and scatter/gather operations, if enabled.
DMA_ERQ
)SERQ
(Set Enable ReEquest) and CERQ
(Clear Enable ReEquest) registers provide memory mapped convenience
interfaces for setting a bit for a channel without having to read-modify-write the entire DMA_ERQ
.SERQ
and 8-bit CERQ
register for each DMA channel.NOP
bit to "skip" a spanned register where necessary.16 bytes from source with byte wide port to destination with 32-bit port (i.e., 4 bytes).
See page 441 in annotated K20P64M72SF1RM manual (MK20DX128 processor used on Teensy 3.1/3.2).
Page 656
ADLPC
: Low-power configurationADIV
: 2 bits, Clock divide selectADLSMP
: Sample time configurationMODE
: 2 bits, Conversion mode selectionADICLK
: 2 bits, Input clock selectPage 661.
ADACT
: Conversion activeADTRG
: Conversion trigger selectACFE
: Compare Function EnableACFGT
: Compare function greater than enableACREN
: Compare function range enableDMAEN
: DMA enableSC1n[COCO]
flags is asserted.REFSEL
: 2 bits, Voltage reference selection