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.

CC251x: Using USART by DMA problem, last character corrupted



Dear Forum, I trying to use DMA for USART transmission which basically works. But when I start a 2nd USART DMA right after the 1st DMA completion interrupt occurs the last character(s) from the 1st DMA are not transmitted. It seems that the 2nd DMA disturbs the end of the 1st one. I had a look to the timings by oscilloscope: When the DMA completion interrupts occurs I found that up to two more characters are output by USART. This is probably the problem! I know that the USART output register is double buffered and expected that one character is still output when the DMA interrupts happens, but why two?? The DMA interrupts is describes in the manual that it is generated when the last byte is transferred. Do I have to wait for some special flags after the 1st DMA interrupts occurs to be safe to start the next DMA? Please help regards
  • Hi

    The DMA will be done writing data to the USART before the USART is done transmitting the data. After the DMA interrupt occurs you must therefore wait for an interrupt from the USART saying that it is done too.

  • Hi, yes, I tried this already by polling the USART after the DMA interrupt in order to wait until the char is transmitted with: while(!(U0CSR & 0x02)); but the event is raised when the USART _starts_ output the char. So this failed, too. Next try was to wait until the USART is not active anymore with: while(U0CSR & 0x01); which actually works but I do not like this workaround because the U0CSRT.ACTIVE flag is also raised when receiving a char. Any more suggestions. reagards spachner
  • Hi,

    The source buffer in external memory should be aligned to cache line width. Hope you are #pragma for the same.