cancel
Showing results for 
Search instead for 
Did you mean: 

USART doesn't transmit first character

lorbek
Associate II
Posted on March 25, 2013 at 12:30

Hi,

I have a problem with transmitting character through USART3 port in STM32F207.

Here there is the USART configuration code:

--------------

USART_DeInit(USART3);

USART_InitStructure.USART_BaudRate = 115200;

USART_InitStructure.USART_WordLength = USART_WordLength_8b;

USART_InitStructure.USART_StopBits = USART_StopBits_1;

USART_InitStructure.USART_Parity = USART_Parity_No;

USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;

USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

USART_Init(USARTx, &USART_InitStructure);

------------

The problem occurs when sending characters, USART doesn't send the first one (checking with hyperterminal), and then it goes on with sending the others correctly. It just misses the first one. If I debug the code, this trouble doesn't occur and the transmission is correct. 

At the moment I'm sending a ''\r'' character at first, in order to send the correct string later, but this is not so reliable.

Does anybody knows something about that?

Thanks 

Stefano
11 REPLIES 11
trevor23
Associate III
Posted on March 26, 2013 at 17:52

Testing the bit after is dumb as you wait the full time. Testing before is smart as you only wait once you're at the point of sending having dome something useful with the time since last loading the transmit register. This applies to many other situations also not just UART transmit registers.

sundar
Associate II
Posted on March 19, 2014 at 12:19

Hello Clive,

Thanj you for the Info ,..It Just Works Fine ,.......Had the same problem of Missing the first Byte(Commnicatiob b/w 32l and 8l ) had a wrong idea , now Cleared ,......

Regards,

Sanil