This is only a preview of the December 2026 issue of Silicon Chip. You can view 37 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Advanced Cable Analyser":
Items relevant to "Inrush Current Limiter":
Articles in this series:
Items relevant to "NeoPixel RGB LED Analog Clock, Part 2":
Items relevant to "The Magic Candle":
Purchase a printed copy of this issue for $15.00. |
Working with
AVR & PIC Configuration Fuses
Part 1 by Tim Blythman
Configuration fuses can be a confusing and troublesome aspect of firmware development for
microcontrollers. Setting the fuses incorrectly can sometimes make a chip unusable! So it pays to
be prepared and know what to expect before working with them.
I
n this series, we will look at the ‘fuses’
in 8-bit PIC and AVR parts, including
the hardware and software that might
be needed to program them. We’ll also
have tips for preventing your chip from
become a ‘brick’! This advice may
also aid in understanding the configuration of other chips, such as 16-bit
and 32-bit PICs.
If your only exposure to microcontrollers is something like the Arduino,
you may not even be aware of configuration fuses and why they are necessary. Different manufacturers and
processor families use different terminology, but all the ‘configuration
fuses’ have a similar purpose, regardless of name.
Configuration fuses set the behaviour
of a microcontroller before it even
starts executing code. They are typically settings that can’t or shouldn’t
be changed while the chip is running,
such as the processor clock source or
the function of certain pins on the
chip. They are often programmed at
the same time as the program flash
memory that holds the binary application data.
The original AVR-based Arduino software environment used a
bootloader system to make it very
difficult to inadvertently change the
fuses or other troublesome settings.
That is a small but important part of
why that ecosystem has become so
popular. Still, the underlying microcontroller depends on configuration
fuses to operate.
The ‘fuse’ terminology comes from
the days when OTP (one-time programmable) memory was common.
Back then, once the fuse was set,
or ‘blown’, the setting could not be
reverted. Modern microcontrollers are
more flexible, using reprogrammable
flash memory or EEPROM. Despite
that, you might still find it difficult
to fix some fuse settings if they are
changed carelessly.
Atmel parts use the term ‘fuse bits’,
while PIC microcontrollers refer to
them as ‘configuration bits’. They do
much the same job. You might also see
terms such as ‘configuration registers’
or ‘option bytes’.
The important thing is that they are
non-volatile memory in a microcontroller that cannot be changed by the
running program; they are generally
only changed by an external programmer or debugger.
Some are often intended as security features to avoid deliberate or
accidental changes to the code. Other
features, like a watchdog timer, can
be enabled by the configuration fuses
and can restart the micro if the code
stops working correctly.
Some microcontrollers have multiple programming interfaces, and the
fuses may restrict access to some of
these. This may be for security reasons
or to enable features that are otherwise unavailable. All of this probably
sounds a bit academic, so we should
look at some real-life examples.
This will be quite a detailed exploration of configuration fuses and microcontroller programming, but we hope
that it will give you the background
and insight to avoid getting into a situation where you ‘brick’ a chip and it
doesn’t work anymore. If you are unfamiliar with some of the terminology,
we have provided a glossary.
For the most part, we’ll stick to 8-bit
processors such as Microchip’s PIC16
parts or Atmel’s AVR series of chips.
Microchip has owned Atmel since
2016, but the two architectures remain
distinct, and their respective device
configurations are quite different.
Table 1 – List of recent projects with AVR microcontrollers
Issue
Project
Link (not including https:// prefix)
Microcontroller
June-July 2019
RF Signal Generator
siliconchip.au/Series/336
ATmega328P
September 2020
Pocket Audio DDS Oscillator
siliconchip.au/Article/14563
ATtiny85V
November 2020
Two Large LED Christmas Stars
siliconchip.au/Article/14638
ATmega328P
July 2021
Digital Radio Receiver
siliconchip.au/Article/14926
ATmega328P
July 2022
0-110dB RF Attenuator
siliconchip.au/Article/15385
ATmega328P
June 2023
Basic RF Signal Generator
siliconchip.au/Article/15817
ATmega328P
October 2023
2m Test Signal Generator
siliconchip.au/Article/15971
ATtiny45
March 2026
Graphing Thermometer
siliconchip.au/Article/19833
ATtiny85
May 2026
Simple LC Meter
siliconchip.au/Article/20235
ATtiny85
June 2026
Simple USB Power Monitor
siliconchip.au/Article/20365
ATtiny85
August 2026
Transceiver Test Set
siliconchip.au/Article/20673
ATtiny85
66
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
We’ll use the 8-pin ATtiny85 AVR
family (which includes parts like the
ATtiny45 and ATtiny25) as examples, since they continue to be used
in applications where only a few I/O
pins are needed. We’ll also mention
some ATmega parts, including the
ATmega328P variants that are used in
many Arduino boards.
Watch out for the part naming on
some of the ATmega328 variants.
The ATmega328, ATmega328P and
ATmega328PB are not always interchangeable. It is the ATmega328P,
used on the Uno, that we will concentrate on.
Table 1 shows a list of recent projects
that include these various AVR parts.
The Pocket Audio DDS Oscillator article from September 2020 also includes
a design for a Programming Adaptor
Board that can be used to program an
eight-pin DIP ATtiny85 chip before it
is fitted to the PCB.
More recent AVR microcontrollers
have introduced different programming interfaces. So we will have a
look at these parts and the hardware
needed to work with them.
The PIC16F84
Let’s start with PICs from Microchip
Technology. My first experience with
a microcontroller was the PIC16F84. It
had several features that made it easy
to work with, including reprogrammable flash memory that allowed the
program code to be readily changed.
These early PIC parts had a simple
serial programming interface, referred
to as ICSP (in-circuit serial programming). It requires three signal wires
plus power and ground. We published
a DIY PIC programmer project as early
as the March 1999 issue (siliconchip.
au/Article/4600).
The advent of ICSP meant that it
was possible to quickly iterate software designs without having to
remove the chip from its circuit; only
three pins needed to be shared with
the application circuit. You can find
the ICSP programming specifications
online. The version used on newer
chips is slightly different, but the
overall operation is quite similar; see
siliconchip.au/link/accx
One wire (often labelled as VPP,
for programming voltage, and usually
shared with the MCLR reset pin) is
dedicated to signalling entry into programming mode. The other two wires,
ICSPCLK and ICSPDAT (for ICSP clock
siliconchip.com.au
AVR & PIC Glossary
Application
> The program that runs during normal operation of a microcontroller. Used to
contrast with “Bootloader”, which is a small program in the microcontroller that
can be used to load a new application program.
AVR microcontroller
> An 8-bit microcontroller architecture developed at the Norwegian Institute
of Technology in the 1990s. The first device, the AT90S8515, was a drop-in
replacement for the 8051. The ATmega series was used in the early Arduino boards.
AVRs are still being released with a similar architecture and instruction set.
Bootloader
> A small program in a microcontroller’s firmware that can update application
firmware via a user-defined interface like serial or USB. The serial port
uploader of an Arduino board like the Uno is one example of a bootloader. Some
chips have settings to prevent the bootloader from being overwritten.
Brownout Detector (BOD)
> A peripheral in a microcontroller that can reset the processor if the supply
voltage is too low to avoid improper circuit operation. Typically, different
thresholds can be set through the configuration fuses.
Firmware
> The machine code that a microcontroller executes. It is named this as it is more
permanent than the software on a device like a personal computer, but more easily
changed than hardware.
Flash memory
> A form of non-volatile memory that is typically used to store the firmware of a
microcontroller. Since it does not need to be changed often, it does not require
random write access. Instead, it is erased in bulk (set to binary ones), then
individual bits can be programmed to zero.
HEX file
> A term for a file used to hold the data needed to program the fuses, flash memory
and other non-volatile memories such as EEPROM on a microcontroller. The Intel
HEX format is often used, which contains a list of memory addresses and data
contents in hexadecimal format.
JTAG (Joint Test Action Group) interface
> Designed as an industry-standard testing and programming interface, the JTAG
interface is common among 32-bit ARM processors and other 32-bit parts such
as the Microchip PIC32MX series. Other types of chips, such as FPGAs (fieldprogrammable gate arrays) might support a JTAG interface.
OTP (one-time programmable) memory
> Before flash memory, PROM (programmable read-only memory) devices were used for
firmware storage in microcontrollers. These would only allow their bits to be
changed from 1 to 0, although UV-erasable EPROM (erasable PROM) parts could be
reused after a time-consuming erase process.
Peripherals
> A part of the hardware on a microcontroller that is dedicated to a task not
directly related to the processor. Examples include general-purpose I/O (input/
output) pins, timers and advanced I/O functions such as PWM (pulse-width
modulation) or communication hardware. Core-independent peripherals that allow
circuitry to interact without needing attention from the main processor.
PIC (Peripheral Interface Controller) microcontroller
> The first PIC chips from the 1970s were intended as programmable general-purpose
peripherals to the 16-bit General Instrument CP1600 microprocessor. In the
1990s, the release of parts like the PIC16F84 with erasable flash memory made
microcontroller programming accessible to hobbyists. Newer parts continue to be
released with a broadly similar architecture and instruction set, although the
instruction set has been updated to be better suited to running C programming
language code.
Programmer
> A device that can be used to read and modify the firmware of a microcontroller.
Many programmers, such as the PICkit series, can also be used to perform live
debugging, so they might also be referred to as debuggers.
RISC (Reduced Instruction Set Computer) architecture
> RISC architectures favour a set of simple instructions, usually resulting in
a less complex and cheaper processor. Both AVR and PIC microcontrollers are
considered RISC processors (see the panel on p15 for more about RISC).
Watchdog Timer
> A timer that is capable of resetting a microcontroller if it is not regularly
‘kicked’ by code during normal operation. Abnormal code behaviour, such as an
infinite loop, will cause the watchdog timer to time out and force a processor
reset. Some watchdogs use a timer window so that early kicks can also signify a
fault and trigger a reset.
Australia's electronics magazine
December 2026 67
The PICkit Basic (left), PCB for the PICkit 5
(middle) and Snap (above) programmers. All
of these can program or debug most PIC chips.
and data) are used to shift commands
and data into and out of the chip via
an internal state machine.
The PIC16F84 has a 14-bit configuration word. Ten of the bits are repeated
copies of the CP (code protection)
bit. When CP = 1, code protection is
disabled. When CP = 0, code protection is enabled and it is not possible
to read out the program memory via
the programming interface. Clearing
the CP bit would have been a typical
step in ensuring the security of a critical device.
Fig.1 shows what this looks like in
the PIC16F84 data sheet. The default
‘1’ value corresponds to the state of
flash memory after it has been erased.
So code protection can be disabled by
erasing the flash memory, with the
proviso that flash memory can only be
erased in bulk. Of course, the code is
still ‘secure’ because it has just been
erased.
This also leads us to an important
aspect of configuration fuses that often
has confusing terminology. The process of writing a ‘0’ to a flash memory
cell is often termed programming (eg,
programming the CP bit to change it
from 1 to 0). Counterintuitively, activating a feature sometimes means settings its configuration bit to ‘0’ when
it was previously ‘1’.
We’ll start with PICs because it’s
generally possible to perform a fullchip erase that will reset all the flash
memory bits to 1. In this state, the
configuration fuses are at their factory
defaults, and the part is effectively
as-new. The Atmel chips can be more
complex; we’ll get to them shortly.
Newer chips
Older parts like the PIC16F84 only
have one programming protocol, but
modern PICs have at least two, with
the advent of LVP (low-voltage programming). The older high-voltage
programming (HVP) required a specific voltage, typically 9V or higher,
to be applied to the VPP/MCLR pin
to enter programming mode.
If you’ve read our reviews of recent
PICkit programmers, you will note that
the economical variants completely
omit HVP capability. The PICkit Basic,
which we reviewed in September 2025
(siliconchip.au/Article/18849) is one
example.
The default (erased) state of these
chips is to allow LVP. To program the
LVP bit and disable low-voltage programming, the programmer must use
HVP. So there is a negligible chance of
putting the chip into an unrecoverable
state. At worst, it should be possible to
recover by means of a full erase.
One reason that LVP might be disabled is that it can allow use of the
VPP/MCLR pin as a general-purpose
I/O (usually input-only) pin. In this
case, HVP is still possible, since the
higher VPP voltage used for HVP is
distinct from the usual logic-level
signals.
In LVP, the roles of the ICSPCLK and
ICSPDAT pins are much the same as
in HVP, so the same five-pin interface
can be used for both LVP and HVP;
the programming connections (eg, to
a PICkit) are identical. Fig.2 shows the
minimum wiring for a modern 14-pin
PIC like the PIC16F18126. Other components, like bypass capacitors, are
not shown.
Many other PIC families use a very
similar interface. This includes 8-bit
PIC18 parts, 16-bit PIC24 parts and
32-bit PIC32MX parts.
Programmers
Fig.1: the configuration fuses on the
PIC16F84 provide settings that don’t
change after programming. The Code
Protection bit allows programmed
parts to be used in designs with less
chance of being copied or cloned.
68
Silicon Chip
Australia's electronics magazine
For 8-bit PIC chips (with very few
exceptions), any programmer that supports HVP can be used to perform a full
erase and thus recover any improper
fuse settings. This includes the PICkit
3, PICkit 4 and PICkit 5. Low-cost programmers like the Snap and PICkit
Basic do not support HVP.
Note that the PICkit 3 is not supported by the most recent versions of
the MPLAB X IDE (integrated development environment) software.
siliconchip.com.au
Fig.2: the ICSP programming interface is simple and only requires three I/O pins. While we often dedicate these pins to
ICSP to simplify development and debugging, it’s sometimes possible to use them in the application circuit and still allow
in-circuit programming.
In the past, we have seen and published hobbyist and DIY PIC programmers, but PICkits are cheap enough,
with support for hundreds of chips,
so there has been little need for DIY
designs lately. The official Microchip
programmers work well for us! The
required software programs (MPLAB
X IDE or MPLAB IPE [integrated programming environment]) are free
downloads.
We have just seen the release of the
PDID feature for some new 8-bit PIC
micros. PDID stands for Programming
and Debugging Interface Disable; it can
be used to permanently lock down
the programming interface, even preventing chip erasure. So this is a new
exception to the rule that PICs can
usually be recovered by a full erase.
We have not tested this out yet.
Configuration bits
Fig.3 shows the (many) configuration bits that are available on the
PIC16F18146, which we’ve used in
quite a few projects. This view is from
the MPLAB X IDE, which allows the
configuration to be edited and then
exported as code for incorporation
into the project. The detailed descriptions are handy for avoiding improper
settings.
The settings shown are a good example of what the configuration bits
might control, with the oscillator and
clock sources being first and foremost.
Software running on the PIC16F18146
can control its oscillators but the
CSWEN bit can disable this to avoid
accidental changes. The programmed
(zero) state is the more secure option,
with clock switching disabled.
The brownout voltage setting
(BORV) is another example, since it
needs to be correctly set to guarantee
proper operation under the expected
conditions. Settings like these are
intended to override software selections and prevent problems due to
runaway code.
The configuration word at 0x800A
is used to set up a bootloader. It
defines regions (for the bootloader
code) that can’t be overwritten. This
would include code that executes
during bootloader operation so that the
Fig.3: the PIC16F18146 has many more configuration bits than the PIC16F84. It supports a bootloader, numerous clock
and oscillator selections, plus a windowed watchdog timer.
siliconchip.com.au
Australia's electronics magazine
December 2026 69
Microchip’s
PIC16F84 uses
in-circuit serial
programming (ICSP) to
write to its internal flash memory
and EEPROM. It was popular with hobbyists
because it is easy to program, requiring only
three signal wires, power and ground.
The Arduino Uno uses an ATmega328P,
which is programmed via the in-system
programming (ISP) interface. Source: www.
flickr.com/photos/snazzyguy/16421989212
(CC-BY-SA 2.0)
bootloader is protected. This word also
includes the LVP fuse noted earlier.
The final word includes the same
CP bit as found on the PIC16F84. The
values and settings shown all correspond to a blank chip, with all bits
set to ‘1’. Generally, they are the least
secure but safest option.
Ultimately, those configuration bit
settings are exported as part of the HEX
file that is programmed onto the chip.
In other words, the complete chip programming state can be captured in a
single HEX file. This, and the ability to
recover a chip via a full erase (possibly requiring HVP), no matter the fuse
settings, are some of the reasons that
we prefer PIC chips over Atmel chips.
Atmel ISP interface
The Arduino ecosystem emerged
perhaps a decade after the rise of the
PIC16F84. It was initially based on
various Atmel AVR parts. The Arduino environment had many features
that made it very easy to start programming microcontrollers, including the
fact that a separate programmer was
not needed.
Good software support, including an
IDE (integrated development environment), intuitive library functions, and
a bootloader that simplified firmware
programming all contributed to Arduino’s popularity. Going beyond Arduino’s limitations typically requires
knowledge of a fundamental programming protocol such as ISP.
Parts like the ATmega328P (and
variants), as used in boards like the
70
Silicon Chip
Arduino Uno and Nano, as well as the
ATtiny85 mentioned earlier, use the
‘ISP’ (in-system programming) interface. This is a serial protocol very similar to SPI (serial peripheral interface).
In fact, the ISP pins on the
ATmega328P are the same pins that
are used for the hardware SPI peripheral. In total, the ISP interface uses
four signal wires. The SCK, MOSI and
MISO lines operate as expected for SPI,
while RESET is used to enter and exit
programming mode. Two other connections for power and ground are
also needed.
Like the PIC parts, it’s possible to
disable the RESET pin function to
allow its use as a general-purpose
input. This can be done without any
checks, meaning that it’s possible to
inadvertently disable the ISP interface
from the ISP interface.
Another important distinction is
that ISP programming depends on
the chip having a suitable processor
clock that is at least four times faster
than the ISP clock. This is important
in that it is possible to switch from the
internal oscillator to an external oscillator (such as a crystal), which can be
a problem if such a clock source is not
present when you are trying to program or debug the chip.
So it’s also possible to get into a
state where ISP programming is disabled due to the lack of a suitable
processor clock. This is not terrible,
as external clock modes will usually
accept an external clock signal, and
some programmers provide a clock
Table 2: ATtiny85 family fuse bits (default values shown)
Extended Fuse
Unused
1
1
1
SELFPRGEN
1
1
1
1
1
High Fuse
RSTDISBL
DWEN
SPIEN
1
1
0
WDTON EESAVE
1
BODLEVEL
1
1
0
0
1
1
Low Fuse
CKDIV8
CKOUT
0
1
SUT
1
CLKSEL
0
1
0
Lock Bits
Unused
LB
1
1
1
1
1
1
1
0
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Australia's electronics magazine
siliconchip.com.au
signal for this purpose. Still, it can be
inconvenient.
There is also a configuration fuse
that can be used to completely disable
ISP programming. Naturally, if you
manage to set this, you will need to use
a different interface to reset this fuse.
Unlike the PIC parts, a standard chip
erase does not affect the fuse bits. Also,
the default fuse values are not all ‘1’.
So, to return an AVR chip to factory
condition, you must determine the
default fuse values and program those.
Many programing apps keep a database of default values for this purpose.
Finally, there are ‘lock bits’ that
can be used to prevent reading and
programming the flash memory and
EEPROM via any external programmer interface. Like the CP bits on PIC
parts, they can only be cleared with a
full chip erase, ensuring the security
of the memory contents.
So there are a few ways in which ISP
programming can be used to indirectly
disable ISP programming and appear
to ‘brick’ an AVR chip.
Similar to PICs, the AVR HVSP
(high-voltage serial programming)
mode uses a higher voltage on RESET
to force a different mode. This works
differently to ISP and does not require
a processor clock to function. The
catch is that most of the cheaper ISP
programmers do not support HVSP
and so cannot be used to recover an
AVR chip with ISP disabled.
Some AVR devices also support
HVPP (high-voltage parallel programming), which uses a parallel interface
instead of a serial interface. These
devices still need a high-voltage signal, so HVPP is also unsupported by
many common ISP programmers. So
it is clear that AVR fuse programming
is a bit more complex than for a PIC.
It’s entirely possible to create a HEX
file for an AVR chip that contains the
flash memory data and fuse settings.
Many programmers will correctly program the flash memory before applying
the fuses. But to avoid problems, the
fuses are often provided separately to
force the user to double-check the fuse
values and avoid a problem occurring.
In that case, programming is a multistep process, making it considerably
more complex than simply loading a
HEX file into the chip.
ATtiny85 fuses
We’ve noted the ATtiny85 as our
part of interest, but the same data sheet
siliconchip.com.au
Table 3: ATtiny85 family fuse fields
Fuse
Meaning (when set to zero for binary options)
SELFPRGEN
Self-programming (of flash memory by the user program) is
possible.
RSTDISBL
The RESET pin is disabled (the pin can be used for alternative
features such as I/O).
DWEN
The debugWIRE debugging interface is enabled.
SPIEN
The ISP programming interface is enabled.
WDTON
The Watchdog Timer is forced to run.
EESAVE
EEPROM contents are preserved during a chip erase.
BODLEVEL
111: Brownout detector disabled.
110: Brownout enabled with a 1.8V nominal threshold.
101: Brownout enabled with a 2.7V nominal threshold.
100: Brownout enabled with a 4.3V nominal threshold.
Other values are not defined.
CKDIV8
The system clock is divided by 8.
CKOUT
The system clock is fed to the CLKOUT pin.
SUT
Values 00-10 give different startup delays that depend on
CLKSEL. The default 10 value gives the longest delay in all
cases. A value of 11 is not defined.
CLKSEL
These four bits choose the system clock source:
0000: External clock source.
0001: High-frequency internal PLL (16MHz nominal).
0010: 8MHz internal RC oscillator.
0011: 6.4MHz internal RC oscillator.
0100: internal 128kHz oscillator.
0110: low-frequency external crystal oscillator.
1000-1111: various high-frequency external crystal oscillator
options
Other values are not defined.
LB
11: No memory locking
10: Programming of flash memory and EEPROM is disabled.
00: Programming and reading of flash memory and EEPROM is
disabled.
applies to the ATtiny25 and ATtiny45
variants. The main differences are the
amounts of flash memory, SRAM and
EEPROM that each part features. There
are also -V suffixed variants that can
operate over a slightly wider voltage
range. Tables 2 & 3 show the fuse bit
mapping.
These are spread over three bytes,
with a fourth byte dedicated to the
‘lock bits’. Not all of the bits map to features; this can sometimes lead to confusion when fuse values are reported,
since the value of unimplemented bits
is unimportant and different fuse values can mean the same thing.
The recommended behaviour,
which is consistent with the values
reported in the data sheets, is to mark
all unused bits as ‘1’.
Importantly, the fuse bits are the
same for all the ATtiny parts noted.
Unlike the PIC16F parts, the default
Australia's electronics magazine
values are not all ‘1’. Table 2 shows
how these are organised and their purpose. Features are generally enabled
when the bits are programmed and
set to ‘0’, which can be unintuitive.
Some fields use multiple bits to select
between more than two options. Some
fields depend on others, too.
To use the lock bits, the flash memory and EEPROM should be written
first, followed by the fuses as needed.
Finally, the lock bits are set. It’s necessary to do this last; otherwise, changes
to the other parts of memory will not
be possible.
The ATtiny85 has a
high-performance
8-bit core in an
8-pin package.
December 2026 71
The following fuses can be a problem if set incorrectly:
• If RSTDISBL is set to zero, the
RESET pin is not available for ISP
programming, so it becomes impossible. This situation requires HVSP
to recover the RSTDISBL fuse to its
default state.
• If DWEN is programmed, the
debugWIRE interface can be used for
debugging an ATtiny85 chip, which
uses the RESET pin for bidirectional
communication with a debugWIRE
debugger. This too will disable ISP.
To recover from this state requires a
HVSP programmer or a debugWIRE
debugger to temporarily disable the
debugWIRE interface and allow ISP
again.
• SPIEN is used to control ISP, so
if the SPIEN fuse is programmed, ISP
is explicitly disabled and an HVSP
programmer is needed to restore the
SPIEN fuse to its unprogrammed state.
Most other fuses will not cause
problems if they are programmed
incorrectly, although the CLKSEL fuse
will cause a chip to become unresponsive if the chip’s expected clock source
is absent. A typical scenario might be
a circuit that expects the chip to run
from an internal source, but an external source, such as a crystal oscillator,
is selected.
In this case, you should try applying a clock waveform to the CLKI pin;
this is pin 2 on the SOIC and DIP variants of the ATtiny85. Anything up to
4MHz should work for this family,
but remember that if the CKDIV8 bit is
programmed, the system clock will be
divided by a factor of eight. You may
need to choose a very low ISP clock
speed (100kHz is often suggested) to
allow communication in this case.
Using CLKI will only be possible if
this pin is available; that may not be
the case if it is shared with the application circuit. It’s also possible that
certain BODLEVEL settings might
cause problems for circuits that run
at lower voltages.
Table 4: ATmega328P fuse bits (default values shown)
Extended Fuse
Unused
1
1
BODLEVEL
1
1
1
1
1
1
High Fuse
RSTDISBL
DWEN
SPIEN
WDTON
EESAVE
1
1
0
1
1
BOOTSZ
0
BOOTRST
0
1
Low Fuse
CKDIV8
CKOUT
0
1
SUT
CLKSEL
1
0
0
0
BLB12
BLB11
BLB02
BLB01
1
0
Lock Bits
Unused
LB
1
1
1
1
1
1
1
1
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Table 5: ATmega328P fuse fields (only those that differ from the ATtiny85 are listed)
Fuse
Meaning (when set to zero for binary options)
BOOTSZ
The bootloader size is:
00: 2048 words.
01: 1024 words.
10: 512 words.
11: 256 words.
BOOTRST
The reset vector is the start of the bootloader (ie, it runs
immediately after a reset).
BLB12
Code in the application section can’t be read by the bootloader.
BLB11
Writes are not allowed in the bootloader section.
BLB02
Code in the bootloader section can’t be read by the application.
BLB01
Writes are not allowed in the application section.
72
Silicon Chip
Australia's electronics magazine
The above scenarios should cover
most of the problematic fuse scenarios that might occur with an ATtiny85.
You can see that there are a few ways
to ‘dig yourself into a hole’ that is difficult (but not impossible) to get out
of with these chips.
ATmega328P fuses
The ATMega328P has a few more
fuses and lock bits than the ATtiny85.
They are a superset of those of the
ATtiny85 but note that they might be
in slightly different locations. Thus,
the binary values of the fuse bytes will
probably differ between the two parts
even for the same configuration – see
Tables 4 & 5.
The big difference is that the
ATmega328P allows a protected bootloader to be programmed. The protection comes from the extra lock bits.
It’s possible to provide a bootloader
on the ATtiny85; the micronucleus
bootloader on boards like the Digi
Spark is such an example. The catch
is that there is no way to prevent the
application program from overwriting
the bootloader, since there are no protections in place.
The protected bootloader is part
of the reason that boards like the
Uno are so robust against ‘bricking’.
The bootloader’s serial programming
interface effectively hides it and the
fuses from being corrupted by the
user program.
The programming environment for
the ATmega328P is much the same as
the Uno, and none of the bootloader
fuses will interfere with the ISP interface; at worst, you may need to perform a full erase, but that should still
be possible without needing to resort
to a different programmer.
If you need to apply an external
clock signal to an ATmega328P, then
the XTAL1 pin should be used. This
is pin 9 on the DIP part.
End of theory
So far, we have described the theory of configuration fuses and how
they can interfere with part programming. In the second and final part of
this series next month, we will take a
hands-on look at the hardware needed
to perform ISP programming of 8-bit
AVR parts, including fuse programming.
We will also investigate some of the
control software that can be used with
SC
programmers.
siliconchip.com.au
|