Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21942

CCS/MSP430F1611: Using DMA for Uart to transmit data

$
0
0

Part Number:MSP430F1611

Tool/software: Code Composer Studio

I am changing some code to use DMA on UART Tx.  I have been able to get data to the buffer for the first transfer but there is no data coming out and the process does not seem to go beyond the first byte.  I have set up the UART like so:

   P3SEL |= BIT4 + BIT5; set up port 3 pins for UART0 operation.

   U0CTL = SWRST + CHAR;   // hold UART in reset, UART, 8N1
   U0TCTL |= (SSEL0 + SSEL1);    //SMCLK clock src
   U0RCTL = 0;    //clear flags
   U0MCTL = 0x00;    // set baud rate
   U0BR0  = 0x20;    //
   U0BR1  = 0x00;    // BR0=20H for 230400
    ME1 = UTXE0;  //rcv is not enabled during transmit (half duplex)
    U0CTL &= ~SWRST;    // release the UART state machine

When the DMA is run is is done like this:

   DMA2SZ = size;
   DMACTL0 |= DMA2TSEL_4;   //Txbuffer flag trigger for DMA2
   DMA2SA = (unsigned int) data;
   DMA2DA = (unsigned int) U0TXBUF;
   // DMA source increment, byte to byte transfer, single byte transfer (repeated), level sensitive, int enabled

DMA2CTL = DMASRCINCR_3 + DMASBDB + DMADT_4 + DMALEVEL + DMAIE + DMAEN; //run the DMA

In debug it looks like everything is set up as expected and stepping the last line shows that the UTXIFG0 flag goes to zero meaning a byte has been put into the buffer.

Allowing the code to continue nothing appears at the Tx port.  I can also see that the pin that controls the 485 driver direction is also being set to transmit (not shown in the code snippit).

I also have a brake point set in the interrupt routine for the DMA and the break point is never hit.  I have also tried using a separate step to enable the DMA but did not see any change.

I think I am missing something very simple but I am at a loss to figure out what.

 


Viewing all articles
Browse latest Browse all 21942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>