Analog Devices ADuCM310 Hardware Reference Manual page 151

Table of Contents

Advertisement

ADuCM310 Hardware Reference Manual
Example Code to Set Up UART Transmit DMA Channel
void UARTTXDMAINIT(void)
{
NVIC_EnableIRQ(DMA_UART_TX_IRQn);
pADI_UART->COMLCR = COMLCR_WLS_8BITS + COMLCR_STOP;
pADI_UART->COMDIV = 0x41;
pADI_UART->COMFBR = COMFBR_FBEN_EN | 0x803;
pADI_GP1->GPCON = 0x5;
Dma_Init();
pADI_DMA->DMACFG = 0x1;
UARTDMAWRITE(uxUARTTXData, 16);
pADI_DMA->DMAENSET = 0x10;
pADI_UART->COMIEN = 0x10;
}
void UARTDMAWRITE(unsigned char *pucTX_DMA, unsigned int iNumVals)
{
DmaDesc Desc;
// Common configuration of all the descriptors used here
Desc.ctrlCfg.Bits.cycle_ctrl
Desc.ctrlCfg.Bits.next_useburst
Desc.ctrlCfg.Bits.r_power
Desc.ctrlCfg.Bits.src_prot_ctrl
Desc.ctrlCfg.Bits.dst_prot_ctrl
Desc.ctrlCfg.Bits.src_size
Desc.ctrlCfg.Bits.dst_size
Desc.srcEndPtr
Desc.destEndPtr
Desc.ctrlCfg.Bits.n_minus_1
Desc.ctrlCfg.Bits.src_inc
Desc.ctrlCfg.Bits.dst_inc
*Dma_GetDescriptor(UARTTX_C) = Desc;
}
void DMA_UART_TX_Int_Handler()
{
NVIC_DisableIRQ(DMA_UART_TX_IRQn);
}
= DMA_BASIC;
= 0x0;
= 0;
= 0x0;
= 0x0;
= DMA_SIZE_BYTE;
= DMA_SIZE_BYTE;
//
TX Primary
= (unsigned int)(pucTX_DMA + (iNumVals - 0x1) );
= (unsigned int)(&pADI_UART->COMTX);
= iNumRX - 0x1;
= DMA_SRCINC_BYTE;
= DMA_DSTINC_NO;
// UART DMA Tx IRQ handler
Rev. C | Page 151 of 192
// UART Tx DMA interrupt sources
// 8-data bits + 1 Stop bit.
// Set UART Baud rate
// DIVM = 1, DIVN = 3.
// Configure P1.0/P1.1 for UART
// Enable DMA mode in DMA controller
// Enable UART_TX_DMA Channel
// Enable DMA Tx transfers
Descriptor
// Clear Interrupt source
UG-549

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ADuCM310 and is the answer not in the manual?

This manual is also suitable for:

Aducm310bbczAducm310bbcz-rl

Table of Contents