I am trying to upload sketch to a ATmega328P on a breadboard using a PL2303 USB to TTL converter. It shows the following error:
Using Port : /dev/ttyUSB0
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
avrdude done. Thank you.
An error occurred while uploading the sketch
The ATmega328P was boot-loaded using an Arduino Uno. It works okay.
Also, I uploaded a test sketch to it (just repeatedly prints a string to serial) using Arduino Uno as ISP, then removed the Uno and connected the PL2303 and opened serial monitor. The test string kept showing up on the serial monitor. So the problem seems to be while uploading the sketch.
I tried holding the reset button on the ATmega328P (a push button added to breadboard) with a few different timings and durations while uploading, but none seemed to work.
And my PL2303 does not have a DTR pin (maybe it does on the SMD chip, but I cannot solder that).
Yes, I read about that, and I tried that with different timings and durations, but cannot really figure out the exact timing. Can you please tell exactly when to press the reset button and for exactly how many seconds to hold it for? Thanks.
I tried tapping the button (pressing and immediately releasing) exactly when this message is shown. Did not work.
Sketch uses 924 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
Could this be a reason? I mean, the crystal used with the ATmega328P is 16MHz, but the crystal on the PL2303 board is 12MHz. Is it okay that they have different values?
That's it! I didn't know I had to re-bootload it. Did that. Then when uploading using PL2303, just held the reset button, clicked upload, released the reset button when "Uploading..." was shown, and it works now. Thanks!