![Maxim Integrated MAX32660 User Manual Download Page 75](http://html1.mh-extra.com/html/maxim-integrated/max32660/max32660_user-manual_1744484075.webp)
MAX32660 User Guide
Maxim Integrated
Page 75 of 195
To configure a channel for buffer chaining, initialize the following registers:
•
•
•
•
•
•
•
When the
register is written, the
.rlden
bit must not be set. In addition, any writes to the
register prior to initialization must not set the
.chen
and
.rlden
bits. After all registers are
initialized, the last operation involves writing to the
.chen
and
.rlden
bits. This starts the DMA.
Set the
.ctzien
bit in the register to receive an interrupt after each buffer is accessed. In addition, set the
.chdien
bit to provide an interrupt in case of a bus error.
Caution
.rlden bits separately risks a race condition. The condition occurs
between a DMA completion interrupt service routine initializing the reload registers for the third buffer before the software
initialization of these registers for the second buffer.
When the first DMA transfer completes (based on the
.cnt
bit value), a CTZ interrupt occurs, and the
registers are reloaded from the corresponding reload registers.
register indicates that the reload and CTZ events occurred. In this case,
.ch_st =
1 indicating
that the DMA is now busy with the second DMA transfer defined in the reload registers. If
.ch_st =
0, then the
initial and second DMA transfers have completed. If there are additional buffers to chain, the interrupt service routine
initializes the
.rlden
bit. The
interrupt service routine does not write to the
registers, just the
reload registers.
To prevent improper operation, program the address bits before setting the
.chen
and
.rlden
bits.
7.8
DMA Interrupts
Enable interrupts for each channel by setting
.chien.
When an interrupt is pending, the corresponding
.ipend =
.ipend
field is read-only, to clear the interrupt use the
register and
write a 1 to the field that indicates the cause of the interrupt.
A channel interrupt (
ipend =
1) is caused by:
1.
.ctzien
= 1
a.
If enabled, all CTZ occurrences set the
ipend
bit.
2.
.chdien
= 1
a.
If enabled, any clearing of the
.ch_st
.ipend
register to determine which reason caused the disable. The
.chdien
bit also enables the
.to_st
bit. The
.to_st
.ch_st
bit.
To clear the channel interrupt, write 1 to the cause of the interrupt (the
.ctz_st,
.rld_st,
.bus_err,
or
.to_st
bits).