This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I am using MSP430F6438.In this i am try send data to uart using DMA. In this case for single transfer DMADT_0 all bytes are sent properly, but if i am using Repeated single transfer DMADT_4 means first time all bytes comes properly, next time bytes are misaligned, and also if i am using block transfer mode DMADT_1 only first byte sent. Can any ome help me.
DMA2CTL &= ~DMAEN;
DMACTL1 = DMA2TSEL_21;
DMA2CTL |= DMADT_1; //DMADT_4
DMA2CTL |= DMASRCINCR_3;
DMA2CTL |= DMASBDB;
DMA2SZ = buf_ptr->szBuf;
DMA2SA = (uint32_t)buf_ptr->txrxbuf_ptr;
DMA2DA = (uint32_t)&uartRegister1->txbuf;
DMA2CTL |= DMAIE;
DMA2CTL &= ~DMAIFG;
DMA2CTL |= DMAEN;
//uartRegister1->txbuf = *(buf_ptr->txrxbuf_ptr);
uartRegister1->intrflag &= ~(0x02);
uartRegister1->intrflag |= 0x02;
Thanks in advance
You should first clear DMAIFG and then set DMAIE, else you might get an interrupt right between the two instructions.
Block mode means one trigger, many transfers. So when TXIFG gets set, the DMA will stuff szBuf bytes to txbuf as fast as possible (and only the last and maybe – depending on MCLK/baudrate ratio - the first get sent)
How do you handle the DMA interrupt? Maybe you’re superfluously do a manual trigger there (like the one you did to initially start the transfer). Which would ‘swallow’ one byte.
The peripherals will (usually) do what you tell them to do, not what you want them to do. J
You described what you want, but only the code shows what you actually told the peripheral to do.
**Attention** This is a public forum