2013-03-11 05:07 AM
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-problem2013-03-11 05:20 AM
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.2013-03-11 05:57 AM
The PC sees for some reason an inversion of what is transmitted.
Are you sure you use a proper level shifter (MAX3232 or similar)? JW2013-03-13 04:42 AM
Hello Ian;
that's possibly the reason ;) I have ordered a level shifter and then i try again.