AnsweredAssumed Answered

UART Transmit problem

Question asked by a.m.a on Jul 16, 2016
Latest reply on Jul 18, 2016 by lopez.pedro.001
Hello!
I'm working on UART comunication between stm32f407 and PC. I want to transmit 4 character via "senddata()" function shown below.

USART_SendData(USART1,'D');
while(USART_GetFlagStatus(USART1, USART_FLAG_TC)==RESET);
USART_SendData(USART1,'A');
while(USART_GetFlagStatus(USART1, USART_FLAG_TC)==RESET);
USART_SendData(USART1,'T');
while(USART_GetFlagStatus(USART1, USART_FLAG_TC)==RESET);
USART_SendData(USART1,'A');
while(USART_GetFlagStatus(USART1, USART_FLAG_TC)==RESET);

 the problem is that when i wait for TC flag after each send, it won't change i mean it remains low. Therefore, the program is stuck in the while loop. how can i become sure of a transmit completion? isn't it the right way? According to the user manual file (Page 749-Fig.249), TC is not set until the last data is sent. how can i use it?
when i remove while loops the program works fine but it only sends the last character to the PC.
(usart1 is configured truly.)

Outcomes