cancel
Showing results for 
Search instead for 
Did you mean: 

Trasmitting through UART

andy2399
Senior
Posted on September 23, 2015 at 20:41

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
5 REPLIES 5
Posted on September 23, 2015 at 21:12

while
( (USART3->SR & UART_FLAG_TXE) == 0 )
;

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
andy2399
Senior
Posted on September 23, 2015 at 23:21

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

Andy

andy2399
Senior
Posted on September 23, 2015 at 23:22

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

Andy

Posted on September 24, 2015 at 04:05

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
andy2399
Senior
Posted on September 24, 2015 at 20:04

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