USART Baudrate Test

ki0bk's picture
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0



Here is a simple USART test program that sends the letter U continuously, the letter U has a 01010101 pattern that can be used to verify the cpu speed and baud rate by measuring the bit time of the TXD pin output.

At a baud rate of 4800, the bit time (pulse duration high or low) should be ~208us using a logic analyzer or O-scope or 4800Hz using a frequency counter.

Any other value indicates the cpu is not running at the expected speed, for this program as compiled, 8MHz, change F_CPU to change to your actual cpu speed as set by the fuses.