Wayne Yamaguchi talks burning fuses and setting lock bits in source

I had lunch with my pal Wayne Yamaguchi last week, who has several products he makes based on Atmel AVR parts. Wayne mentioned that he has found products where someone has forgotten to burn the fuse and lock bits, and he could read the code inside the part. He admits that it is easy to get confused if you are switching between developing some code for one project and then burning some chips for products that are shipping. You have to click down a few menus to insure the bits get set. Instead he says that he puts the instructions to set the fuse and lock bits in his source code, and then he can program the parts with the .ELF file which will set the bits in the parts.

Wanye_Yamaguchi_Francis_Lau_texting_sfw

Here is Wayne Yamaguchi (left) and my crack protégé Francis Lau exchanging numbers. Frances was showing Wayne his FreedomPop piggyback phone that lets him make free calls. We all worked together in a startup 12 years ago.

So Wayne dropped me a note and said:

 Here’s some info on embedding fuse settings in the source code.

 #include <avr/fuse.h>

#include <avr/lock.h>
/*
FUSES =
{
//    .low = (unsigned char)(FUSE_CKDIV8 & FUSE_SUT0 & FUSE_CKSEL3 &
FUSE_CKSEL2 & FUSE_CKSEL0),
//    .low = (unsigned char)(FUSE_CKDIV8 & FUSE_SUT0 & FUSE_SUT1  &
FUSE_CKSEL3 & FUSE_CKSEL2 & FUSE_CKSEL0),
     .low = LFUSE_DEFAULT,
     .high = HFUSE_DEFAULT,
//    .high = (unsigned char)(FUSE_BODLEVEL0 & FUSE_SPIEN),
     .extended = EFUSE_DEFAULT,
};
*/

LOCKBITS = (LB_MODE_3 );
/*
To extract the fuse/lock bits from the elf file.  From the command prompt type the following.
avr-objdump -s -j .fuse <ELF file>
avr-objdump -s -j .lock <ELF file>
*/

You should be able to find more info from winavr documentation.  It took me forever to find it.  Like I mentioned I use the .ELF file to program the part which includes the fuse and lock bit settings.

If you are like Wayne and in a mixed design and manufacturing small business environment, you too might prefer to put the fuse and lock bit instructions in your source code. Give it try and let us know what you think.

1 thought on “Wayne Yamaguchi talks burning fuses and setting lock bits in source

  1. Pingback: Francis Lau and Wayne Yamaguchi on ADC tips | Bits & Pieces from the Embedded Design World

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s