3

How can I read the fuse bits from within my sketch?

asked Jun 4, 2016 at 13:29

1 Answer 1

9

You can use the boot_lock_fuse_bits_get function from <avr/boot.h>.

#include <avr/boot.h>;
void setup()
{
 Serial.begin(57600);
 cli();
 uint8_t lowBits = boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS);
 uint8_t highBits = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
 uint8_t extendedBits = boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS);
 uint8_t lockBits = boot_lock_fuse_bits_get(GET_LOCK_BITS);
 sei();
 Serial.print("Low: 0x");
 Serial.println(lowBits, HEX);
 Serial.print("High: 0x");
 Serial.println(highBits, HEX);
 Serial.print("Ext: 0x");
 Serial.println(extendedBits, HEX);
 Serial.print("Lock: 0x");
 Serial.println(lockBits, HEX);
}
void loop() 
{
}
answered Jun 4, 2016 at 13:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.