cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USART Timing problem

mrupprath
Associate II
Posted on March 11, 2013 at 13:07

Hello;

i have a small USART Test application.

 It should send, controlled by an timer, constant ''A'' characters

By receiving a character from the terminal Program of the PC an interupt is fired.

The terminal programm reveices ''other charcters, different from ''A'', and variing.

When i send characters from the terminal programm, the interrupt routine is fired but i got the wrong data:

Examples:

   ''A'' = 65 send from terminal application und ''_'' = 95 reiceved by �C

   ''B'' = 66 send and ''/'' = 47 received.

The error can be reproduced, i always receive the same ''wrong'' values for specific characters send.

I have heard that the reason is a wrong setting of the USART BRR Register 

I have checked the following:

Actually my USART 3 Clock is running at 500000Hz (because i am testing timers too) 

If i am right: BRR Register = USART Clockspeed/ Baudrate

In my case: BRR Register = 500000 / 2400 = 208.3333333

Actual  BRR Register contains: 208

The difference between the calculated value and the actual register contents is 1/3 .

Is this the reason for my communication problem , and how to handle ?

Thanks in advance

Marc

#usart-timing-problem
3 REPLIES 3
Posted on March 11, 2013 at 13:20

1/3 sounds close to 8/25

Make sure HSE_VALUE for your project matches the HSE placed on the board, and the PLL settings.

Honestly not sure why you have APB at 500KHz, but whatever.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 11, 2013 at 13:57

The PC sees for some reason an inversion of what is transmitted.

Are you sure you use a proper level shifter (MAX3232 or similar)?

JW
mrupprath
Associate II
Posted on March 13, 2013 at 12:42

Hello Ian;

that's possibly the reason ;)

I have ordered a level shifter and then i try again.