PIC32MK encounters problems in UART data transmission and reception using DMA[Copy link]
I have configured DMA and UART. There is no problem in sending and receiving in non-DMA mode, and both TX and RX interrupts can be entered. Later, I changed to DMA mode and there was no response. The following is my configuration code and data sending code. Masters, please help me. The following is the code part for configuring UARTU1MODEbits.PDSEL = 0; //8-bit data, no parity checkU1MODEbits.STSEL = 0; //One stop bitU1MODEbits.UEN = 0; U1STAbits.URXEN = 0; //Receiver enableU1STAbits.UTXEN = 0; //Transmitter enableU1STAbits.UTXISEL = 1; U1STAbits.URXISEL = 0; U1STAbits.UTXINV = 0; U1STAbits.UTXBRK = 0; U1MODEbits.BRGH = 1; //High-speed modeU1BRG = 14; //Baud rate 2000000 U1MODEbits.ON = 1; The following is the data transmission code for(i=0;i<8;i++) { Tx_Data[i] = i; } DCH0SSIZ = 8; DCH0SSA = &Tx_Data[0]; DCH0DSIZ = 8; DCH0DSA = &U1TXREG; DCH0CSIZ = 8; DCH0ECONbits.CHSIRQ = 40; DCH0CONbits.CHEN = 1; // Enable CH0 DCH0ECONbits.CFORCE = 1; // Force DMA
I found the problem. It was the source size and the target size. I haven't had time to finish the post. I hope the problem I encountered is useful to you.