I’m having some trouble installing a bootloader on a 328.
Following these instructions : https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
I’ve succeeded in installing bootloaders before.
I am designing my first pcb and want to check everything works, so I’m breadboarding it.
On the PCB all will be connected and I will have to install a bootloader, so I’m also checking if this works.
With everything connected on the breadboard(nearly every pin occupied) I’m not able to install the boot loader. (circuit is working correctly)
Does this make sense, do i need to remove all connections other than the required ones? (which will be difficult on the final pcb)
You need to remove other things connected to the SPI pins.
If those pins are connected to other SPI devices, putting a pull-up resistor on their CS lines should be enough otherwise, while the ISP programmer holds the chip in reset, those pins will float, sometimes being logic low, which makes the corresponding SPI device think it's being addressed and grab onto the MISO line).
If the devices on those pins aren't SPI devices, you need to disconnect them, or ensure that they wouldn't load the pins or try to drive them.
Also, the ArduinoToBreadboard tutorial omits a critical component - you need a 0.1uF ceramic cap between Vcc and Gnd, and AVcc and Gnd. These should be RIGHT next to the chip - like, in the hole closest the '328p - they don't do their job if you put them inches away from the chip. Without these essential decoupling capacitors, even if you can upload code, the chip may freeze or reset semi-randomly during operation. The diagram also depicts the crystal halfway across the breadboard, which is much more likely to fail - the crystal should be right next to the chip, as should the two loading caps. (in summary, that tutorial sucks; these issues have been reported many times to no avail. It's as if they have some financial interest in people not building their own breadboarduinos and don't want people to be successful... oh wait...).
Generally speaking, whenever you have any sort of integrated circuit, unless the datasheet says otherwise, you need a 0.1uF cap between power and ground right next to the chip. This is usually mentioned in passing in the datasheets, but it's such a universal requirement that they don't usually talk much about it.
Thanks for the reply.
Got it working (for some chips).
It appears that of the 5 Atmega's I have only 2 seem to accept the bootloader.
I could verify that the 2 working chips use the external oscillator (scope) prior to te installation.
This would mean they already had a bootloader on them (?)
The other 3 don't show any signs of a working external oscillator, which could mean they don't have the bootloader installed, or are dead (?).
Chances of having 3 broken chips seem at bit small to me.
I've also tried the bootloader sketch from Nick Gammon (https://www.gammon.com.au/bootloader), but no positive effect on the 3 ( the other 2 do work)
Is there something else I can try to breath some life in the chips?
What error do you get from the broken chips?
Is it signature 000000?
That implies that it's been set to use external oscillator but you don't have one connected (or the one you have isn't actually making contact - a very common problem with breadboard)
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
Error while burning bootloader.
To reduce breadboard errors I'm now using 2 arduinos to upload the bootloader.
Same as on the breadboard works for (the same) 2 out of 5.
Did a couple of random attempts to exclude any connection problems leading to random fails. It's always the same 3 not responding.