Serial UCSR0A register

Does anyone know the ARM equivalent for UCSR0A? The following code is from a Arduino library and everything works with it except the UCSR0A.

if ((UCSR0A & 0b01100000) != 0b01100000){												// Wait for TX data to be sent

@Spyke Looks like you need to wait until the transmit is done, and not a second later… bit 6 is TX complete and bit 5 is TX data register empty.

STM32 has this function that should help… I wrapped it up in a helper function… you can use it raw if you want:

int Serial1TXcomplete(void)
	// Check if the USART Transmission is complete
		return 1; // Complete
		return 0; // Not Complete

You can use it like this…

Serial1.print("paragraphs and paragraphs of text!!!!!!!!!!!!!!!!!!!");
while( !Serial1TXcomplete() ) {
  // Sit here and do nothing... 
  // don't bother calling Serial1.flush(); because it's not implemented yet.

I didn’t test this, but it’s almost too easy not to work so let me know if it does please :smile:

It works fine thanks!

1 Like