2015-09-23 11:41 AM
I am trying to transmit a string of characters through USART3 of a STM32F215RG using the code below. If I run this code, I see no output on my terminal. If I single step through this code I see all characters on the terminal. If I replace the wait for TXE to go high with a HAL_Delay(1), I see all characters on the terminal. What am I missing ?
char
textbuff[32];
strcpy
( textbuff,
''Hello\r\n''
);
for
( i = 0 ; i <
strlen
( textbuff ) ; i++ )
{
while
( USART3->SR & UART_FLAG_TXE == 0 )
;
USART3->DR = textbuff[ i ];
}
Andy
#usart-txe
2015-09-23 12:12 PM
while
( (USART3->SR & UART_FLAG_TXE) == 0 )
;
2015-09-23 02:21 PM
Damn, that’s embarrassing !
A rookie mistake and I have been coding for 30 years :~(
Thanks for pointing out that I really need to read my code more carefully before posting for help.
Best Regards Andy2015-09-23 02:22 PM
Damn, that’s embarrassing !
A rookie mistake and I have been coding for 30 years :~(
Thanks for pointing out that I really need to read my code more carefully before posting for help.
Best Regards Andy2015-09-23 07:05 PM
It's one of those things you can stare at and not see. Like errant semi-colons at the end of if, for or while statements.
2015-09-24 11:04 AM
So true :)
Thanks for the second pair of (working) eyes. The double reply is because this forum software works about as well as my firmware ! Andy