Do you know how to use USART on STM32

microcontrollerserialstm32

I've been doing USART on STM32 and got this at putty:

enter image description here

Actually I want to display :

printf("*  Thank you for using the board");

Do you have idea why ?

Best Answer

This could be a whole host of things. The best thing to do in trouble shooting is to avoid or clarify assumptions:

  • Correct baud rate?(too high?) Check both sides
  • Incorrect COM port settings (start/stop/data/parity bits). Check both sides. Don't assume values, like writing 1 in the stop bit register means 1 stop bit. At NXP LPC2129 (ARM7) this means 2 stop bits. Once I was stuck on that for hours, figuring out why I couldn't send more than 1 character at a time..
  • Check timing on scope or logic analyser (at 9600baud a short pulse should take 1/9600 second). If you're using high baud rates and a 'odd crystal' (20MHz on 115k2 or higher), you may need to set up a fractional baud rate divider to more closely match baud rates.
  • Rerun calculations from datasheet for baud rate. Look-up, measure, clarify all clock speeds and other dividers configurable.

Edit: last but not least: is your hardware OK? Shorts, missing solder points, components, etc.