Y'all-
I have been attempting to resolve a problem that I am experiencing when burning the bootloader onto a custom board. I've been working on this Arduino-based project for a while now, but this is the first time I have seen this problem. Although it's been posted before, I decided to create my own thread rather than dovetail onto another. So for review and clarity, here is the error I am seeing:
avrdude: stk500v2_command (): command failed
avrdude: stk500v2_program_enable (): bad AVRISPmkII connection status: 0x00 Unknown status
avrdude: initialization failed, rc = -1
Double check connections and try again, or use-F to override
this check.
Here are all of the pertinent details that I can think of at the moment (it's late):
Board uC: Bobuino, 1284 based (this is CrossRoads' product, or I should say a variant of that product)
Bootloader: optiboot
Programmer: AVR ISP mkII (first USB port on my laptop)
Board power: Via USB from the second USB port, via an FTDI -> serial breakout, which I have connected to the serial header on my board (this provides the external power that is needed when using the mkII)
Consistency: I feel relatively confident that the programmer isn't at fault because I can still use it to program sketches onto my devel boards
A little bit of background. Way way back, CrossRoads and I started with his Bobuino and removed stuff that my project didn't need, then added things I did. Over time the design morphed and changed like all projects do, but I was always able to burn the bootloader (once I had the correct drivers installed on my laptop of course). So. I had a fully working development board. Therefore it was time to move on to the production boards. Only a couple of changes were made. One change was to switch to SMT components for the crystals (1-uC, 1-RTC). I mention that because perhaps it is related to the problem, but that is just a stab. It's one of the differences between devel and prod boards. Anyway, I attempted to burn the same bootloader onto the production boards that I had burned onto the devel boards and that's when I encountered this problem. I inquired with Cross about it but he hasn't really ever seen the problem too much. So I did a Google search and found that this error has been encountered previously with several different board types. In one case the guy had a faulty AND gate that wasn't allowing the RESET pin to be brought low; in another the guy found a fault in his design. Still in other cases the problem was the speed with which the bootloader was being burned.
So naturally I have tried the remedies for all of those problems (hardwiring RESET to low, checking the circuit with my DVMM, etc.), but nothing has worked. I still get the error or some variant of an invalid signature error. Being a UNIX software type, I decided to delve into using avrdude directly (although I'm using Win7 to connect). In so doing, here is the output from one of the attempts that I made to reset the fuses:
c:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -C ..\etc\avrdude.
conf -p m1284p -c avrispmkII -P usb -B250 -vvvv -U lfuse:w:0xff:m -U hfuse:w:0xd
e:m -U efuse:w:0xfd:m
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "..\etc\avrdude.conf"
Using Port : usb
Using Programmer : avrispmkII
Setting bit clk period : 250.0
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200147136
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
Using p = 261.57 us for SCK (param = 73)
avrdude: Sent: . [03] . [98]
avrdude: Recv: . [03] . [00] . [03]
avrdude: Sent: . [02] . [98] I [49]
avrdude: Recv: . [02] . [00]
AVR Part : ATMEGA1284P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
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 Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 10 128 0 no 4096 8 0 9000 90
00 0xff 0xff
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
flash 65 10 256 0 yes 131072 256 512 4500 45
f 0xff
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
adBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
------
lock 0 0 0 0 no 1 0 0 9000 90
0 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
adBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
------
lfuse 0 0 0 0 no 1 0 0 9000 90
0 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
adBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
------
hfuse 0 0 0 0 no 1 0 0 9000 90
0 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
adBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
------
efuse 0 0 0 0 no 1 0 0 9000 90
0 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
adBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
------
signature 0 0 0 0 no 3 0 0 0
0 0x00
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
adBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
------
calibration 0 0 0 0 no 1 0 0 0
0 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] . [0a]
Hardware Version: 1
Firmware Version Master : 1.10
avrdude: Sent: . [03] . [94]
avrdude: Recv: . [03] . [00] 0 [30]
Vtarget : 4.8 V
avrdude: Sent: . [03] . [98]
avrdude: Recv: . [03] . [00] I [49]
SCK period : 261.57 us
avrdude: Sent: . [10] . [c8] d [64] . [19] [20] . [00] S [53] . [03] . [ac] S
[53] . [00] . [00]
avrdude: Recv: . [10] . [00]
avrdude: AVR device initialized and ready to accept instructions
Reading | | 0% 0.00s
avrdude:
Sent: . [1d] . [04] . [04] . [00] 0 [30] . [00] . [00] . [00]
avrdude: Recv: . [1d] . [00] . [00] 0 [30] . [00] . [1e] . [00]
avrdude: Sent: . [1d] . [04] . [04] . [00] 0 [30] . [00] . [01] . [00]
avrdude: Recv: . [1d] . [00] . [00] . [00] . [00] . [00] . [00]
Reading | ################# | 33% 0.08s
avrdude:
Sent: . [1d] . [04] . [04] . [00] 0 [30] . [00] . [02] . [00]
avrdude: Recv: . [1d] . [00] . [00] . [10] . [00] . [00] . [00]
Reading | ################################################## | 100% 0.15s
avrdude: Device signature = 0x1e0000
avrdude: Expected signature for ATMEGA1284P is 1E 97 05
Double check chip, or use -F to override this check.
avrdude: Sent: . [11] . [01] . [01]
avrdude: Recv: . [11] . [00]
avrdude done. Thank you.
And of course if I make repeated attempts at running avrdude, I can