**SOLVED** Playing around with bootlader and now won't upload any bootloader

I'm using an Atmega328PB on a pcb converter, to replicate the physical shape of a 328p in a DIP format.

I've uploaded a few different bootloaders, which uploaded fine but I can never get a sketch to upload, at all.

I had a 328p in dip format, so I uploaded a bootloader and a blink sketch. Worked first go.

Went back to the 328pb, varied the bootloader settings, in case that was the problem and now no bootloader will upload.

I'm using an Open Smart AVR ISO Shield with an UNO. I'm using Open Smarts ISP sketch, which is just a variation of the Arduino ISP example. Although I've used both. I've also tried the breadboard way also. Nothing.

As I changed the bootloader several times and for it not to suddenly work, I'm stumped. I'm hoping it is something obvious.

These are the errors, having changed the UART setting, which makes a difference.

Yes UART0

Arduino: 1.8.8 (Windows 10), Board: "ATmega328, Yes (UART0), 328PB, BOD 1.8V, LTO disabled, 8 MHz internal"

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\MAGUIRES\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.3/avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega328PB
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0xffffff (retrying)

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0xffffff (retrying)

Reading | Error while burning bootloader.
################################################## | 100% 0.06s

avrdude: Device signature = 0xffffff
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

UART1 PB only

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0xffffff (retrying)

Reading | ################################################## | 100% 0.07s

avrdude: Device signature = 0xffffff (retrying)

Reading | Error while burning bootloader.
################################################## | 100% 0.05s

avrdude: Device signature = 0xffffff
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Thank you

Just to add, the shield was used to upload bootloaders but an FTDI was used to upload the program, via the shield.

Using Minicore to upload the bootloader.

Is is possible that you did a Burn Bootloader when you had the Tools > Clock menu set to an external clock setting. If so, and you don't have an external clock source connected to your ATmega328PB, then the chip will be "bricked" until you connect an external clock source to it long enough to do a Burn Bootloader with the Tools > Clock menu set to an internal clock setting.

pert:
Is is possible that you did a Burn Bootloader when you had the Tools > Clock menu set to an external clock setting. If so, and you don't have an external clock source connected to your ATmega328PB, then the chip will be "bricked" until you connect an external clock source to it long enough to do a Burn Bootloader with the Tools > Clock menu set to an internal clock setting.

I’m not sure tbh. I will check that.
I first tried a few different bootloaders using an internal 8MHz clock. As I couldnt get a sketch uploaded, I then tried an external clock bootloader. Not sure if this is when the problems occured.
The shield has a clock and on the breadboad, I tried using a clock and then not.

I've tried using the chip on a breadboard and uploading a bootloader using another UNO via the ISCP method. I tried uploading the bootloader for an internal 8MHz clock and then using a 16MHz crystal on the actual breadboard and I got this error

Arduino: 1.8.8 (Windows 10), Board: "ATmega328, Yes (UART1 328PB only), 328PB, BOD 1.8V, LTO disabled, 8 MHz internal"

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\MAGUIRES\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.3/avrdude.conf"

Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega328PB
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

Error while burning bootloader.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Tried on the shield and breadboard with an 8 and 16 MHz crystals. Still the same problem.

Maybe the chip is fried but I put an led between pin 13 and ground. When powered up, the led flashes a bunch. So therefore the chip must be okay.

Still a mystery to why is suddenly doesnt work. I’ve ordered a usbasp, to see if that helps.

Double check connections.
Check this:

  1. power,
  2. RESET pin must be tied to VCC via 10k resistor, normally there is VCC on it,
  3. clock source/crystal,
  4. wiring from ICSP - only 6 wires but most problematic part, usually.

Maybe you could show your setup.

EDIT: A sketch for ISP... do you have loaded in Arduino?

All the information given here is spot on. If the device is still flashing the D13 LED then you have the bootloader installed, the crystal is either connected or not required (it is running from the internal 8MHz clock). Unless you uploaded the BLINK sketch then it is the bootloader sketch flashing that LED not your sketch. Does the LED still flash when placed on a breadboard without a crystal? If so, then you have the internal clock set correctly.

Your "Invalid Device" message might indicate that you have poor contacts on your programming shield. Sometimes I have to wiggle mine about a bit for any chip to be recognised, probably just a bit of oxidisation on the cheap ZIF socket contacts. But by using the shield you can be certain that the MOSI/MISO/SCK connections are always correct so that is another thing we don't have to worry about.

