AVR USART Garbage Data

atmegaavruart

I have been having issues with my AVR USART. Using a PL2303 USB adapter with the following connections to the AVR

enter image description here

What I am seeing is

Garbage data (mostly of 0xFF or 0xF7 or 0xE7) even when the circuit is turned off (output below in HEX)

FF FF 7F 7F FF FF FF FF F7 F7 77 F7 FF 76 F6 FF F6 B7 FF FF E7 77 7F
FF EE FF FF 76 FF F7 F7 FF FB F7 FF FF FF F7 77 37 F7 77 FF 77 F7 FF
FF FF F7 FF FF EF F7 7F 7F 77 77 FF 77 FF 77 F7 7F 6F FF FE FF 7F F3
E7 FE E7 FF 77 FF 9F DF 94 EE FF FF EB BF FF 27 DA FF B7 FF FF 7F 6C
B9 FF 6F 6F 7F FF FE EF DB FF FE BF 74 FF F6 F7 F7 FF DE FB FF BF BF
B7 3F B4 FB 7F 6F 7F

When the circuit is on, this garbage data is interleaved with my regular output (below in ASCII to show my regular output interleaved with garbage)

Pro?yv2?[?o?[???rrent Time &n?m????????{??10:47:33
1/1/9???????????{3y 'm' &
'?'`???????????v<6>6{kk<11>s#?<3>????ow????o?????f<6>6{kk<11>s#?<3>??k??????????<27>?<3>accepted
??????????????n<22><27><27>+??+#`

This happens randomly. Somedays it would happen, then go away on its own and then come back again.

I am using 16 Mhz crystal. Baud rate 38400, Data 2, Parity None. USART mode asynchronous

Best Answer

Is the ATMega328's ground connected to the PL2303 ground? You need that connection to provide a reference for the data lines.