Oscillators
1
Three Fuse Bytes
• There are a total of 19 fuse bits that are used in the ATmega328P, and they are
separated into three different fuse bytes
• Three of the fuse bits are contained in the "Extended Fuse Byte", eight in the
"Fuse High Byte," and eight more in the "Fuse Low Byte
• The entire Extended Fuse Byte deals with the Brownout detection level
• Brownout detection allows the microcontroller to reset when the supply voltage
falls below a certain level (minimum allowable supply voltage for Atmega328P)
• The next slide shows the "Extended Fuse Byte“ and brownout level fuse coding
“BODLEVEL Fuse Coding” for the Atmega328P
2
• Programming a fuse bit consists of setting it low, i.e., 0 (zero), and a fuse bit is
unprogrammed when it is set to a logic high, i.e., 1 (one)
3
• The “Fuse High Byte” is shown below:
• If RSTDISBIL (external reset disable) fuse is programmed, pin PC6 will function as
an input pin and the AVR will have to rely on power-on reset and brown-out reset
as its reset source
• The RSTDISBL fuse is unprogrammed by default and the reset circuitry is
connected to the pin (PC6 cannot be used as input pin)
4
• The “Watchdog timer always On”, if programmed, will force the watchdog timer
to system reset mode, whereby the WDT gives a reset when the timer expires –
to prevent system hang-up in case of runaway code
• However, WDTON is unprogrammed by default
• Bits 2-0 are used to set the boot size - amount of memory reserved for
installation of a "Boot Loader” (a program in the bootloader section of flash
memory, which writes or programs code into the application section of flash
memory)
• The next “Fuse Low Byte” is shown below:
5
• The Atmega328P has the following clock source options, selectable by flash fuse
bits shown below:
• The clock from the selected source is input to the AVR clock generator, and
routed to the appropriate modules as shown in the next slide
6
7
• CKDIV (divide clock by 8) is programmed by default
• CKOUT (clock output to PORTB0) is unprogrammed by default
• Start-up times for low power crystal oscillator is programmed as shown below:
• Start-up time, is the time following device power-on during which the AVR is kept
reset until the oscillator is stable (clock frequency constant) to avoid timing errors
8
• The Atmega328P has the following clock source options:
• The low power crystal oscillator can operate in three different modes as shown in
the next slide:
9
• By default, the fuse low byte is set to its factory default of 0x62 (01100010), which
specifies the use of the internal 8 MHz oscillator, divided by 8, to give 1 MHz
effective clock frequency
• To change to the oscillator being use to 16 MHz crystal, change the fuse low byte
from 0x62 to 0xFF
• In our case, 0xFF has been programmed into our Atmega328P at the time of
burning the bootloader into the AVR
• In Atmel studio, #define F_CPU 16000000UL, tells the compiler that the clock is
running at 16MHz
10