Did you know fuses and signature bytes can be read out LIVE?


yes, can. discovered functions in <avr/boot.h>.

here's demo sketch demonstrates functions. since i've never heard of before, i'm assuming it's "new" of you. if not, apologies......

anyway, here is:

code: [select]
#include <avr/boot.h> // necessary!

void setup (void)
{
serial.begin (115200);

uint8_t x;
uint8_t addr;
uint8_t sig[3];
uint8_t fuses[4];

const char *fnames[] = {
"low ",
"lock",
"ext ",
"high",
};

char buffer[64];
char *ptr;

// avr signature
for (addr = 0; addr < 3; addr++) {
// signature bytes @ 0, 2 , 4. osccal @ 1
sig[addr] = boot_signature_byte_get (addr * 2);
}

// avr fuse settings. fuse addresses are:
// 0 - low fuse
// 1 - lock fuse
// 2 - extended fuse
// 3 - high fuse
for (addr = 0; addr < 4; addr++) {
fuses[addr] = boot_lock_fuse_bits_get (addr);
}

sprintf (buffer, "your avr signature %02x %02x %02x\n\n", sig[0], sig[1], sig[2]);
serial.print (buffer);

for (addr = 0; addr < 4; addr++) {
sprintf (buffer, "your %s fuse setting 0x%02x (0b", fnames[addr], fuses[addr]);
serial.print (buffer);
// convert fuse[addr] 1010 binary
x = 8;
ptr = buffer;
while (x--) {
*ptr++ = (fuses[addr] & _bv (x)) ? '1' : '0';
}
*ptr = 0;
serial.print (buffer);
sprintf (buffer, ") binary\n");
serial.print (buffer);
}
}

void loop (void)
{
// nothing
}

since i've never heard of before, i'm assuming it's "new" of you.
uh, well, 1 of nick gammon's utility sketches not reads fuses cracks values.

quote
if not, apologies......
for posting on-topic technical information on technical forum?  apologies never necessary that.

thank post.



Arduino Forum > Using Arduino > Programming Questions > Did you know fuses and signature bytes can be read out LIVE?


arduino

Comments