receiving data from uart Dma not working

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

receiving data from uart Dma not working

802 次查看
KKS123
Contributor I

Hai , 

 

I was unable to receive data from Uart Dma (like peripheral to memory configuration) and please check my code ...I'm using Km34 controller and IAR ide...

Can anyone help me on this?

void dma_Initialization(void) { //Enable clock for DMAMUX and DMA SIM_SCGC6 |= SIM_SCGC6_DMACHMUX_MASK; SIM_SCGC7 |= SIM_SCGC7_DMA_MASK; //config DMA MUX for UART3 //DISABLE DMA MUX channel first DMAMUX_CHCFG0 = 0x00; // Clear pending errors and/or done bit CE- config error ,BES -bus error on source ,BED - bus error on destination if(((DMA_DSR_BCR0 & DMA_DSR_BCR_DONE_MASK) == DMA_DSR_BCR_DONE_MASK ) |((DMA_DSR_BCR0 & DMA_DSR_BCR_BES_MASK ) == DMA_DSR_BCR_BES_MASK) |((DMA_DSR_BCR0 & DMA_DSR_BCR_BED_MASK ) == DMA_DSR_BCR_BED_MASK) |((DMA_DSR_BCR0 & DMA_DSR_BCR_CE_MASK ) == DMA_DSR_BCR_CE_MASK)) DMA_DSR_BCR0 |= DMA_DSR_BCR_DONE_MASK; //set source Address (this is the UART3_D register) DMA_SAR0 = (uint32)&UART3_D; //set BCR to know how many bytes to transfer // DMA_DSR_BCR0 = DMA_DSR_BCR(4); //gk DMA_DSR_BCR0 = DMA_DSR_BCR_BCR(4); //clear source and destination size fields DMA_DCR0 &= ~(DMA_DCR_SSIZE_MASK | DMA_DCR_DSIZE_MASK ); //set DMA DMA_DCR0 |= (DMA_DCR_EINT_MASK //Interrupt enable on completion of transfer | DMA_DCR_ERQ_MASK //enable peripheral request | DMA_DCR_CS_MASK //single read/write per request | DMA_DCR_EADREQ_MASK //enable Async. DMA request | DMA_DCR_DINC_MASK //destination address increments | DMA_DCR_SSIZE(1) //Source size is 8-bit | DMA_DCR_DSIZE(1) //destination size is 8-bit | DMA_DCR_DMOD(2) //32-bit circular buffer enabled | DMA_DCR_D_REQ_MASK //DMA request is cleared ); //Set destination address DMA_DAR0 =(uint32)0x20000400; //enable the DMA channel0 and select the DMA channel source = UART3 RECEIVE DMAMUX_CHCFG0 |= DMAMUX_CHCFG_ENBL_MASK | DMAMUX_CHCFG_SOURCE(8);

0 项奖励
回复
1 回复

778 次查看
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

There are different variations of SDK examples uart_dma_transfer with the twrkm34z75m that you can take as reference:

_Leo__0-1707338600111.png

Hope it helps you.

Have a nice day!

0 项奖励
回复