If you can't get it working with the shield then the fallback position is to use DuPont cables directly to the chip possibly on the breadboard. Follow the umpteen pictures you will find on the Internet on how to do this (I'm pretty sure you already know all this).

I'll re-read your PM to see if I missed anything.

Budvar10:
Double check connections.
Check this:

  1. power,
  2. RESET pin must be tied to VCC via 10k resistor, normally there is VCC on it,
  3. clock source/crystal,
  4. wiring from ICSP - only 6 wires but most problematic part, usually.

Maybe you could show your setup.

EDIT: A sketch for ISP… do you have loaded in Arduino?

Hello,
Yes I did all those things. I used the ‘old’ style method, so using pin 13, 12, 11, 10 (I think from memory, I’m at work). I’ve rewired it multiple times and changed breadboard.
As for the sketch, I used the example ISP sketch.
This is the sketch I used for the Open Smart Shield, which worked to burn the bootloader a bunch of times

EDIT; the sketch was too large, so I’ve had to add as a text file

OPENSMART_ISP.ino.txt (12.3 KB)

Yes, everything looks good but obtaining all zero response means that there is no connection to the target at all. So it is up to you to check it step by step carefully. It could be probably also damaged chip but e.g. it never happened to me. I'm supposing it is something with the setup.

You should post the setup photo first.

The points I've sent maybe look pretty corny but we have to start from the basics. Let say reset signal. Does it pass to chip? You can measure it by DMM. It is about 200ms so it should be observable as short drop from VCC to 0.

@Ralph_S_Bacon
You are right. I'm also thinking about those 6 wires as usual cause. However, in the respect of the first part of your post but if wires are ok. Does it give a sense?

Ralph_S_Bacon:
All the information given here is spot on. If the device is still flashing the D13 LED then you have the bootloader installed, the crystal is either connected or not required (it is running from the internal 8MHz clock). Unless you uploaded the BLINK sketch then it is the bootloader sketch flashing that LED not your sketch. Does the LED still flash when placed on a breadboard without a crystal? If so, then you have the internal clock set correctly.

Your “Invalid Device” message might indicate that you have poor contacts on your programming shield. Sometimes I have to wiggle mine about a bit for any chip to be recognised, probably just a bit of oxidisation on the cheap ZIF socket contacts. But by using the shield you can be certain that the MOSI/MISO/SCK connections are always correct so that is another thing we don’t have to worry about.

If you can’t get it working with the shield then the fallback position is to use DuPont cables directly to the chip possibly on the breadboard. Follow the umpteen pictures you will find on the Internet on how to do this (I’m pretty sure you already know all this).

I’ll re-read your PM to see if I missed anything.

Hi Ralph, thanks for the reply. I must have missed your post, in the process of posting mine.
Stupidly, thinking now, I’m not sure if I uploaded the blink sketch to the chip or it was reading from the Uno when in the shield. I was doing various things through a few hours, so I may be getting mixed up myself, apologies. I’ll check that this evening.
I’ll check the connections of the shield, maybe they’ve been bent also.
Thanks for the advice with the crystal. I’ll check the sketch and see what happens.

Budvar10:
Yes, everything looks good but obtaining all zero response means that there is no connection to the target at all. So it is up to you to check it step by step carefully. It could be probably also damaged chip but e.g. it never happened to me. I’m supposing it is something with the setup.

You should post the setup photo first.

The points I’ve sent maybe look pretty corny but we have to start from the basics. Let say reset signal. Does it pass to chip? You can measure it by DMM. It is about 200ms so it should be observable as short drop from VCC to 0.

Apologies, I keep meaning to get a snap, will do this later this evening. I’m wondering if the chip is damaged but I didn’t do anything which may have caused this. Well, I did power up the UNO along with the FTDI at the same time. Surely that wouldn’t be a problem.
Thanks for the reset chip info, I’ll try this also this evening.

The chip isn't damaged, probably ...I hope. Just be consistent in checking.
Keep your circuit as simple as it is possible. Get rid of any FTDI etc.

Just spent another couple of hours trying things again and I'm no farther on. I can't even get anything to flash, with regards to the LED now, which it was doing upon powering up.

I tried using these methods;

along with using a 10uF capacitor across reset and GND.

Tried the shield again but nothing. The closest to anything is, when selecting the chip to be a 16MHz clock, a different error occurs. Not sure if this means anything to anybody?

