Bootloader bug! Read me!
Moderator: adafruit

Bootloader bug! Read me!

by adafruit on Sat Jan 03, 2009 5:38 pm

I made an annoying mistake on early (v1.0) Fuzebox kits and chips: I didn't set the lockfuses right and so there's nothing keeping you, the gamer, from overwriting it!
Yeek!

There's a couple things you can do to fix it

1) if you have a AVR programmer, use avrdude to run this command "avrdude -c usbtiny -p m644 -u -U lock:w:0x2F:m" and replace usbtiny with whatever programmer you've got. Then double check by running "avrdude -c usbtiny -p m644 -u -U lock:v:0x2F:m" which will verify it

2) If you dont have an AVR programmer, edit avrdude.conf (for windows it sits somewhere around C:\WinAVR\bin but you may have to 'find file' if you're not sure)
Scroll down/search until you find the part that says
Code: Select all | TOGGLE FULL SIZE
#------------------------------------------------------------
# ATmega644
#------------------------------------------------------------

# similar to ATmega164

then scroll down a little more until you find the part that says
Code: Select all | TOGGLE FULL SIZE
    memory "flash"
        paged           = yes;
        size            = 65536;
        page_size       = 256;
        num_pages       = 256;
        min_write_delay = 4500;

and replace that with
Code: Select all | TOGGLE FULL SIZE
    memory "flash"
        paged           = yes;
        size            = 63488;
        page_size       = 256;
        num_pages       = 248;
        min_write_delay = 4500;


note that size has been changed to 63488, which takes out the 2K the bootloader uses, and num_pages is now 248. Then save the file. This will prevent you from overwriting the bootloader by restricting the programming software.

If you already 'bricked' your chip by overwriting the bootloader, and have no way of fixing it (because you dont own any sort of AVR programmer) please email support@adafruit.com so we can get you a replacement!

thanks!
User avatar
adafruit
 
Posts: 11719
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Bootloader bug! Read me!

by smadin on Sat Jan 03, 2009 10:19 pm

I apologize if this is a foolish question, but...if the chip's already been bricked by trying to load a too-big file over the FTDI cable, can it be fixed by reflashing the bootloader via e.g. a USBtinyISP (and then correctly setting the fuses)? I had the impression from discussion in the other threads on this issue that it could, but after reading this I'm not sure anymore.
Something there is that doesn't love a wall,
That wants it down

--Robert Frost, "Mending Wall"
smadin
 
Posts: 7
Joined: Sun Dec 28, 2008 3:29 pm

Re: Bootloader bug! Read me!

by adafruit on Sun Jan 04, 2009 2:05 am

Yes, sorry that wasnt clear
if you 'bricked the chip' its not actually damaged...you can easily reprogram it with an AVR programmer such as a STK board, AVRISP or usbtinyisp. but some people might not have one
User avatar
adafruit
 
Posts: 11719
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Bootloader bug! Read me!

by smadin on Sun Jan 04, 2009 9:07 am

That's what I was hoping, thanks! Looking forward to getting back up and running once my USBtiny kit arrives :)
Something there is that doesn't love a wall,
That wants it down

--Robert Frost, "Mending Wall"
smadin
 
Posts: 7
Joined: Sun Dec 28, 2008 3:29 pm

Re: Bootloader bug! Read me!

by nkhorman on Sun Jan 11, 2009 9:22 pm

ok, so I borked the bootloader by flashing a hex file via serial that was too large.
I would like to restore it (which I know has to be done via ISP), but I can't locate the bootloader that was used for the fuzebox kit.
can someone point me in the right directon ?

tia
nkhorman
 
Posts: 4
Joined: Sun Jan 11, 2009 9:17 pm

Re: Bootloader bug! Read me!

by koolkat on Sun Jan 11, 2009 9:25 pm

nkhorman wrote:ok, so I borked the bootloader by flashing a hex file via serial that was too large.
I would like to restore it (which I know has to be done via ISP), but I can't locate the bootloader that was used for the fuzebox kit.
can someone point me in the right directon ?

tia


http://ladyada.net/make/fuzebox/download.html
User avatar
koolkat
 
Posts: 358
Joined: Tue May 06, 2008 8:42 pm
Location: Missouri

Re: Bootloader bug! Read me!

by nkhorman on Sun Jan 11, 2009 10:02 pm

koolkat wrote:
nkhorman wrote:ok, so I borked the bootloader by flashing a hex file via serial that was too large.
I would like to restore it (which I know has to be done via ISP), but I can't locate the bootloader that was used for the fuzebox kit.
can someone point me in the right directon ?

tia


http://ladyada.net/make/fuzebox/download.html


um... ya... been there, got that.... correct me if I'm wrong, but there is no bootloader in that package.
nkhorman
 
Posts: 4
Joined: Sun Jan 11, 2009 9:17 pm

Re: Bootloader bug! Read me!

by adafruit on Wed Jan 14, 2009 6:11 pm

you're not wrong, i forgot about it! the bootloader code is up there now, enjoy!
User avatar
adafruit
 
Posts: 11719
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Bootloader bug! Read me!

by nkhorman on Thu Jan 15, 2009 2:36 am

ladyada wrote:you're not wrong, i forgot about it! the bootloader code is up there now, enjoy!


Thank you!

In case anyone cares and you have one of these wigglers laying around like I did, that you wanna use for ISP programming instead of buying something, the avrdude.conf config section follows;

Code: Select all | TOGGLE FULL SIZE
# Parallel port programmers.
programmer
  id    = "lwig";
  desc  = "LART Wiggler";
  type  = par;
  reset = 4;
  sck   = 2;
  mosi  = 3;
  miso  = 11;
;


and a recreation of the wiggler schematic w/ a cable for the 6 pin ISP header.

This worked 1st try with no problems.

Cheers.
Attachments
wiggler.png
LART Wiggler to AVR 6 pin ISP
wiggler.png (24.38 KiB) Viewed 5228 times
nkhorman
 
Posts: 4
Joined: Sun Jan 11, 2009 9:17 pm