on an ATmega48 I want to check if the TX buffer is empty. My program is an autobaud-program which needs to change the baudrate settings. Checking UDR flag is not enough because the transmitter itself can still be busy. Checking TXC flag only works if it has been cleared before writing the UDR register - but unfotunately I do not have the transmitting function under my control.
Is there any chance to check the transmitter without relying on the TXC flag having been cleared before start of transmission?
My current workaround is to actively call a delay before changing the baudrate.