Solved: Can't upload sketches to new ATMega328P chips in UNO

I bought a pair of new ATMega328P chips for my Arduino UNO, but when I put them into the board and tried to upload a sketch, "Blink", it failed to upload. This happens with both new chips.

When I put the original chip back into the board, it still works fine and sketches upload with no problems.

The eBay seller that I bought them from listed them as already having the bootloader for an Arduino UNO.
From the eBay listing:-
"1 pcs Arduino UNO bootloader ATMEL 8-Bit Microcontroller ATmega328P-PU"

The listing also says it's an "OptiBoot" bootloader, if that's important.

So shouldn't sketches load without problems, or is there something else I need to do with new chips?

The error message was:-

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x60

Can anyone shed any light on this?

Thanks in advance,
Steve

I contacted the seller regarding this, but they were no help - just kept asking me to send them a photo of the chips??? I attached one to my reply, and they said they couldn't see it and asked me to re-send it, (5 times).
It's a strange world. :slight_smile:

It shouldn't be a problem to replace the bootloader. Here on web is a tutorial how to, but yes if both chips have a bootloader they should work. Please, post verbose output. You can switch on it in preferences. The response 0x60 looks for me like incorrect board or programmer selected or they missing the bootloader. In a case you want investigate more, it coul'd be able to read complete flash memory by the same way (same wiring setup) as for bootloading but just before any SW action you have to run avrdude command from CMD line. It is little bit advanced but forum experts can advice how to.

Thank you very much for the reply, Budvar10.

Budvar10:
It shouldn’t be a problem to replace the bootloader. Here on web is a tutorial how to, but yes if both chips have a bootloader they should work.

I thought they should work straight off. I’ve posted negative feedback for the eBay seller, with a warning to future buyers. I’ll have to read up on replacing the bootloader.
Do you know if a separate programmer is necessary, or can it be done directly from the Arduino IDE to the UNO board?

Please, post verbose output. You can switch on it in preferences.

I already have verbose output turned on for both compilation and uploading. I just posted the basic error. I’ll post the complete output at the end of this reply, both the compilation lines and the error lines.

The response 0x60 looks for me like incorrect board or programmer selected or they missing the bootloader. In a case you want investigate more, it coul’d be able to read complete flash memory by the same way (same wiring setup) as for bootloading but just before any SW action you have to run avrdude command from CMD line. It is little bit advanced but forum experts can advice how to.

I’ve done a lot of searching on the 0x60 code, but all results suggest that the wrong port is selected. That’s not the case in this instance. The correct port is selected and the IDE recognises it as an “Arduino/Genuino UNO”.

Anyway, here’s the complete verbose output that I get while trying to upload “Blink”:-
(I had to leave out most of the compilation part. It exceeded the forum’s maximum message length, but I left the first lines and the last lines intact, and included all of the upload message.)

Arduino: 1.6.5 (Windows XP), Board: "Arduino/Genuino Uno"
C:\Program Files\Arduino\hardware\tools\avr/bin/avr-objcopy -O ihex -R .eeprom C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build1426043384458640723.tmp/Blink.cpp.elf C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build1426043384458640723.tmp/Blink.cpp.hex 

