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?
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?
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.