[TUT] [HARD] Supplying an external clock to the Butterfly

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I want to demonstrate and teach you what you can do if you just programmed your avr butterfly with ISP from CodevisionAVR and now can't access it.

search words: entering programming mode failed , fuse bits, lock bits, codevisionavr, codevision, ISP, STK500 , 0x940c, oscillator

I can tell you my story. I got the 0x940c error when programming with rs232.


I read I could change the lock bits back to normal with ISP-programming. I connected my butterfly to my STK500 and fired up CodeVisionAVR. I changed the lock bits and did a programming with it. After that my butterfly stopped responding.

I thought I just burned my butterfly and I got a new one. I now decided to stop program my butterfly with the USART and do further programming with ISP (if you have a STK500 you should use it) from CodeVision. I programmed it again and powered off my STK500 to do some lunch. I came back and discovered that my butterfly didnt respond! Can you imagine what frustrating that was, I just got the butterfly and now I couldn't access it, again.

The problem is that I had the CodeVisionAVR set to STK500 (because I did some STK500 programming with mega8515L). And STK500 has its own software-pulse aplied to the microcontrollers in the sockets. But because I just used the ISP6PIN of the STK500 no pulse is applied to the butterfly. So when I programmed my butterfly with ISP the fuse bits were set to external oscillator like the microcontrollers in the sockets of STK500 (Codevision thought I used the micro in the sockets). That means that the butterfly has no pulse to the atmega169 on the board, and further means you can't program it with ISP (SPI) and JTAG. I then decided to give some pulses to the xtal1 pin of my butterfly to try to program the fuses back to internal oscillator. I used the xtal1 pin of the STK500 and applied it to PIN 10 of the JTAG interface (that is xtal1 on butterfly) and read successfull oscillation with my oscilloscope. But no luck at all.

I then downloaded the document of avr butterfly at:


At page "Section 7" and "High-voltage parallell-programing" (I did not do high-voltage programming) I discovered that you need to move two resistors to apply pulses to the xtal1 pin.

After that I connected my butterfly to the STK500 ISP6PIN and a wire between xtal1 on STK500 to my butterfly PIN10 of JTAG (that is xtal1/GND) pin. Note that I had no battery connected to the butterfly.

At first I did not get any response. I lowered the voltage of VTARGET and AREF to 3.4 volts. I lowered the STK500 osc and isp freq to 32.62 kHz and 5.927 kHz. (Notice you may have to lower the frequence WHILE the STK500 is on and running with the butterfly connected with ISP6PIN and a wire from xtal1 on STK500 to xtal1 on butterfly, if its not working at the beginning, try to write the freqs again and then check if you can change the fuses)

After all that I managed to set the fuses back to internal oscillator. I removed the wire from xtal1 and turned off my STK500 and powered it up again and after that I could program my butterfly with ISP again without any wire to xtal1. Now I just need to change back the resistors without destroying my butterfly. :)