AnsweredAssumed Answered

uart dma lpc54

Question asked by Luca N on Apr 5, 2019
Latest reply on Apr 22, 2019 by Alice_Yang

I'm trying to set up the DMA to automatically transfer the data received by UART1 on a memory buffer. The processor is the LPC54102. Here is the code I'm using to set up the UART and the DMA.

 

Does anyone have any idea on what's wrong or missing here?

 

Thanks!

 

 

Chip_UART_Disable(LPC_USART1);

Chip_IOCON_PinMux(LPC_IOCON, 0, 5, IOCON_MODE_INACT | IOCON_DIGITAL_EN, IOCON_FUNC1);

Chip_IOCON_PinMux(LPC_IOCON, 0, 6, IOCON_MODE_INACT | IOCON_DIGITAL_EN, IOCON_FUNC1);

Chip_UART_special_SetBaud(GPS_USART, 115200);

 

usart_config = ( UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1 );
Chip_UART_ConfigData(LPC_USART1, usart_config);
Chip_UART_TXEnable(LPC_USART1);


Chip_DMA_DeInit(LPC_DMA);
Chip_DMA_Init(LPC_DMA);
Chip_DMA_Disable(LPC_DMA);
Chip_DMA_Enable(LPC_DMA);

 

Chip_DMA_DisableChannel(LPC_DMA, DMAREQ_UART1_RX);
Chip_DMA_ClearErrorIntChannel(LPC_DMA, DMAREQ_UART1_RX);30

 

tDmaUartRxDesc.source = DMA_ADDR(&LPC_USART1->RXDAT);
tDmaUartRxDesc.dest = DMA_ADDR(pabDataBuffer );
tDmaUartRxDesc.next = DMA_ADDR(0);
tDmaUartRxDesc.xfercfg = DMA_XFERCFG_CFGVALID |
                                            DMA_XFERCFG_SETINTA |
                                            DMA_XFERCFG_WIDTH_8 |
                                            DMA_XFERCFG_SRCINC_0 |
                                            DMA_XFERCFG_DSTINC_1 |
                                            DMA_XFERCFG_XFERCOUNT(230); 

 

while (!Chip_DMA_SetupTranChannel(LPC_DMA, DMAREQ_UART1_RX, &tDmaUartRxDesc)) {}
Chip_DMA_SetupChannelTransfer(LPC_DMA, DMAREQ_UART1_RX, tDmaUartRxDesc.xfercfg);

Chip_DMA_SetupChannelConfig(LPC_DMA, DMAREQ_UART1_RX, (DMA_CFG_PERIPHREQEN | DMA_CFG_TRIGBURST_SNGL | DMA_CFG_CHPRIORITY(0)));
Chip_DMA_EnableIntChannel(LPC_DMA, DMAREQ_UART1_RX);

NVIC_EnableIRQ(DMA_IRQn);

Chip_DMA_EnableChannel(LPC_DMA, DMAREQ_UART1_RX);

Chip_UART_Enable(LPC_USART1);

Outcomes