I’m trying to program an ATmega168 using an AVRISPmkii via the 6-pin ICSP on a board I “designed” (my first).
I have VCC connected to a PSU and the AVRISPmkii connected to the ICSP header. The AVRISPmkii’s LED is solid green at this point. When I try to program it using avrdude the LED on the AVRISPmkii changes to flashing red and avrdude reports:
bad AVRISPmkII connection status: MOSI fail
The chip works fine on the board (it runs the program on it properly, responding to inputs and doing the right thing for outputting to a display), as I’d previously programmed it on a breadboard. It has the Arduino bootloader on it, in case that’s relevant.
The ABRISPmkii is able to program the same chip if I move the chip from the custom board onto an Arduino Diecimla board, using the exact same avrdude command.
I’ve checked the board for shorts. I’ve checked for continuity on the 6 connections, from the pins on the headers to the pins on the chip, 5V and GND.
I presume this means there’s something wrong with the board design, but I can’t see what I might have done wrong.
This is the main part of the schematic:
The full avrdude command line and output is:
$ /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf -patmega168 -cavrisp2 -Pusb -Uflash:w:/var/folders/v9/qn7wvjqs18v6g5j_wlxxs2pw0000gn/T/build4459692069199443819.tmp/badminton_scoreboard_beep.cpp.hex:i -vvvv
avrdude: Version 5.11, compiled on Sep 2 2011 at 18:52:52
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is “/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/Users/dave/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : avrisp2
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200033610
avrdude: usbdev_open(): using read endpoint 0x82
avrdude: Sent: . [01]
avrdude: Recv: . [01] . [00] . [0a] A [41] V [56] R [52] I [49] S [53] P [50] _ [5f] M [4d] K [4b] 2 [32]
avrdude: stk500v2_getsync(): found AVRISP mkII programmer
AVR Part : ATMEGA168
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 512 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 16384 128 128 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel AVR ISP mkII
Programmer Model: AVRISP mkII
avrdude: Sent: . [03] . [90]
avrdude: Recv: . [03] . [00] . [01]
avrdude: Sent: . [03] . [91]
avrdude: Recv: . [03] . [00] . [01]
avrdude: Sent: . [03] . [92]
avrdude: Recv: . [03] . [00] . [0c]
Hardware Version: 1
Firmware Version Master : 1.12
avrdude: Sent: . [03] . [94]
avrdude: Recv: . [03] . [00] . [00]
Vtarget : 0.0 V
avrdude: Sent: . [03] . [98]
avrdude: Recv: . [03] . [00] . [06]
SCK period : 8.00 us
avrdude: Sent: . [10] . [c8] d [64] . [19] [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00]
avrdude: Recv: . [10] . [c0]
avrdude: stk500v2_command(): command failed
avrdude: Sent: . [03] . [a1]
avrdude: Recv: . [03] . [00] . [01]
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: MOSI fail
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: Sent: . [11] . [01] . [01]
avrdude: Recv: . [11] . [00]
avrdude done. Thank you.
Any idea what I might have done wrong or what further troubleshooting steps I could try?