Cannot upload to standalone ATmega328P on a breadboard

Hi.

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).

The pin connections are:
TX - RX
RX - TX
5V - 5V
GND - GND

I am using Ubuntu 20.04.

Thanks.

Hi @n-0-0-b
Please post your project schematic on the breadboard.

Did you use 16MHz crystal and capacitors for the ATmega328?

RV mineirin

Do you have the required resonator or crystal & capacitors, as well as a 10K pullup on reset, and btpass capacitors fitted?

Sorry, I don't know of a good free breadboard schematic maker. Here is an attempt, hopefully it is understandable.

The crystal on the PL2303 board reads 12000. Could that be a reason?

Hi
using only RX and TX you need to hold the reset and release it when the IDE starts uploading.
RV mineirin

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.

When the size of the file is shown, tap reset.

Hi

press reset and hold,
note the line below in the IDE.
It says "Compiling Skecth", so when it changes to : "downloading" release the button

RV mineirin

Thats for the USB chip on the converter, its good.

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.

You mean "Uploading..."? If so, then yes, tried that multiple times (as did with just tapping), did not work.

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?

YES, they have NOTHING to do with each other.

After uploading your 'test' sketch, did you remember to burn the bootloader again? Uploading by ISP deletes the bootloader.

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!

Happy you got it working.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.