1

I am working on MSP430 Series Controller and I have a buffer to be sent on UART via DMA.

I am pasting my DMA configuration and Code snippet for more information.

DMACTL0 = DMA0TSEL__UCA0TXIFG;
DMA0SA  = &buff;
DMA0DA  = &UCA0TXBUF; 
DMA0SZ  = 64;                      // Block size in bytes
DMA0CTL = DMADT_1 | DMASBDB| DMASRCINCR_1 | DMAIE| DMALEVEL_L; // Rpt, inc
DMA0CTL|= DMAEN;

I am filling data as below.

   char buff[64];
   buff[0] = 0x64;
   buff[1] = 0x23;
   buff[2] = 0x65;
   buff[3] = 0x31;

When I initiate DMA transfer , The buffer got transfer but When I check on terminal , Its shows only the first value '0x64', Not other value.I am doing block transfer , so whole block should be transfered when dma initiated. And in Interrupt routing i am reseting the dma flag.

My interrupt Handler.

 __interrupt void DMA_VECTOR_ISR(void)
 {
     DMA0CTL &= ~DMAIFG;
     DMA_Doneflag = 1;
 }

this DMA_Doneflag I have took as boolean volatile and that is reset when tx is done.

evaet1
  • 41
  • 10

1 Answers1

1

A block transfer indeed copies the whole block; it is the equivalent of the following:

while (!(UCA0IFG & UCTXIFG)) {}  // wait for trigger
for (i = 0; i < 64; i++)
    UCA0TXBUF = buf[i];

This is not what you actually want. You need to wait for the trigger before each single byte:

for (i = 0; i < 64; i++) {
    while (!(UCA0IFG & UCTXIFG)) {}
    UCA0TXBUF = buf[i];
}

This can be done with the repeated single transfer mode (DMADT_4).

And you need DMASRCINCR_3 to actually go through the buffer.

CL.
  • 173,858
  • 17
  • 217
  • 259
  • Hi @CL. , Thanks for your Reply, Yes I have tried that bit, and 4 bytes that I have assigned in buffer is going but, After the size is transferred , It stops, And I want to have transfer Continuously Running, can you please guide me into this. – evaet1 Jan 23 '16 at 18:42
  • Are you aware of what you wrote in the last sentence of your question? – CL. Jan 23 '16 at 21:32
  • let me clear please, with the change you have suggested, is working fine. But on terminal I can only see the first byte of buffer repeatedly coming. The other data in buffer is not transmitted. For that I have tried with `DMASRCINCR_3` (source inc.) but, after some time the transfer gets stopped. Than again I have to reset controller to begin transfer. in my dma isr I am doing `DMA0CTL &= ~DMAIFG ` (inverting flag after trigger). am i mistaking here? – evaet1 Jan 24 '16 at 08:05
  • Edit your question to show the interrupt handler. And specify "some time". – CL. Jan 24 '16 at 08:11
  • "some time" is like after 7 or 8 transfer it stops. – evaet1 Jan 24 '16 at 08:29
  • Hi, I have Handled the transfer but I have had another problem. The transfer is happen on every time interrupt of 1s. And total of data transferred is of 2.4kB. But When I check on receiving end (on linux soc) I sometimes not getting as per size I have mentioned ( i.e 600 x4 buff) for every buffer. Instead I get correct size 4 to 5 times when i do transfer 20 times. The dma code remained same. Please tell me if more info required for solution. – evaet1 Feb 13 '16 at 07:56
  • can you comment on this :@CL. – evaet1 Feb 13 '16 at 14:50
  • To ask a question, use the "Ask Question" button. – CL. Feb 13 '16 at 15:32
  • HI @CL. Thank you comment., I have added question on below link, [link](http://stackoverflow.com/questions/35384704/facing-difficulties-in-data-transfer-over-uart-with-dma-on-msp430) – evaet1 Feb 13 '16 at 20:02