According to the datasheet I'm setting the UCSR0C
register as following:
UCSR0C = 0b00000110
Description:
Bit 0: 0: TX rising, RX falling
Bit 2-1: 11: character size 8 bit
Bit 3: 0: 1 stop bit
Bit 5-4: 00: no parity
Bit 7-6: 00: asynchronous USART
(http://www.atmel.com/images/doc2545.pdf page 193)
Although I configured the UART to use 8 bit data mode I have to set my communicating terminal (picocom
) to use 7 bit data mode. Otherwise I don't get correct data from my ATmega168. I also tried to use minicom
and miniterm.py
.
My target device I want to communicate with is a Raspberry Pi
. I'm using Peter Fleury's UART library (http://homepage.hispeed.ch/peterfleury/group__pfleury__uart.html
).
Any ideas what I'm be doing wrong? Did I forget something?
Answer
I solved the problem by using an external oscillator. It seems that the internal oscillator is too imprecise for UART communication.
No comments:
Post a Comment