I broke the bootloader

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
HolyCarHorn
Posts: 21
Joined: Wed Dec 11, 2013 4:03 pm

I broke the bootloader

Post by HolyCarHorn »

I seem to have accidentally broken my bootloader. I tried to run a (probably broken/partial) copy of megasokabon, halfway through loading it the screen went black. And now I can't get back to the bootloader. I don't have a cord for the programming interface, but I could theoretically connect the uzebox to my arduino and flash it from there. Theoretically if I were able to connect it, what would I do?
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: I broke the bootloader

Post by Janka »

Get the trunk/roms/Bootloader.hex from the Uzebox SVN, connect the Uzebox to Arduino, then flash the Bootloader.hex into the Uzebox with

Code: Select all

$ avrdude -c stk500v1 -p m644 -P usb -U flash:w:Bootloader.hex
Some versions of avrdude may support "arduino" instead of "stk500v1".
HolyCarHorn
Posts: 21
Joined: Wed Dec 11, 2013 4:03 pm

Re: I broke the bootloader

Post by HolyCarHorn »

Thanks!

so... I got this error.

Code: Select all

avrdude: ser_open(): can't open device "usb": No such file or directory

avrdude done.  Thank you.
I tried changing usb to the serial port I normally use for my arduin (that would be: /dev/ttyACM0)
which gave me this error:

Code: Select all

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
then I changed stk500v1 to arduino(still using my arduino serial port) and got this:

Code: Select all

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATMEGA644 is 1E 96 09
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.
So... any ideas what I'm doing wrong. It could be that I wired the pins wrong. I soldered some wires to the bottom of the isp socket. If the ground is the pin closest to the audio jack then I probably did it right.

Edit: I just discovered I did have the pins wrong because the green light wasn't on. So I re-wired it. Unfortunately I still get my errors.
Edit: It's also worth noting my pins are connected as so:
Arduino pin 10 to reset
Pin 11 to MISO
Pin 12 to MOSI
Pin 13 to SCK
5v to 5v
gnd to gnd
User avatar
D3thAdd3r
Posts: 3293
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: I broke the bootloader

Post by D3thAdd3r »

Hmm don't know anything about avrdude but if it can read the chip signature and it is that close seems the wiring is fine. A bit too lazy to dig out my mkii ISP to see if that signature is actually right; and since it is basically "bricked" until you can program it I would just try the -F to override that check and see if she works? All else fails trade the chip via mail with an Uzer who has a working ISP in your country I'd think.

Edit-Ok I pulled out my mkii(needed to get it working on my windows h8te machine anyhow) and my chip is returning 0x1E 0x96 0x09 for an Atmegga 644 20pu 1224. Did you get the chip with an official Uzebox kit or is this a homebrew setup? If it were my chip I would flash it.
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: I broke the bootloader

Post by Janka »

1e 95 0f is ATmega328. Are you sure you aren't trying to flash the arduino itself? Your cabling is likely to be wrong.

See e.g. this tutorial https://www.sparkfun.com/tutorials/200 on how to set up the arduino as a flash tool for programming other AVR controllers.
User avatar
uze6666
Site Admin
Posts: 4823
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: I broke the bootloader

Post by uze6666 »

Can you PM me the hex file that broke your bootloader, i'll check it out. This is suprising since the bootloader has protections to prevent overwriting.
HolyCarHorn
Posts: 21
Joined: Wed Dec 11, 2013 4:03 pm

Re: I broke the bootloader

Post by HolyCarHorn »

Janka wrote:1e 95 0f is ATmega328. Are you sure you aren't trying to flash the arduino itself? Your cabling is likely to be wrong.

See e.g. this tutorial https://www.sparkfun.com/tutorials/200 on how to set up the arduino as a flash tool for programming other AVR controllers.
Yeah that was my guess. I'll retry using those instructions.
uze6666 wrote:Can you PM me the hex file that broke your bootloader, i'll check it out. This is suprising since the bootloader has protections to prevent overwriting.
Sure! give me a sec though, my 'puter doesn't play well with sd cards, so I'll have to borrow someone elses.

Edit: Just gave it a shot, and unfortunately it's still not working. I did get it connected right (at least I think I did, the power came on on the uzebox) I think I'll try soldering my wires to the ext connections instead of the isp socket.

Edit Edit: Still not working. I plugged in the reset pin to pin 8(that would be the error pin, that lights up when there is an error. I presumed if there was an error the uzebox light would go off because the pin was being powered, which proceeded to happen. (I know it's not the recommended thing to do but I was lazy)) Curious question, is there any circuitry involved or am I just supposed to plug the miso, mosi, sck,... right into the arduino?
HolyCarHorn
Posts: 21
Joined: Wed Dec 11, 2013 4:03 pm

Re: I broke the bootloader

Post by HolyCarHorn »

Well I still can't seem to get it to work. I think I might try on a different 'puter when I have a chance. I was thinking though... maybe it's not the bootloader at all. Maybe it's something else entirely maybe it just shorted somewhere...

Edit: I wasn't able to get it to work on a different computer

And here is the file that supposedly caused my trouble. If someone is willing to take the risk of testing it please tell me what happens:http://www.mediafire.com/download/f1zas ... okoban.uze
User avatar
Kerby
Posts: 90
Joined: Wed Feb 06, 2013 6:02 pm

Re: I broke the bootloader

Post by Kerby »

Hi!
I had a similar situation last year. When you download a file from the SD card turned out a failure, when you restart a black screen! Connecting through ISP connector programmer gave nothing! When installing the Atmega 644 programmer through the parallel port of the computer chip undecided! The conclusion was one - block FUSE write bits Atmega 644 :( . Unlikely, but ... We had to make a separate device for Atmega8 which restores the factory FUSE bits per chip sick! And then re-programmed in the programmer!
Here's a story ... now it works! :)
HolyCarHorn
Posts: 21
Joined: Wed Dec 11, 2013 4:03 pm

Re: I broke the bootloader

Post by HolyCarHorn »

Great! Um... so what exactly do I have to do to fix it? Something like this I'd imagine? http://www.evilmadscientist.com/2007/fi ... on-an-avr/

Edit: I gave the above a try but it keeps cutting interactive mode because:

Code: Select all

avrdude: stk500_recv(): programmer is not responding
I definitely think kerby found the problem though, I'm going to see if I can find an argument that could override the "responding" dependence
Post Reply