EEVblog Electronics Community Forum

Electronics => Microcontrollers => Topic started by: IvoS on August 27, 2013, 03:09:59 pm

Title: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 03:09:59 pm
I was playing with the 328P chip and I screwed up the bootloader. Now I need to burn the bootloader back. I was trying to use my MiniPro programmer loading the 328 bootloader hex file to it but it didn't work because there are bunch of fuses that I don't know how to set them up. Is that the only way to load the bootloader into the chip by using the ICSP header? I also have FTDI friend board that I can possibly use?
Title: Re: Arduino UNO bootloader
Post by: sacherjj on August 27, 2013, 03:29:25 pm
Yes, you need to flash it via the ICSP header.  You can use an ICSP programmer and another Ardunio device.  Spark Fun has a pretty good page on this: https://www.sparkfun.com/tutorials/247 (https://www.sparkfun.com/tutorials/247)
Title: Re: Arduino UNO bootloader
Post by: ColinA on August 27, 2013, 03:57:29 pm
http://arduino.cc/en/Tutorial/ArduinoISP (http://arduino.cc/en/Tutorial/ArduinoISP)
Title: Re: Arduino UNO bootloader
Post by: MatCat on August 27, 2013, 04:01:54 pm
You can also bitbang the AVRDUDE protocol with FTDI as well: http://doswa.com/2010/08/24/avrdude-5-10-with-ftdi-bitbang.html (http://doswa.com/2010/08/24/avrdude-5-10-with-ftdi-bitbang.html)
Title: Re: Arduino UNO bootloader
Post by: Thor-Arne on August 27, 2013, 05:17:36 pm
Try with these switched on:
Uno R2: SPIEN, EESAVE, BOOTRST, BODLEVEL1, BLB12, BLB11
Uno R3: SPIEN, BOOTRST, BODLEVEL1, BLB12, BLB11

At least that's what my MiniPro reads from the 328P.
Title: Re: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 06:57:33 pm
could someone send me the actual hex file please?
Title: Re: Arduino UNO bootloader
Post by: Thor-Arne on August 27, 2013, 08:12:11 pm
First check your voltages.

If voltage to the 328 is ok, check that the Uno is recognized on the usb.

If it's not, then it can be that the Atmega8U2/16U2 that is bricked.

If this is the case, you might be able to reprogram it with ICSP.

You don't need ICSP for programming the 328, the minipro will do it just fine.
Title: Re: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 09:01:44 pm
Yes, the UNO board is recognized under device manager as Arduino Uno, so the  Atmega8U2/16U2 must be good.
I didn't do anything with the board other than I physically removed the chip from the socket (f*cked up the bootloader  |O) and put it back to socket. No matter what I do I can not program the bootloader using MiniPro.

I am getting this error: avrdude: stk500_getsync(): not in sync: resp=0x00
To me is that the 328P chip is not communicating.
Title: Re: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 09:21:19 pm
using minipro, I am getting this error, did I forget to check something?
Title: Re: Arduino UNO bootloader
Post by: Thor-Arne on August 27, 2013, 09:23:57 pm
Hm, it means that the Atmega8U2/16U2 still is alive. There can still be something wrong with it however.

If only removing and inserting the 328 bricked it, I suspect ESD as the culprit here.
I've done that many times and it was never a problem, however always done in a ESD safe environment. If this is the case, you need a new 328 chip.

Does burning with the minipro succeed? Does it verify ok?

When burning with the minipro  the hex files contains both the bootloader and the program space.
If successful the 328 should run that program when powered up, normally flashing the led on D13.

I'm not sure about the error message from avrdude.
It's possible that the Atmega8U2/16U2 is not communicating correctly with the 328.
Do you have any activity on the RX/TX leds?
Title: Re: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 09:25:45 pm
RX TX LEDs flashing just a few times, and then they stop
Title: Re: Arduino UNO bootloader
Post by: Thor-Arne on August 27, 2013, 09:28:26 pm
using minipro, I am getting this error, did I forget to check something?

You does not have a project (*.prj) file opened, you need to open the project file which will set all fuses and data/code memory.
Title: Re: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 09:29:12 pm
I just programmed fuses first and then the code memo. No error. But still no go in Arduino Uno.
Title: Re: Arduino UNO bootloader
Post by: IvoS on August 27, 2013, 09:32:40 pm
Kick me in the head!  |O |O
Yes! It works now! didn't open the file in prj option. All works now. Many thanks.  :-+
Title: Re: Arduino UNO bootloader
Post by: Thor-Arne on August 27, 2013, 09:33:54 pm
You're welcome  :)
Title: Re: Arduino UNO bootloader
Post by: westfw on August 27, 2013, 11:06:17 pm
Quote
there are bunch of fuses that I don't know how to set them up.
The appropriate fuse values for an actual Arduino are listed in hardware/arduino/boards.txt
or in the bootloader Makefiles in hardware/arduino/bootloaders/optiboot/...
(If you want it to function differently, you should use a fuse calculator like http://www.engbedded.com/fusecalc/ (http://www.engbedded.com/fusecalc/) to figure out the values.  Or pour over the chip datasheet...)

Title: Re: Arduino UNO bootloader
Post by: IvoS on August 28, 2013, 07:00:52 pm
Thanks, I tried that website info already but unfortunately that didn't work.
Title: Re: Arduino UNO bootloader
Post by: Rick Law on August 30, 2013, 03:33:57 am
Thanks, I tried that website info already but unfortunately that didn't work.

Don't try anything fancy.

I followed the instruction from the Arduino website, use a working UNO connected to a virgin ATMega on a breadboard.  First run I had a problem.  I recheck (a cap or a resistor that they said must be there) and then next run I followed the instruction very very carefully and the bootloader loaded onto the virgin ATMega328 no problem.

Nothing fancy, no short cuts, just followed the instructions closely.

Jameco sells ATMega328 with Ardunio bootloader already loaded at a slight premium.  When I killed mine, I didn't have a working UNO.  I got the bootloader-already-installed ATMega from Jameco to get the UNO working.  I then get a blank 328 from Tayda and loaded the bootloader on it.  Now I know I won't get caught like I did the first time.

Rick
Title: Re: Arduino UNO bootloader
Post by: davec on August 30, 2013, 08:29:51 am
Not sure if it's the same issue, but I've used the mini pro in the past to recover from seemingly dead arduino's. I have always managed to get them running again.

More details here:

http://blog.tynemouthsoftware.co.uk/2013/05/arduino-revival-with-eprom-programmer.html (http://blog.tynemouthsoftware.co.uk/2013/05/arduino-revival-with-eprom-programmer.html)

I don't expect it's the case here, but I did have an email conversation with someone about similar problems and further investigation finally showed he had put the ATMega328P back the wrong way around in the UNO board. It worked fine once rotated!

Thanks,

Dave