AVRISPmkII connection status: Unknown status 0x00

Stefan Falk picture Stefan Falk · Mar 9, 2013 · Viewed 7.9k times · Source

Well.. I've been searching on the web in many corners.. but I could not find a solution to my problem. Last time I used my AVRISP2 it worked fine. Now I get the following message when I try to write my program on the uC:

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

I found many posts on the internet but there weren't any solutions. Does anyone know what the problem might could be?

I already checked the pins, I updated the firmware of the ISP (blinkdemo works).

Thank you for any hints..

Answer

Stefan Falk picture Stefan Falk · Mar 10, 2013

It took some friends of mine and me a lot of time but after hours of searching, trying and "debugging" we were able to fix the problem. I hope this helps other people who got the same problem to solve it.

The problem was that the ISP, in my case the USB-Prog 3.3, was talking too fast to my Atmega8 which was only running at 1MHz speed. So there are two possible solutions:

  • slow down the speed of the ISP
  • speed up the speed of the Atmega8

I red somewhere, that the ISP must not be faster than 1/4 of the speed of the underlaying microcontroller.

The following lines saved my day:

It sets the Atmega8 to 8MHz and gives it 64ms to spin up that frequency.

avrdude -p atmega8 -P usb -c avrispv2 -U lfuse:w:0xe4:m -U hfuse:w:0xd9:m -B 22

Here is an excerpt of the avrdude manpage:

`-B BITCLOCK'
        Specify the bit clock period for the JTAG interface or the ISP
        clock (JTAG ICE only).  The value is a floating-point number in
        microseconds.  The default value of the JTAG ICE results in about
        1 microsecond bit clock period, suitable for target MCUs running
        at 4 MHz clock and above.  Unlike certain parameters in the
        STK500, the JTAG ICE resets all its parameters to default values
        when the programming software signs off from the ICE, so for MCUs
        running at lower clock speeds, this parameter must be specified on
        the command-line.

Additionally I want to recommend AVR Fuse Calculator for Android - it seems to be a very useful tool for microcontroller-programmers.