STM32 USART2 problem with transmission complete callback
Posted: Wed Apr 15, 2015 1:51 pm
There's a problem with using the txend2 ('Transmission Complete') callback on the current USART2 driver; it occurs as soon as you start transmission.
It occurs both with the 'official' DMA-based driver, and my interrupt-driven version.
This is because the TC flag gets set when the USART is idle, so the TC interrupt was occurring at the start of transmission, in the interval between enabling the interrupt and the first character being written to the transmit buffer.
I've generated a fix which means it's now set once the last character has been written to the transmit buffer.
The attached files include my mods to allow use of interrupt-driven routines; all the changes should be marked.
It occurs both with the 'official' DMA-based driver, and my interrupt-driven version.
This is because the TC flag gets set when the USART is idle, so the TC interrupt was occurring at the start of transmission, in the interval between enabling the interrupt and the first character being written to the transmit buffer.
I've generated a fix which means it's now set once the last character has been written to the transmit buffer.
The attached files include my mods to allow use of interrupt-driven routines; all the changes should be marked.