Arduino: 1.8.8 (Windows 10), Board: "ATmega328, Yes (UART1 328PB only), 328PB, BOD 2.7V, LTO disabled, 16 MHz external"


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\MAGUIRES\AppData\Local\Arduino15\packages\MiniCore\hardware\avr\2.0.3/avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328PB
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega328PB is 1E 95 16
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Wrong microcontroller found.  Did you select the right board from the Tools > Board menu?

I am well and truly baffled. If it wasn't working with regards to the bootloader, I probably would have thrown the towel in but this is bugging me! And I'm kidding myself. I'd still be trying to sort it ha.

I am almost tempted to get a heat gun on the pcb and replace the IC.

I've brought the pcb into work, with the intention to remove the chip with a heat gun.

But then I've read somewhere that installing a 8MHz bootloader with an internal crystal, can cause upload issues. So maybe the current bootloader, which is installed (no idea what is actually installed) is the 8MHz.

I'm thinking of updating the AVR Cores via the board manager, as I'm unsure if I have done this already, which I found from another thread;

And from Arduino;
https://www.arduino.cc/en/guide/cores

Although I think that will only help for the specific hardware, but it's work a try.

I'm hoping an USPasp will arrive today

exiledyorkie:
https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
along with using a 10uF capacitor across reset and GND.

Capacitor does not help if "Using Programmer: stk500v1" - from previous. It is for older versions of Arduino SW.

From this:
avrdude: Dbraidevice signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega328PB is 1E 95 16

  • Double check chip, or use -F to override this check.*

it looks like you have different MCU. You have choose ATmega328P, not PB. However, in this specific case you was able to communicate with the target. We need to see also the uploading command in the log, or description what are you trying momentary. In this case it looks like uploading via serial line:
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200

But then I've read somewhere that installing a 8MHz bootloader with an internal crystal, can cause upload issues. So maybe the current bootloader, which is installed (no idea what is actually installed) is the 8MHz.

From your previous post it is obvious that the chip is configured for 16MHz.
I do not know what you have read but if everything is configured correctly then there should not be any problem with upload.

Your ISP connection must be wrong. Make sure you have MCU soldered properly without cold joints.

Budvar10:
Capacitor does not help if "Using Programmer: stk500v1" - from previous. It is for older versions of Arduino SW.

From this:
avrdude: Dbraidevice signature = 0x1e950f (probably m328p)
avrdude: Expected signature for ATmega328PB is 1E 95 16

  • Double check chip, or use -F to override this check.*

it looks like you have different MCU. You have choose ATmega328P, not PB. However, in this specific case you was able to communicate with the target. We need to see also the uploading command in the log, or description what are you trying momentary. In this case it looks like uploading via serial line:
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
From your previous post it is obvious that the chip is configured for 16MHz.
I do not know what you have read but if everything is configured correctly then there should not be any problem with upload.

Your ISP connection must be wrong. Make sure you have MCU soldered properly without cold joints.

I'll have to recheck the command log this evening (UK) as currently at work. I did try to upload it all, but it was rejected as being over 6k characters.

I did purposely set the device to 328p and 328pb, to see if it made a difference. I took a photo of my settings and it looks like the error was from setting it as a 328pb, as follows;

Board:Atmega328
Clock:16 MHz external
BOD: BOD 2.7V (although my original attempt was to use 1.7V)
Compiler LTO: LTO Disabled
Variant: 328PB
Bootloader: Yes (UART1 328PB only)
Port:COM4

I will check the soldering for cold joints too. I have the IC in my car, so will have a peep shortly.

Well, that's one step closer, being set to 16MHz.

Just an update.

I’ve received an usbasp. I tested it with avr extreme and an Uno, which I know works. It read everything but the fuses. Not sure why. I managed to Upload a sketch to the uno via the Arduino IDE.

I’ve added 328p to avr extreme, although I’m not convinced that it works correctly as an error pops up about a bitmap after editing the chips.xml file.

The 328pb chip will not be read or upload anything via the usbasp. I’ve checked and rechecked multiple time the wiring and soldering. I’m just going to try and replace the chip as I’ve spent hours with this and unsure what else to do really.

Well, if not even USBasp can upload, it will be probably really better to replace the chip.

That's what I thought, whilst waving my white flag. The USBasp uploaded the bootloader and sketch fine to an Uno clone too.

The chip is off, as I blasted it with a heat gun at work. I've got both 328P's and 3287PB's at home. I'm almost tempted to go with the former. Any advice to whether I should bin the PB off or have I just had a tricky experience?

There seems to be an awful lot of threads and advice out there with similar problems but not all of it worked for myself.

I'll update the thread once it's sorted, in case anybody else has the same mither in the future.