Cannot recognise Atmel 328 PU on breadboard

Context: I am trying to (eventually) load a bootloader to a 328-PU on a breadboard using an Arduino Mega 2560 Clone. I am using the Nick Gammon instructions on Gammon Forum : Electronics : Microprocessors : How to make an Arduino-compatible minimal board and initially his Atmega_Board_Detector sketch.
The 328-PU is from mouser ( I have 3, and all three cannot be detected)

The sketch uploads fine, but cannot detect the 328-PU and times out with a "chip not detected" message

I have very carefully checked and verified connections. I have tried this with 1) No crystal connected 2) with a 16Mhz crystal and 3) using the external clock source on pin 9 produced by the AT mega via the sketch.
There is a 10k Pull up resistor on the reset line and 0.1microfarad capacitors between Vcc and ground close to chip.
I am using the ISCP pin out connections for MISO MIPO SCK and Reset on the AT mega
When the 16Mhz crystal is connected a scope shows no discernible output, although I gather a brand new 328 is set up to use the internal oscillator

I have a spare ATmega 2560 which shows the same behaviour

I also have an olimex AVP-ISP-Mk2, but at the moment connecting that up is quite beyond me.

Questions - What am I missing here? 24 hours of messing around and no progress been made. Is the board detector sketch suitable for an ATmega 2560 ( it uploads fine). Does the fact that the ATmega being a clone have any bearing.

Really would be genuinely grateful for any suggestions as this is driving me quite potty. Assembly language is easy compared to all this...!

What pins on the Mega are you using, exactly? The SPI pins are not in the same place on the Mega as they are on the Uno. Does the sketch use hardware SPI, or is it bit banging it?

Any I have ever bought (which is MANY) default to 16MHz, needing a crystal. You have to burn the fuses to change them.

I've used pins 52, 51, 50 and 53 ( which are the SPI pins on the AT mega apparently) as well as the ISCP connector close to the reset switch.

I believe it is bit banging rather than hardware SPI, but beyond my knowledge for the moment

Just going to walk through this:

  1. Load the "Arduino as ISP" sketch on to the Mega.
  2. connect the ISP wires.
  3. select target "Arduino Uno" (in your target sketch), since the IDE won't just let you select a bare mcu.
  4. Upload using "Upload using programmer".

I use an Uno and this works fine.

If it's bit banging the SPI stuff, have you looked in the sketch to see if it changes pins when compiled for a Mega? Or is it trying to use pins 10-13?

Thanks - however I was using 10-13 before realising that the Mega had a different pin out. However I'm going to look a bit more closely at the sketch!

If you only buy atmega328 which have had the Uno bootloader pre-burned into them, then that would indeed require an external 16MHz crystal (+ 2x 22nf caps) or an external 16MHz 3-pin oscillator. If that's the case, you don't need to burn a bootloader at all. You can upload code using a serial-USB adapter.

But if you buy a truly "bare" (from the factory) atmega328, they have no bootloader and they are set use their internal 1MHz oscillator, so don't need an external crystal attached.

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