Standalone ATMega328p and ATMega16U2 Bootloader and Firmware Troubleshooting

Hi everyone,

Awhile back I made a simple PCB that sends 4 analog signals to an Arduino Uno. I decided I wanted to make my PCB Arduino compatible. Since the Arduino Uno worked so well for this project, I decided on using the ATMega328p and 16U2 for my PCB. I have burned the bootloader for the 328p and installed the firmware for the 16U2.

Both seemed to install without a problem. The Arduino IDE recognizes my custom made PCB in Tools > Ports as: COM6 (Arduino Uno). When I try to upload a sketch, I get the error shown below.

I have years of experience programming but this is my first time trying a standalone project. I am not too familiar with burning bootloaders and installing firmware. I have been researching for days and I can't seem to figure out what I am doing wrong.

I followed these two guides for burning the bootloader for the atmega328p and installing the firmware for the atmega16u2.

Atmega328p burning the bootloader:

Atmega16u2 installing the firmware:

I have also attached the schematic for the PCB.

Can someone please take a look and let me know if they see anything I am missing or doing incorrectly. I would very much appreciate the help and it will go a long way.

Thank you

Error Message:

Using Port : COM6

Using Programmer : arduino

Overriding Baud Rate : 115200

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x58

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x58

avrdude done. Thank you.

arduino.pdf (1.76 MB)

Schematic looks ok.
Could have used a couple more 0.1uF caps on the VCC, AVCC pins on both devices - one 0.1uF on each VCC and AVCC pins.
It appears the 328P is not getting the reset pulse that tells it to start the bootload code running.
You can force it - press & hold the 328P reset button, start the download. When you see "Compiled xxx of 32xxx bytes", something like that, release the button. May take a few tries to get the timing correct.
If you select File:Preferences in the IDE and turn on Verbose outputs, it can be easier to find the release point.

R39 - what is the purpose of it?
Check the reset pulse on 328p.
Also R37, get rid of it. Check the oscillator - square signal on XTAL1.
Try the loop-back test for 16U2: Loop-Back Test Instructions - Installation & Troubleshooting - Arduino Forum .
What is the SW setup info: bootloader, uploading speed. Please, do not post log as picture. Use code tags or post it as txt.

CrossRoads:
press & hold the 328P reset button, start the download. When you see "Compiled xxx of 32xxx bytes", something like that, release the button. May take a few tries to get the timing correct.

I attempted this, I am not sure if I am timing accurately or not... I have not seen anything change.

I will be assembling more PCBs to see if I will continue to get the same error. Maybe there's something wrong internally with one of the chips?

Budvar10:
R39 - what is the purpose of it?
Check the reset pulse on 328p.
Also R37, get rid of it. Check the oscillator - square signal on XTAL1.

The schematic for this circuit is completely based on the Arduino Uno R3.

I am not sure what the exact purpose of R39 is. I believe it is meant to eliminate unexpected resets during programming. The reason I added it is because its on the Arduino Uno schematic. This is the same reason why I put R37 where it is, just trying to follow the schematic. Are you sure I need to get rid of it?

R37 can attenuate square signal. It is better to start without it or check the signal with oscilloscope.
However, as I rethink, you wrote that it was able to upload the bootloader so it should be good.

Make sure the USB/serial transceiver is working. Do a loop-back test.
The reset pulse have to pass to the 328P. Check it e.g. with the DMM, significant fall to zero should be observable on RESET pin. Normally it is VCC.

Check your settings like upload speed.

I will be assembling more PCBs to see if I will continue to get the same error. Maybe there's something wrong internally with one of the chips?

I do not think so if you have the chips from official stores, I mean no counterfeit.
It is good to start testing with minimal circuit: power, clock and reset. It should be able to upload the bootloader and then to upload via serial port.

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