So I made the stupid mistake of setting the lfuse on my ATTiny2313 to E0, that is, external clock mode. After setting this, I constantly get the error from avrdude:
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
I checked the connections a ton of times, and read that setting the fuse to an external clock can cause this problem, so I've concluded that that is what is going on. I also read that you can re-program the chip's fuses if you provide an external clock. So I programmed an ATMega32 with a simple program that alternates port B every 8 clock cycles. With the default 1 MHZ oscillator I get a 125khz output, great! So I hooked this up as the tiny2313's clock (on the xtal1 pin) and the tiny2313 ran the code that was on it, great! But then when I tried to program it (with the clock hooked up), I still got that error. Checked the wiring again and again to no avail... still the initialization failed error. I am trying to run the command
avrdude -c usbtiny -p attiny2313 -U lfuse:w:0xFF:m
Is it just not possible to program with the ISP if I am supplying an external clock?
Thanks so much for the help! I would be happy to write a quick tutorial re: what to do if you set the avr to external clock if I can get this figured out.
-Colin
Programming a chip with an external clock?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 10
- Joined: Fri Nov 02, 2007 9:07 pm
-
- Posts: 10
- Joined: Fri Nov 02, 2007 9:07 pm
-
- Posts: 1645
- Joined: Sat Nov 10, 2007 12:59 am
might pay to diddle the avrdude bitrate. the default, as per the man page, is "suitable for target MCUs running at 4 MHz clock and above."
the bitrate is specified in microseconds. your 125KHz clock has a period of 8us and lady ada's tinyisp pages say the target clock should be 4x the spi clock, so we want a 125KHz/4 spi clock. that's a 32us period, but you may want to go a little higher, (i.e. slower), in case the clock from your mega32 is a tad slow.
note, i have not tried this myself. it's based solely on what i've read and possibly grossly misunderstood. i would maybe try...
avrdude -B 32 -c usbtiny -p attiny2313 -U lfuse:w:0xFF:m
the bitrate is specified in microseconds. your 125KHz clock has a period of 8us and lady ada's tinyisp pages say the target clock should be 4x the spi clock, so we want a 125KHz/4 spi clock. that's a 32us period, but you may want to go a little higher, (i.e. slower), in case the clock from your mega32 is a tad slow.
note, i have not tried this myself. it's based solely on what i've read and possibly grossly misunderstood. i would maybe try...
avrdude -B 32 -c usbtiny -p attiny2313 -U lfuse:w:0xFF:m
Please be positive and constructive with your questions and comments.