Sketch uses 1,030 bytes (3%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM8 -b115200 -D -Uflash:w:C:\DOCUME~1\STEVEC~1\LOCALS~1\Temp\build1426043384458640723.tmp/Blink.cpp.hex:i 

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf"

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

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

The working board can run a bootload installer sketch to load the non-working part. I suggest Nick Gammon's:
http://www.gammon.com.au/forum/?id=11635

CrossRoads:
The working board can run a bootload installer sketch to load the non-working part. I suggest Nick Gammon's:
http://www.gammon.com.au/forum/?id=11635

That's good to hear. Thanks, CrossRoads, I'll check it out. (So Nick's here in Australia. Didn't realise that.)
A small problem - your link to Nick Gammon's page doesn't work. ...sorted out.

I forgot mention it is able to bootload with UNO with loaded ArduinoISP sketch. You need UNO and few components: 10k resistor, crystal 16MHz or other frequency, 2x22pF caps and 2x100nF and some wires. Look at the schematic in tutorial.
If everything is connected you car run avrdude command from CMD, similar like in verbose output. You can try just basic 'touch' at the first if it is able to communicate. It will log just chip signature.

C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -vvvv -patmega328p -carduino -PCOM8 -b115200

And after, you can use same to read out the whole flash if you want to know if the bootloader is there. I am curious.
Read avrdude help for appropriate switch (-Uflash:r:filename).

Budvar10:
I forgot mention it is able to bootload with UNO with loaded ArduinoISP sketch. You need UNO and few components: 10k resistor, crystal 16MHz or other frequency, 2x22pF caps and 2x100nF and some wires. Look at the schematic in tutorial.
If everything is connected you car run avrdude command from CMD, similar like in verbose output. You can try just basic 'touch' at the first if it is able to communicate. It will log just chip signature.

C:\Program Files\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf -vvvv -patmega328p -carduino -PCOM8 -b115200

And after, you can use same to read out the whole flash if you want to know if the bootloader is there. I am curious.

I don't fully understand. Do I 'add' this line to the current avrdude.conf, or do I temporarily replace the current avrdude.conf file with one containing only this line?
Or, alternatively, can I enter this line from a command-line prompt?

From the command line, of course.

Budvar10:
From the command line, of course.

avrdude isn't recognised from a command line prompt. I'll have to find it and copy a command line prompt link into it's folder, I guess, or add it's path to the PATH statement.?
This is all new to me. 3rd day with an Arduino.
I'll work it out.

Guys same problem
I am a bit in-experienced so can i get some easy advice how to fix this

In the command is complete path to the avrdude. You can add it to the PATH or go to the folder. It's up to you.
NOTE: Use -cstk500v1 instead of -carduino.

Budvar10:
In the command is complete path to the avrdude. You can add it to the PATH or go to the folder. It's up to you.
NOTE: Use -cstk500v1 instead of -carduino.

Yep, I'll get there. I tried the complete path as you typed it, and got a message that "C:\Program" was unknown, so I enclosed the whole line in double-quotes and got an error:- "The filename, directory name, or volume label syntax is incorrect."
So now I'll copy a command prompt link to the avrdude folder and do it that way. Should work. (I hope.)
I'm trying to read Nick Gammon's page on burning a bootloader at the same time.

I just did a copy from your log.

@bhavay07
What are you asking exactly? How to bootload the chip?

OK, before seeing your note about stk500v, I used your original line and got this:-

C:\Documents and Settings\Steve Carroll\Desktop\USBASP Stuff\avrdude-6.1-mingw32
>avrdude -C"C:\Program Files\Arduino\hardware\tools\avr/etc/avrdude.conf" -vvvv
-patmega328p -carduino -PCOM8 -b115200

avrdude: Version 6.1, compiled on Mar 13 2014 at 00:09:49
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files\Arduino\hardware\to
ols\avr/etc/avrdude.conf"

         Using Port                    : COM8
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

avrdude done.  Thank you.

When I changed to your stk500v version, I got a string of errors, too large to include in this reply. I have to wait a few minutes, then I'll post that result if it's not still too large.

And @bhavay07 , hijacking my thread will not make things any easier. If your problem is identical, sit back and read while it's sorted out here, then do whatever is needed. Looks like a new bootloader is in order in my case.

There is a problem with -carduino related to reset signal. Reset signal sends your UNO into programming mode and we don't want this. You can solve it by adding ~10uF capacitor between RESET and GND on UNO (ISP programmer) or to use -cstk500v1 programmer type which is the same except it is without reset signal.
BTW check your wiring carefully because the response 0x00 means that there is no connection to programmer and if the problem persists try to reload ISP sketch.

Budvar10:
There is a problem with -carduino related to reset signal. Reset signal sends your UNO into programming mode and we don't want this. You can solve it by adding ~10uF capacitor between RESET and GND on UNO (ISP programmer) or to use -cstk500v1 programmer type which is the same except it is without reset signal.
BTW check your wiring carefully because the response 0x00 means that there is no connection to programmer and if the problem persists try to reload ISP sketch.

You said to enter that line, but didn't mention to do it after working through Nick Gammon's page and downloading his ISP sketch. (I hadn't got that far yet.)

I think I'd better just read my way through Nick Gammon's page, download the necessary files, and re-burn the bootloader without the added stage of checking to see if a bootloader already exists on the chips. Too much at once.
I'm too exhausted to keep up with so many things at once right now. It's 4:30 am. I had to stay up late to get the replies to my original post, since I'm in a different time zone.
(I'm almost 60, and don't have the energy for late nights that I used to.)

I need to find cables etc before I can try out Nick Gammon's sketch, too. I don't have an ISP programming cable. And I don't have a second Arduino board, so I need to build a breadboard circuit to burn a bootloader using the Arduino sketch. I'll get some sleep and tackle this later in the day.

Sorry for misunderstanding. You have had read this: https://www.arduino.cc/en/Tutorial/ArduinoISP or Nick Gammon’s tutorial first. You have to load ArduinoISP sketch into UNO to be a programmer. Connect the chip to be programmed on the breadboard according the schematic:

and then you can start with commands or program the bootloader.

Budvar10:
Sorry for misunderstanding. You have had read this: https://www.arduino.cc/en/Tutorial/ArduinoISP or Nick Gammon's tutorial first. You have to load ArduinoISP sketch into UNO to be a programmer. Connect the chip to be programmed on the breadboard according the schematic:

and then you can start with commands or program the bootloader.

Yep, I've been thinking about it. No problem. And I couldn't go to sleep now, right in the middle of this. I'll sleep later. :slight_smile:
I've downloaded Nick's entire folder and am currently altering the necessary lines in his sketch, adding false to the defines that include files I don't need. Then I'll build the breadboard circuit and when that's done I'll do as you said and check if there's already a bootloader. I suspect not, because with one of the new chips in the UNO board, the LED behaves strangely, starting off not lit, then gradually getting brighter until it reaches full brightness.

I also sent a question to another eBay seller, asking them to verify that their chips definitely have the Optiboot bootloader and will immediately run in an Arduino UNO. If so, I'll buy a few of those. I want to burn sketches into ATMega328P chips, then use them in my own, custom PCBs.
Meantime, for now I've put the original chip back into my UNO and it's working fine.

Thankyou for your help and your patience with this. I'll report back in this thread on progress. And I've actually already laid out a PCB to take an ATMega328P for burning a bootloader. I did that a couple of weeks ago, before my Arduino arrived, but haven't actually etched a PCB yet. (I'm familiar with all of that side of things - been using PICs for 20 years.)

My suggestion is to not worry whether or not the chips come with a bootloader on them or not. Even if you get one with a bootloader, go ahead and put a fresh bootloader on there yourself. That way you'll know exactly what's on there and what version. The chips you got could technically have the bootloader on them, but perhaps the fuses aren't set the way you need. If you become familiar with the ISP programming process you will find you want to fix things up just the way you want them.