2016-09-13 06:07 AM
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 Julien2016-09-13 01:22 PM
> I was neither successfull with the uart TC.
That's bad luck because that's supposed to indicate the end of transfer. JW2016-09-14 05:05 AM
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 Peacock2016-09-16 03:35 PM
Try waiting for a UART TC interrupt, instead of a DMA TC interrupt.
2016-10-04 03:26 AM
OK, thanks to all. I will do some tries with TC interrupts.