NuMicro® NUC029LEE/NUC029SEE
32-bit Arm
®
Cortex
®
-M0 Microcontroller
Aug, 2018
Page
198
of
497
Rev 1.00
N
U
MICRO
®
N
UC02
9L
E
E
/N
UC029
S
E
E
T
E
CHN
ICA
L R
E
F
E
R
E
NC
E
M
A
NU
A
L
Configure the channel service setting by setting PDMA_PDSSR0/ PDMA_PDSSR1
register.
Configure PDMA_CSRx register:
-
Enable PDMA channel(PDMACEN (PDMA_CSRx[0]))
-
Set source/destination address direction(SAD_SEL (PDMA_CSRx[5:4]) /
DAD_SEL (PDMA_CSRx[7:6]))
-
Configure PDMA mode selection(MODE_SEL (PDMA_CSRx[3:2]))
-
Configure peripheral transfer width selection (APB_TWS (PDMA_CSRx[20:19])).
Configure source/destination address by setting PDMA_SARx/PDMA_DARx registers.
Configure PDMA_transfer byte count by setting PDMA_BCRx register.
Enable PDMA block transfer done interrupt by setting BLKD_IE(PDMA_IERx [1]).
(optional)
Enable PDMA NVIC by setting NVIC_ISER register bit 26 to
“
1”. (optional)
Enable PDMA read/write transfer by setting TRIG_EN (PDMA_CSRx[23]) bit.
If PDMA block transfer done interrupt is generated, write
“
1” to BLKD_IF
(PDMA_ISRx[1])by software to clear interrupt flag.
Enable PDMA read/write transfer by setting the TRIG_EN (PDMA_CSRx[23])bit for
the next block transfer.
If an error occurs during the PDMA operation, the channel stops unless software clears the error
condition and sets the SW_RST (PDMA_CSRx[1])to reset the PDMA channel and set PDMACEN
(PDMA_CSRx[0])and TRIG_EN (PDMA_CSRx[23]) bits field to start again.
In PDMA (Peripheral-to-Memory or Memory-to-Peripheral) mode, DMA can transfer data between
the Peripherals (e.g. UART, SPI, ADC) and Memory.
6.7.5.2 CRC
The DMA controller contains a cyclic redundancy check (CRC) generator that can perform CRC
calculation with programmable polynomial settings. The operation polynomial includes CRC-
CCITT, CRC-8, CRC-16 and CRC-32; Software can choose the CRC operation polynomial mode
by setting CRC polynomial mode (CRC_MODE (CRC_CTL[31:30])).
The CRC engine supports CPU PIO mode if CRC channel enable bit CRCCEN (CRC_CLT[0]) is
1, CRC DMA trigger enable bit TRIG_EN (CRC_CTL[23]) is 0 and DMA transfer mode if CRC
channel enable bit CRCCEN (CRC_CLT[0]) is 1, CRC DMA trigger enable bit TRIG_EN
(CRC_CTL[23]) is 1. The following sequence is a program sequence example.
Procedure when operating in CPU PIO mode:
Enable CRC engine by setting CRC channel enable bit CRCCEN (CRC_CLT[0]) to 1.
Set the transfer data format to enable write data order reverse (WDATA_RVS
(CRC_CTL[24])), checksum reverse (CHECKSUM_RVS (CRC_CTL[25])), write data
1’s complement (WDATA_COM (CRC_CTL[26])), checksum 1’s complement
(CHECKSUM_COM (CRC_CTL[27])), initial seed value in CRC seed register
(CRC_SEED (CRC_SEED[31:0])) and select write data length by setting CPU write
data length (CPU_WDLEN (CRC_CTL[29:28])).
Set the CRC engine reset bit CRC_RST (CRC_CTL[1]) to 1 to load the initial seed
value to CRC circuit but others contents of CRT_CTL register will not be cleared. This
bit will be cleared automatically.