0

I built several boards with an ATMEGA328 and no crystal a couple of years ago. I programmed them successfully with a bootloader using usbasp, and with a sketch using the Arduino serial interface. I have now made some more, but I get an error message from AVRDUDE when I try to burn 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).

I followed the instructions here and I am using the hardware configuration archive referenced on that page: breadboard-1-6-x.zip.

If I reprogram the bootloader on a device that does have a crystal, it works if I select Arduino Pro/Pro Mini (3.3V, 8MHz), but fails with the message above if I select the breadboard specified in the boards.txt from breadboard-1-6-x.zip.

There are no other error messages, but... if I turn on verbose, it works.. turn verbose off and it stops working again. Maybe verbose mode modifies the timing enough to make it work.

I know that you can use the -B option to slow down avrdude when you run it from the command line: is there a way of doing the same thing from within the Arduino environment?

3
  • 1
    The above message is simply a warning, not an error. I believe there is some other error showing earlier in your console that you have not shown. Please check for that.
    – jwh20
    Jan 8, 2021 at 11:52
  • @jwh20 I did some more tests, and have added the results to my question.
    – JavaLatte
    Jan 8, 2021 at 12:20
  • Just FYI and in case you don't know it already: there's a very useful tool here: engbedded.com/fusecalc
    – Sim Son
    Jan 8, 2021 at 16:14

1 Answer 1

4

The ATMega328P datasheet has the following table in it:

ATMega328P datasheet extended fuses excerpt.

The top 5 bits of the of the Extended Fuse Byte are default 1 and are reserved. You're not really supposed to change them, since they might be used in the future for a 328P-like part and setting them to something other than 1 could have unexpected results. In the 328PB variant bit number 3 is used for "Disable Clock Failure Detection".

The lower three bits of 0xFD and 0x05 are both 0b101. In other words, taking into account only the bits you should be setting, for the BODLEVELn fuses, they would have the same effect. But you are being WARNED that you should be using 0xFD rather than 0x05 for the above reason.

The boards.txt that comes in the breadboard-1-6-x.zip has a line that looks like this:

atmega328bb.bootloader.extended_fuses=0x05

You could change this yourself by editing the file, but really for what you're doing I'd recommend MCUdude MiniCore which is comparatively up to date. If nothing else, its boards.txt file has been written with the correct fuse values. You can see there for a plain 328P (not PB) which does not support clock failure detection, the CFD bit is just hardcoded to 1 in the file.

The message you're seeing is a "WARNING" through, rather than "ERROR". The distinction being that warnings don't actually stop you from continuing. It is likely that if you're having a problem isn't not really because they've incorrectly specified the high-order bits of the fuse. If it's halting, it may be arduino-builder see a non-zero exit code for avrdude and thinking this means "ERROR" rather than "WARNING", in which case this problem will go away if you edit the boards.txt file (or adopt MiniCore) such that no longer produces the warning.

Unless you've brought the effective system clock below 1MHz, probably lower still, it's not likely that you'll need to change from the default ISP clock rate. If you do though, that can also be done by editing board package files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.