Arduino Forum

Using Arduino => Microcontrollers => Topic started by: Krep on Sep 23, 2016, 06:55 pm

Title: Bootloader write failure - avrdude efuse problem
Post by: Krep on Sep 23, 2016, 06:55 pm
Hi,
I'm a novice in the field of microcontroller.
I've been trying to setup a bootloader in an arduino nano using arduino uno.

I followed the tutorials available on the net, using the arduino IDE to write the bootloader.

I get a strange error:

"avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xfd instead of 0x05 (double check with your datasheet first)."

 I'm using the lastest IDE - 1.6.12
should I use an older IDE, with an older avrdude?

Any advice?

Thanks
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: CrossRoads on Sep 23, 2016, 07:21 pm
That's not an Error, it's  a Warning.


The efuse only uses the lower 3 bits in the '328P, see the datasheet

Table 28-6. Extended Fuse Byte for ATmega328/328P
Unused fuse bits often read back as 1:

0xfd = 1111 1101
0x05 = 0000 0101

So fd will be just fine in place of 05.
Change the value in boards.txt (in IDE 1.6.5r5 anyway) for the Nano:
Code: [Select]


## Arduino Nano w/ ATmega328

## -------------------------

nano.menu.cpu.atmega328=ATmega328 

 nano.menu.cpu.atmega328.upload.maximum_size=30720

 nano.menu.cpu.atmega328.upload.maximum_data_size=2048

 nano.menu.cpu.atmega328.upload.speed=57600

 nano.menu.cpu.atmega328.bootloader.low_fuses=0xFF

 nano.menu.cpu.atmega328.bootloader.high_fuses=0xDA

 nano.menu.cpu.atmega328.bootloader.extended_fuses=0x05     <<<<<<<<< This value here, change to 0XFD

 nano.menu.cpu.atmega328.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex

 nano.menu.cpu.atmega328.build.mcu=atmega328p




Title: Re: Bootloader write failure - avrdude efuse problem
Post by: DrAzzy on Sep 23, 2016, 11:48 pm
This is something that you should complain to the creator of the core you're using - they need to update it to comply with avrdude's changing behavior.

You used to be able to have avrdude treat the unused bits as 0 or 1 depending on avrdude.conf, so some cores used one convention, others used the other convention. Now they decided that one convention is correct and the other isn't, and fuck everyone who designed for the way they used to do it.

In 1.6.10 (which tried 6.3 avrdude), they just *didn't work*.
In 1.6.11 they went back to 6.0 because of this.
In 1.6.12 they used a patched version that gives that warning, but still works (for now).
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Sep 24, 2016, 12:13 am
This is something that you should complain to the creator of the core you're using - they need to update it to comply with avrdude's changing behavior.
The problem is if they change the fuse values that will break compatibility with previous Arduino AVR Boards/avrdude versions. This breakage of 3rd party cores without an easy fix was the reason why they reverted from avrdude 6.3.0-arduino2 back to avrdude 6.0.1 in Arduino AVR Boards 1.6.13/Arduino IDE 1.6.11 and then patched avrdude 6.3.0-arduino6 in Arduino AVR Boards 1.6.14/Arduino IDE 1.6.12 to work with either fuse values.

Despite the warning I don't see Arduino removing the patch anytime in the near future. I believe they have submitted to patch to avrdude but I don't understand the code well enough to evaluate the chances of it getting merged.

