cancel
Showing results for 
Search instead for 
Did you mean: 

Which interrupt for complete uart transfer with DMA

JulienD
Senior
Posted on September 13, 2016 at 15:07

Hi,

With STM32L1, I need to know when a frame transmition is complete when sent

on uart using DMA.

By complete, I mean, the last bit has been sent on the line because I need to activate

a buffer when data is transmitted, and deactivate it when nothing more has to be send.

I tried with the dma TC, but it fires 2 bytes before the end. I supposed that's because

the uart has a 2 bytes buffer.

I was neither successfull with the uart TC.

Now, I suspect a bug, but if you can tell me which interrupt I should look for, the debug

would be more straight forward.

Thanks

Julien
4 REPLIES 4
Posted on September 13, 2016 at 22:22

> I was neither successfull with the uart TC.

That's bad luck because that's supposed to indicate the end of transfer.

JW

jpeacock23
Associate II
Posted on September 14, 2016 at 14:05

You might want to check your code again.  The TXE interrupt occurs before buffer is empty, as you describe.  The TC occurs after the last bit is shifted out.  From your description you are looking at the wrong event. 

Are you enabling TC only after the last byte has been sent?  If you have long inter-character gaps you can see TCs interleaved with TXEs.

  Jack Peacock

mark239955_stm1
Associate II
Posted on September 17, 2016 at 00:35

Try waiting for a UART TC interrupt, instead of a DMA TC interrupt.

JulienD
Senior
Posted on October 04, 2016 at 12:26

OK, thanks to all. I will do some tries with TC interrupts.