If you are playing around with avrdude and fuses in an Arduino, you might run into an error like:

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0

This is because the Arduino bootloader cannot access fuses in the ATmega. To fix this, we can use another Arduino as an in-system programmer (ISP).

First, hook up your Arduino-as-ISP and target microcontroller as shown in the ArduinoISP tutorial.

Then, run the command (Windows, Mac, and Linux should all be about the same):

avrdude -c avrisp -p m328p -P com6 -b 19200 -U lfuse:r:-:i -v

which will give you a verbose reading of the LFUSE (along with lots of other good information). Note that you might have to change the following options depending on your setup:

  • -p is the target microcontroller. m328p is an ATmega328p
  • -P is your serial port connected to the Arduino acting as an ISP. This might be something like /dev/ttyUSB0 on Linux.
  • -b is the baud rate. An UNO is 57600.
  • -U is which part of memory (in the target microcontroller) we want to read. The ‘-‘can be replaced by a filename if you want to save the output.

Read more about avrdude options here.

Reading fuses on an Arduino with avrdude

15 thoughts on “Quick Tip: Reading Fuse Bits in an Arduino

  1. Claus Mößner on February 21, 2016 at 2:59 pm Reply

    Hi,
    I’ve a broken Sparkfun pro Micro 3V3/8Mhz and tried to reporgram it with a second one as ISP.
    Seems reprogramming works partly, because device is accepting windows7 USB driver again, when connected to PC.
    But behavoir is not as should, e.g.:
    – bootloader doesnt accept the second reset
    – scetches do not run at all

    so I fear that some fuses are set wrongly.
    So I tried to read out the fuses as follows, but result is only “not in sync”.

    Any Ideas what to do?

    Here my results as I got at screen:

    C:\Tools\WinAVR-20100110\bin.2010>avrdude -c avrisp -p m32u4 -P com31 -b 19200 -U lfuse:r:-:i -v

    avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
    Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
    Copyright (c) 2007-2009 Joerg Wunsch

    System wide configuration file is “C:\Tools\WinAVR-20100110\bin.2010\avrdude.conf”

    Using Port : com31
    Using Programmer : avrisp
    Overriding Baud Rate : 19200
    avrdude: stk500_getsync(): not in sync: resp=0x00

    avrdude done. Thank you.

    Best Regards
    Claus

    1. ShawnHymel on February 24, 2016 at 5:07 pm Reply

      Is there another Arduino you could test it with? Without having the broken one in hand, it’s hard to troubleshoot. If you think it’s really broken, I recommend contacting SparkFun’s Technical Support (https://www.sparkfun.com/technical_assistance), and they’ll be able to walk you through testing the broken one.

      1. Claus on February 25, 2016 at 9:06 pm Reply

        Hello,
        yes, I’ve a second one. But what to test?
        This one runs fine.
        (but I’m afraid to use it outside Arduino Suite, because may also brick)
        I tried to use this one as “pro Micro as ISP” to repair the first one, but I failed.
        My assumption is, that the “Adruion as ISP” scetch is not suitable for “pro Micro”. Because I don’t own a programmer I do not know what to do to unbrick the pro Micro.
        Do you know whether there is a scetch like “pro Micro as ISP” which may help to reprogram a broken “pro Micro”?
        Best Regards
        Claus

        1. ShawnHymel on March 1, 2016 at 4:45 pm Reply

          I was curious if you had another Arduino other than the 2 Pro Micros (the drivers for the Pro Micro are known to be very finicky). Were you able to upload the ArduinoISP example sketch to the working Pro Micro? I also recommend checking your wiring with the last entry in this forum post.

          1. Claus on March 1, 2016 at 8:31 pm

            Hello,
            yes I already upload the example and did the wiring as described in “forum post” above (didn’t know this post while doing that). But the result was as described above:
            the bootloader didn’t react on the second reset.
            And if I loaded a scetch afterwards, nothing happend (sometimes green led was on, nothing else).

            But:
            I was able to repair my first Pro Micro last weekend by accident.
            As described:
            – I selected “Arduino as ISP” as programmer,
            – used my second Pro Micro as ISP
            – per accident I selected “Arduino Nano” as board / target
            – after command “burn bootloader” I figured out, that now a bootloader was available which was detecting the second reset. (Don’t ask me how that can work, because the target µC is Atmega 328 not 32u4)
            – afterwards I loaded an empty Arduino project
            – burned the Pro Micro Bootloader via “Arduino as ISP”
            -> and afterwards I was able to run scetches successful.

            As I said: I don’t have any glue why it’s working now and why it didn’t work before (just by burning the “Pro Micro” bootloader), may be somebody has an idea.
            Nevertheless, I’m happy to have my Pro Micro well working again.

            Best Regards
            Claus

  2. danny on November 13, 2016 at 1:21 pm Reply

    Hi Thanks for the post really helpful I still get the same problem though with all the fuses been reported as :
    avrdude: safemode: lfuse reads as 0
    avrdude: safemode: hfuse reads as 0
    avrdude: safemode: efuse reads as 0
    I am using a UNO as ISP to a Atmega328. I have the boot loader working.

    1. ShawnHymel on November 13, 2016 at 4:32 pm Reply

      Definitely double-check your wiring. Just last night, I spent an hour trying to figure out why my ATtiny wasn’t communicating with my UNO (set as ISP). Turns out, I forgot to connect VCC and GND.

  3. Dimpap on August 22, 2017 at 1:00 pm Reply

    For ATMEGA2560, use “-c wiring”.

    1. ShawnHymel on August 22, 2017 at 3:16 pm Reply

      Good to know. Thank you!

  4. Idzuwan on August 28, 2017 at 2:32 am Reply

    does it require to use another arduino? can I use USPasp for this?

    1. ShawnHymel on August 28, 2017 at 11:25 pm Reply

      In the example, I’m using another Arduino. You can use any ISP that avrdude supports. You’ll just need to change the -c parameter to your programmer.

  5. D Clemons on March 15, 2018 at 4:48 pm Reply

    I just wanted to say “thanks” for basically saving my proverbial bacon. Not so much checking fuse bits as pointing me in the right direction when I was tearing out my (rapidly) greying hair over an uploading problem. Much obliged, sir!

    1. ShawnHymel on March 15, 2018 at 9:15 pm Reply

      Glad it helped!

  6. bob on August 13, 2018 at 6:02 pm Reply

    Hello!
    Can you tell me what exactly means all this digits:
    :01000000 FF( – ok, thats lfuse) 00 – ???
    :00000001FF – ???

    1. ShawnHymel on August 14, 2018 at 9:11 pm Reply

      I actually don’t know what the output of the “writing output file” means. They seem to somewhat line up with the fuses you’re trying to set, but not all the time. I recommend paying more attention to the “fuse reads as” lines to determine if you’ve set your fuses correctly.

Leave a Comment

Your email address will not be published. Marked fields are required.