ATMega328P AU Uploading the code (SOLVED)

Hi friends,

I have followed this video to bootload the ATMEGA328P-AU by Arduino Uno.

The bootloading process is successfully done but when I tried to program the chip it gives back the following errors.

Arduino: 1.8.9 (Windows 7), Board: "Arduino Uno"

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Mahdiyar\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM9
         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=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x54
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x54

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

to upload the code on the chip I have done the following steps:
1- removing the ATMEGA328P-PU from the Arduino-UNO board
2- connect the chip to arduino as follows:
Arduino ATMEGA328P-AU
RX 30
TX 31
Reset 29
5v 3,5,21
GND 4,6,18,20

3- connect the crystal and two number of 22p cap to pins 7 and 8 as mentioned in the video
4- connect 120 ohm resistor from 29 (reset) and 5v as mentioned in the video.
5- set the Programmer to "AVRISP mkII"
6- set the Board to "Arduino Uno".

In the 6th step, I hve also tried the "Arduino Duemilanove or Diecimila" and set the processor to ATMega328p

If the problem is about the chip or Arduino board it shouldn't have to be bootloaded.

Any help is appreciated,
Mahdiyar

Add a link of the video.

There is many similar topics here:
https://forum.arduino.cc/index.php?board=119.0

You have basically programming "bare bone" chip on custom board, want to be able further to upload sketch through serial interface or what exactly?

noob314:
Add a link of the video.

There is many similar topics here:
Avrdude, stk500, Bootloader issues - Arduino Forum

You have basically programming "bare bone" chip on custom board, want to be able further to upload sketch through serial interface or what exactly?

Thank you for your reply, first, I added the link and modified the post.

Second I want to upload the written code in the arduino IDE to ATMEGA328P-AU, exactly the same as as explained in the following link for ATMEGA328P-PU.

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

I have done this link for the dip version and it has done successfully.

At first glance what you described at your board missing pull up 10K resistor on RESET pin.

When programming trough serial interface, you have to do it through 100uF in order to be able to reset the MCU. I.e. DTR signal from RS232 board -> 100uF cap -> RESET pin of 328p.

noob314:
At first glance what you described at your board missing pull up 10K resistor.

When programming trough serial interface, you have to do it through 100uF in order to be able to reset the MCU.

Do you mean that I have to add 10K between the reset and 5v? In the video 120 Ohm is suggested, I did so, as I said in the 4th step.

Yes, exactly 10K between RESET pin and 5V. That will hold MCU able to work properly. The 120 Ohm is way to low. It have just to sense 5V, not to draw any current from power supply.

noob314:
Yes, exactly 10K between RESET pin and 5V. That will hold MCU able to work properly. The 120 Ohm is way to low. It have just to sense 5V, not to draw any current from power supply.

Thank you so much for the help. It works.

I don't why 120 Ohm worked last night once, maybe by chance.

You are welcome.

BTW, read this for more details:

Mahdiyar:
4- connect 120 ohm resistor from 29 (reset) and 5v as mentioned in the video.

This should be a 10K ohm resistor. This is important because the reset line needs to be pulled LOW to start the bootloader running at the beginning of the upload. I'm certain a 120 ohm resistor is to strong a pull-up for the reset circuit to overcome. If you watch the video carefully, you can see they did remove that resistor after burning the bootloader, but before uploading, but didn't mention it in the video. This is likely the cause of the upload failing.

The ATmega328P does have an internal pull-up on the reset, so the 10K resistor is probably optional. However, that internal pull-up is fairly weak, so it's possible that in an electrically noisy environment you could still end up with the pin going LOW, causing a reset. That will be a very confusing bug, so the 10K resistor is definitely worth adding.

In the case of using the Uno as your USB to TTL serial adapter, you probably don't need the 10K resistor, since there is one on the Uno. But this is good to know about since you are likely planning to eventually have your bare chip on a board without the Uno connected.

The video neglects to tell you to add 10 uF capacitors on the power lines of the chip, as close to the chip as possible. As demonstrated by the video, you might be able to get away without them, but you also might find that your chip is unreliable or doesn't work at all without them. It's definitely worth adding them to make sure.

Mahdiyar:
In the 6th step, I hve also tried the "Arduino Duemilanove or Diecimila" and set the processor to ATMega328p

When uploading, you need to have selected the same board as you did when you did the Burn Bootloader. If you followed the video faithfully, you had Tools > Board > Arduino Uno selected, and so you should have Uno selected when you do the upload. If you burned the Uno bootloader but then select ]Arduino Duemilanove or Diecimila before the upload, then the upload will fail even if you have everything else correct, so set it back to Uno.

pert:
This should be a 10K ohm resistor. This is important because the reset line needs to be pulled LOW to start the bootloader running at the beginning of the upload. I'm certain a 120 ohm resistor is to strong a pull-up for the reset circuit to overcome. If you watch the video carefully, you can see they did remove that resistor after burning the bootloader, but before uploading, but didn't mention it in the video. This is likely the cause of the upload failing.

Thank you so much for your complete explanations.

You're welcome. I hope it helped to solve your problem.
Per