Even Arduino AVR Boards currently causes this warning. This was a deliberate choice by the developers to avoid breakage in corner cases where an older avrdude version is being used with the current Arduino AVR Boards boards.txt file but likely the fuses will be updated in an upcoming release(see https://github.com/arduino/Arduino/pull/5182#issuecomment-248565660 (https://github.com/arduino/Arduino/pull/5182#issuecomment-248565660)).

Unfortunately I have now seen multiple reports of this warning scaring users only days after the release of Arduino IDE 1.6.12 so I'm guessing this issue will be frequently reported to any affected 3rd party core author. There is a solution to fix the warning while maintaining backwards compatibility, to update the fuse values(or not if you want to stay with avrdude 6.0.1) and specify an avrdude tool for the core. This is simple for Boards Manager installation but is more of a hassle for manual core installation because there is a different version of avrdude for each operating system type. I have investigated this option at https://github.com/MCUdude/MightyCore/issues/32 (https://github.com/MCUdude/MightyCore/issues/32). My conclusion of the best way to implement the manual installation is here (https://github.com/MCUdude/MightyCore/issues/32#issuecomment-238195865). This same information also applies to cores that want to add LTO support without breaking backwards compatibility and thus must include an avr-gcc tool.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: Krep on Sep 24, 2016, 01:05 am
I thank all of you for your input.

btw, I used the word "failure" although I only get a WARNING from avrdude, because the nano I tried to burn is bricked. I just assumed the bootloader burn procedure failed, because there is no indication that the burn actually took place. But... I guess the reason may lie elsewhere.

I'm going to play around with the boards.txt according to the advice offered here, and see if I can resurrect it...
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: Mr._Swarf on Nov 06, 2016, 12:08 am
I've changed the 0x05 extended fuse entries in my boards.txt file to 0xfd. My programmer still complains. Any ideas what I am missing?
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Nov 06, 2016, 12:12 am
My programmer still complains.
That's not useful information. Please post the full error/warning message using code tags(</> button on the toolbar).

Which version of Arduino AVR Boards are you using?

Which version of the Arduino IDE are you using?
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: Mr._Swarf on Nov 06, 2016, 12:16 am
I'm getting the same error messages as the OP. Board: clone Duemilanove, 328p IDE:1.6.11 Programmer both USBASP and USBTiny.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: DrAzzy on Nov 06, 2016, 12:19 am
What version of Arduino AVR boards?
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: Mr._Swarf on Nov 06, 2016, 12:23 am
I'll repeat... clone Duemilanove, 328p

Wait, do you mean what board in the IDE? Duemilanove/Diecilila
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Nov 06, 2016, 12:30 am
You forgot to answer this one:
Which version of Arduino AVR Boards are you using?
I'll repeat... clone Duemilanove, 328p

Wait, do you mean what board in the IDE? Duemilanove/Diecilila
You can find the Arduino AVR Boards version at Tools > Board > Boards Manager...

However, I can extrapolate from the warning message you're getting that it's Arduino AVR Boards 1.6.14, since that's the only one that will produce that warning. My first advice is just to ignore it. It's just a warning and the efuse setting you're using will cause no problems. If the time ever comes for Arduino to phase out their workaround for the change in AVRDUDE's unused fuse bits handling then they will also update those efuse values for all the Arduino AVR Boards.

But just out of curiosity you may wonder why your edit to boards.txt had no effect. There are two possibilities. The first is that you may not have restarted the Arduino IDE after making the edit. The second, and most likely, reason is that you have multiple versions of Arduino AVR Boards installed on your system. Arduino AVR Boards 1.6.13 is included with Arduino IDE 1.6.11 and is located at {IDE installation folder}/hardware/arduino/avr I'm guessing that's the location of the boards.txt you edited. However, since you have updated your Arduino AVR Boards version to 1.6.14 using Boards Manager, that's not the version that's actually being used. That version is located elsewhere. The easiest way to find the active hardware package location is as follows:

If you edit that boards.txt and restart the IDE you will find that your edits did cause a change.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: Mr._Swarf on Nov 06, 2016, 12:44 am
Yes, the curiosity got me. I did reboot after the first edit.

And of course you were correct. The IDE was using a different boards.txt file in a completely unexpected location. That has been edited and now the warnings have been quieted. Who woulda expected multiple locations.... :(

I realize it would be just as easy for many folks to just ignore the warnings. But nope. My personal flavor of brokeness will not let me leave that be. Nope. Drive me batty it would have if left alone.

So thank you for the clear explanation. It's what I needed.

Cheers!

Title: Re: Bootloader write failure - avrdude efuse problem
Post by: AniketaKabir on Dec 24, 2016, 03:20 pm
will it work despite the warning
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Dec 24, 2016, 09:26 pm
will it work despite the warning
Yes, just ignore the warning. It won't cause any problems at all.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: rezaei on Feb 02, 2017, 10:22 pm
Hi every body

I read all the posts and i cheched almost everything as expalined above.
Still I have the same problem like our friend. here is the warning and it prevent to upload the bootloader.

" ***failed; 
avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0xfd instead of 0x05 (double check with your datasheet first)."

the IDE is Arduino 1.8.1
and I am using Arduino UNO. I use the same MC as arduino (ATmega328p-AU).
I just need to program my cheep since I have a standalon board and should transfer my arduino code to this new chip.

i followed all steps as expalined in Arduino site but I have this warning.

would you Pleaseeeee help me to solve it. it is for my final project and i did not expect such a problem.

thanks
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: Mr._Swarf on Feb 02, 2017, 10:27 pm
As stated earlier in this thread this is more of a warning than an error. You can ignore the warning and get on with your final.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: rezaei on Feb 02, 2017, 10:40 pm
but how can I ignore that warning. I did all as explained in this threat. but the warning is still there.
would you please help me.

I checked the board.txt  (the main board.txt, there is only one file) and I checked the value of efuse all is correct.

i do not know how to get ride of this warning.

Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Feb 03, 2017, 12:21 am
but how can I ignore that warning.
Just pretend you didn't see it. Close your eyes if you must. This doesn't indicate any problem at all.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: ReverseSun on Mar 29, 2017, 08:48 pm
Guys Found the way. Just like our friend *CrossRoad said it just not for nano you can search and find uno, Yun and ... in boards.txt then you can edit the board's .bootloader.extended_fuses=0x05 to .bootloader.extended_fuses=0xfd and done! It won't have any warning!
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Mar 29, 2017, 11:07 pm
...or you can just update to the latest version of the Arduino IDE or Arduino AVR Boards, where the fuse values have already been changed:
https://github.com/arduino/Arduino/commit/a899b9e1a8d6522d161c2d81fdbcca86ede83294 (https://github.com/arduino/Arduino/commit/a899b9e1a8d6522d161c2d81fdbcca86ede83294)
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: MeSat on Mar 30, 2017, 04:23 am
Just to let people know, I couldn't burn the bootloader using the latest boards files from Arduino.  I downgraded from 1.6.17 to 1.6.10 and changed the boards.txt file in

   ~/.arduino15/packages/arduino/hardware/avr/1.6.10/

to the recommended settings.

I had spent 2 hours searching and editing files on my system.  For peoples information, I found at least 6 different boards.txt files on my system.  Only two of them seemed to have any affect on the IDE.  If the one listed above or the /etc/arduino/ boards.txt files were missing, then the IDE wouldn't start.

Programmed 4 CPU's once I got things working.

It may be worth downgrading to an earlier version if you are having issues.


Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Mar 30, 2017, 08:34 am
Latest version of Arduino AVR boards is 1.6.18 but it hasn't been released to Boards Manager so it's only available by installing Arduino IDE 1.8.2.

As for your issue, I'd need to have more information to say what the actual problem was. There shouldn't ever be any need to edit boards.txt. If you do need a modified board then you should create your own hardware package.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: MeSat on Mar 31, 2017, 04:27 am
I saw 1.6.18 but didn't try it.  Needed to get some bootloaders installed for tomorrow.

Editing the boards.txt file is due to an error with the returned fuse info from a new, never a bootloader ATMEGA328P-PU processor.  Trying to burn this processor without the change to the boards.txt gives an error.  From what I learned last night, it is related to a change in avrdude and the IDE is sort of caught in the middle.

I not that experienced to know all the details.

Just checked the boards.txt and all the extended fuses are set to 0xFD for the atmega328 instead of the default 0x05.  No problems with burning the bootloader.

Does that help you understand?

Title: Re: Bootloader write failure - avrdude efuse problem
Post by: just4ho on Apr 18, 2017, 01:35 am
Use Arduino version 1.0.3 and follow this video.

https://www.youtube.com/watch?v=muP1dp73Mdg
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Apr 18, 2017, 05:46 am
Use Arduino version 1.0.3
It was only ever a helpful warning that you could safely ignore. The warning has been removed in the latest release of the Arduino IDE because it kept freaking people out who don't understand the difference between a warning and an error. Why would you advise people to use an IDE version that has been obsolete for 4 years?
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: poppy381 on Nov 29, 2017, 05:01 pm
I spent a lot of time on it.

Changing Board.txt located on ProgramFiles doens't change anything...

Then I've inspected and find another board.txt located on :

C:\Users\Franck\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.20

I change this file content, then restarted Arduino IDE program, then burn the bootloader and it works.

Maybe it could help someone.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: pert on Nov 29, 2017, 05:49 pm
I spent a lot of time on it.
Why? I already said that you can safely ignore the warning.
Title: Re: Bootloader write failure - avrdude efuse problem
Post by: turbozob on Nov 10, 2019, 11:15 am
I had write success on Pro Mini 8MHz but extended fuse was the same. I tried poppy381 solution post #25
 and it worked. Different boards.txt file in different location.