Go Down

Topic: Bootloader write failure - avrdude efuse problem (Read 22866 times) previous topic - next topic

Krep

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

CrossRoads

#1
Sep 23, 2016, 07:21 pm Last Edit: Sep 23, 2016, 07:22 pm by CrossRoads
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




Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

DrAzzy

#2
Sep 23, 2016, 11:48 pm Last Edit: Sep 23, 2016, 11:48 pm by DrAzzy
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).
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

pert

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).

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. My conclusion of the best way to implement the manual installation is here. 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.

Krep

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...

Mr._Swarf

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?
M.S.

pert

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?

Mr._Swarf

I'm getting the same error messages as the OP. Board: clone Duemilanove, 328p IDE:1.6.11 Programmer both USBASP and USBTiny.
M.S.

DrAzzy

ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Mr._Swarf

#9
Nov 06, 2016, 12:23 am Last Edit: Nov 06, 2016, 12:24 am by Mr. Swarf
I'll repeat... clone Duemilanove, 328p

Wait, do you mean what board in the IDE? Duemilanove/Diecilila
M.S.

pert

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:
  • Select a board from the hardware package from the Tools > Board menu
  • File > Examples > SPI > BarometricPressureSensor
  • Sketch > Show Sketch Folder
  • Move up folder levels until you reach the one that contains boards.txt

If you edit that boards.txt and restart the IDE you will find that your edits did cause a change.

Mr._Swarf

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!

M.S.

AniketaKabir


pert

will it work despite the warning
Yes, just ignore the warning. It won't cause any problems at all.

rezaei

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

Go Up