I am trying to send something from an atmega to my pc.

The setup is: Ubuntu 14.04, atmega644P-20PU, USBASP v2, TTL-to-USB pl2303

Firstly I tried to write the code in C and used this code and then this one and I got the same result: '�' or random characters (in minicom or screen)

Then I gave up the C and uploaded a simple Arduino program:

void setup()
void loop()

(when running arduino I put a 16MHz crystal. in other cases I used a 20Mhz one. Also setting F_CPU accordingly in the code.)

In all the cases the R(receive) LED of the pl2303 is blinking at the right moments (depending on the delay set in code).

Also I used CuteCom to view what I am getting from the serial port and instead of '�', depending on the code used I get "\0x00\0x80\0x80" (for Arduino code) or in other cases "\0x80\0x00\0x80".

I use RX0 and TX0 (pin 14 and 15). RX0 connected to TX of pl2303 and RX of pl2303 to TX0 of the mcu.

I also shorted RX and TX of pl2303 and tried to send data across it and I receive back what I send.

Baud rate of pl2303 is 9600

$stty -F /dev/ttyUSB1

speed 9600 baud; line = 0;

min = 60; time = 1;

ignbrk -brkint -icrnl -imaxbel

-opost -onlcr

-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

In all cases I used 8N1.

I hope I was specific enough and coherent.

(normally I try to find myself answers and solutions, but now I'm lost)

  • \$\begingroup\$ Do you have an oscilloscope available that you can use to capture the signal? Also, what do you receive if you send data from the pc? \$\endgroup\$ Commented Mar 2, 2016 at 10:04
  • \$\begingroup\$ 't' looks like 0001011101 on the line 0x80 like 0000000011 and 0x00 like 0000000001 almost certainly you have the baud rate too fast at the receiving end. \$\endgroup\$ Commented Mar 2, 2016 at 10:06
  • \$\begingroup\$ I might get to work with an oscilloscope. I'll display the results if I do. I didn't try to send from the pc to the mcu, but I will try and display the results asap. \$\endgroup\$ Commented Mar 2, 2016 at 10:08
  • \$\begingroup\$ @Jasen Great observation. But I still don't understand what else I could set. the port is at 9600, cutecom is set at 9600, the mcu is also set at 9600, with the proper crystal. I can't add a printscreen about this because I don't have enough 'reputation points'. \$\endgroup\$ Commented Mar 2, 2016 at 10:13
  • 1
    \$\begingroup\$ set cutecom to 1200 baud and see what happens. \$\endgroup\$ Commented Mar 2, 2016 at 10:17

2 Answers 2


't' looks like 000101110 on the line 0x80 like 000000001 and 0x00 like 000000000 (including the start bit an ignoring the stop bit) almost certainly you have the baud rate too fast at the receiving end.

given that you're seeing 0 zeros and a 1 it's probably set 8 times too fast, so try 1200 baud in cutecom and look for a possible cause for the baud rate divider in the arduino to be set 8 times too high.


As mentioned above, you have CKDIV8 fuse still programmed in fuses.

You can temporarily get rid of it by setting setting 1x prascaler in software

CLKPR = (1 << CLKPCE); // Enable change of CLKPS bits
CLKPR = 0x00; // Set prescaler to 1

Or just set correct fuses, with disabled CKDIV8 and full swing crystal oscillator CKSEL setting.

This is my setup for mega 328p:

mega 328p full swing crystal

  • \$\begingroup\$ thanks a lot. I'm kind of a beginner regarding avr coding. Is there a reason why I would want to use this prescaler? \$\endgroup\$ Commented Mar 3, 2016 at 20:06
  • \$\begingroup\$ The clock prescaler is usually used to make non-standard clock from internal oscillator (eg. low power&cost smbus slave at 2/4MHz). Switching it on the fly would be really hard for begginers (eg. _delay_ms() is compiled statically for specific defined F_CPU). \$\endgroup\$
    – jnk0le
    Commented Mar 3, 2016 at 20:42
  • \$\begingroup\$ got it. I wrote you and email on your email from github. I hope you still use it. I am very curious about your thoughts on it (could find a chat system here :( ) \$\endgroup\$ Commented Mar 3, 2016 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.