Seriously this is what is happening.
I upload the ArduinoISP sketch to the UNO with the port set to com4, the board is set to UNO and the programmer set to AVRISPmkII and that works.
Then I open the blink sketch and change the programmer to Arduino as ISP and upload the sketch but it programmes the UNO not the off board chip.
I have rebuilt the off board circuit twice, checked it 20 times and if the wiring is wrong I'm an idiot.
What is happening?
Connect the USB cable to the PC and ISP Arduino UNO
Install the ArduinoISP sketch in the ISP Arduino:
File->Examples->ArduinoISP
Tools->Board->Arduino Uno
Tools->Port->(serial port for ISP Arduino)
File->Upload
Added a 10 uF capacitor to the ISP Arduino UNO with the positive side of the capacitor going to Reset and the negative side of the capacitor going to Ground.
Go to Preferences... and check the box for "Show verbose output during: [ ] compilation [X] upload"
Install the breadboard wiring:
Target Pin |
Arduino Pin |
Target Pin |
Arduino Pin |
---|---|---|---|
1 | Pin 10 | 28 | |
2 | 27 | ||
3 | 26 | ||
4 | 25 | ||
5 | 24 | ||
6 | 23 | ||
7 | +5V | 22 | GND |
8 | GND | 21 | |
9 | 20 | +5V | |
10 | 19 | Pin 13 | |
11 | 18 | Pin 12 | |
12 | 17 | Pin 11 | |
13 | 16 | ||
14 | 15 |
Attempt to upload sketch:
File->Examples->01.Basics->Blink
Tools->Board->Arduino UNO
Tools->Port->(serial port for ISP Arduino)
Tools->Programmer->Arduino as ISP
File->Upload Using Programmer
If the chip expects a crystal and doesn't have one the attempt will fail like this:
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check..
This is a symptom of the target chip's clock not running. An ATmega328P that is expecting a crystal won't accept serial programming without a crystal or ceramic resonator between pins 9 and 10, or an external clock injected into pin 9. I found a crystal between 8 MHz and 20 MHz (14.3180 MHz in my case) in my 'salvaged parts' box and plugged it into the breadboard between pins 9 and 10.
Attempt to upload again:
File->Upload Using Programmer
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude done. Thank you.
SUCCESS!
System wide configuration file is "C:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf"
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
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
efuse 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
Programmer Type : Arduino
Description : Arduino
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.01s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
This is what I get.
How do I check if the oscillator is running?
Once you've set external crystal, you have to use it, otherwise chip wont start. Or connect clock signal to XTAL1 pin.
If the crystal is connected, it can be checked simply with multimeter: voltage on XTAL1 pin should be 2.5V approximately.
I don't know if it needs a crystal. I can't burn a bootloader it comes up with the invalid device signature error.
I tried it with and without a crystal and I get the same problem.
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
Sounds like either your crystal isn't working or Serial Programming is otherwise disabled.
Get this modified ArduinoISP sketch from adafruit: GitHub - adafruit/ArduinoISP: A fork of the ArduinoISP that has 8mhz output clock
Upload it to your UNO and connect Pin 9 of the UNO to pin 9 of the ATmega328P you are trying to program. That will provide a temporary 8 MHz clock to allow programming without a crystal. Try Burn Bootloader again.
If it still fails with "Device signature = 0x000000" you might have a chip with configuration fuses set to disable serial programming. To fix it you will need something like the HV Rescue Shield 2 from MightyOhm (HV Rescue Shield 2 | MightyOhm). That uses High Voltage Parallel Programming to reset your ATmega328P to factory defaults. Of course your ATmega328P may be defective and can't be recovered.
Crystal may be also defective so try to connect external clock as John mentioned. It could help if the chip is bricked.
However, the error means that there is no connection between programmer and MCU. There are several reasons and between them there are: incorrect wirring or bad quality of connection, missing clock, fuse setting etc. I think, no one can be excluded at this moment.
And another thing, if you are using Arduino as ISP did you try reload the ISP sketch?
johnwasser:
Sounds like either your crystal isn't working or Serial Programming is otherwise disabled.Get this modified ArduinoISP sketch from adafruit: GitHub - adafruit/ArduinoISP: A fork of the ArduinoISP that has 8mhz output clock
Thanks for this. It seems to work. When I use a multimeter I get 2.5v with pin 9's connected, but 0.8v when the crystal is inserted. This seems to indicate a problem with the crystal.
I have a 10uF cap between gnd and reset on the UNO and when I burn the bootloader it seems to work. Then I try and upload a sketch to the off board ship and I get the following error. "not in sync: resp=0xbf"
if I disconnect the 10uF cap it programmes the UNO even though the programmer selection is still set to Arduino as ISP.
OK I swapped the off board chip with the one on the UNO and I can programme it (Yay!). When I swap it back it runs the blink programme. (still using ArduinoISP2 to send a clock signal)
When I try to programme is via the UNO I still get the same problems.
My wiring, which must be right because I got the burn bootloader to work.
Uno D13 -> pin19
Uno D12 -> pin18
Uno D11 -> pin17
Uno D10 -> pin1
Uno D9 -> pin9
10uF betweeen UNO reset and ground
Wrong caps!!!
The sales person sold me 22nF (223) not 22pf(22) caps that's why the crystal was not working. I have just left them our for now.
Still can't upload sketch to the off board chip.
OK so I found a video tut by DCU Engineering to use the following pins
FIRST CAREFULLY REMOVE THE ATMEGA328 from the UNO board.
Then connect the following pins.
UNO RESET -> Pin 1
UNO D0(RX) -> Pin 2
UNO D1(TX) -> Pin 3
UNO 5v -> Board 5V Disconnect external power supply
UNO GND -> Board GND
Then select the programmer AVRISP mkII
Your external chip must have a 16mHz clock
I hope this helps those who are struggling to use the UNOasISP method.
Here's the link