where : ibrtses embedded

AVR Mega32

The manual of the Mega32 (Rev 2503A-AVR-03/02) is somewhat intransparent and distributes the relevant information over many pages.

the fuses

The programming fuses are
fuse default meaning page
CKSEL3..1 000 select the clock from internal RC, ceramic, XTAL, external clock 23,24,27
CKSEL0 1 select the clock from internal RC, ceramic, XTAL, external clock 25,255
CKOPT 1 clock amplifier for crystal oscillator or so, depends on the clocksource itself 24
SUT1..0 10 startup time selector 25,26,27,28,29,255
OCDEN 1 never ship as programmed 254
SPIEN 0 enable SPI programming mode 254
JTAGEN 0 enable JTAG programming 254
EESave 1 preserve EEPROM through chip erase 254
BOOTSZ1..0 00 select boot sector size as
00=2k at 3800,
01=1k at 3C00,
10=512 at 3E00,
11=256 at 3F00
252
BOOTRST 1 select boot reset vector, 0 = in bootsector, at 0000 otherwise, set IVSEL in MCUCR register for the interrupts 245
BODLEVEL 1 brownout detection on 2.7V = 1, or 4.0V = 0 35,37
BODEN 1 brownout detection enabled = 0 37
Concerning the fuses, 0 means programmed and 1 means unprogrammed.

default clock source

The device is shipped with CKSEL3..0 = 0001 and SUT1..0 = 10, an internal RC with the longest startup time. page 23.

crystal oscillator

This mode allows for either a crystal or a ceramic resonator. When CKOPT=0, then the Osc output at XTAL2 is being driven rail-rail. When not programmed (=1), then the swing is smaller, the frequency range is limited and the powerrconsumption is lower.
For resonators, the max frequency is 8MHz with CKOPT=1 and 16MHz with CKOPT=0.

Crystal oscillator operating modes, page 24
CKOPT CKSEL3..1 freq range MHZ recommended caps
1 101 0.4 - 0.9 for resonators only
1 110 0.9 - 3.0 12 - 22pF
1 111 3.0 - 8.0 12 - 22pF
0 101, 110, 111 1.0 - 12 - 22pF

Startup times for the crystal oscillator clock selection, page 25
CKSEL0 SUT1..0 startup time additional reset delay recommended usage
0 00 258 clk 4.1ms ceramic, fast rising power, not frequency stable at startup
0 01 258 clk 65ms ceramic, slow rising power, not frequency stable at startup
0 10 1k clk - ceramic, BOD enabled, frequency stable at startup
0 11 1k clk 4.1ms ceramic, fast rising power, frequency stable at startup
1 00 1k clk 65ms ceramic, slow rising power, frequency stable at startup
1 01 16k clk - crystal, BOD enabled
1 10 16k clk 4.1ms crystal, fast rising power
1 11 16k clk 65ms crystal, slow rising power

Low frequency crystal oscillator

This clock option is to use a 32768Hz crystal. Set the CKSEL=1001. Programming the CKOPT=0 enables internal 36pF between XTAL1 and GND and between XTAL2 and GND. Startup times for the low frequency crystal oscillator, page 26
SUT1..0 Startup from powerdown & powersave additionaldelayfrom reset @ Vcc=5V recommended usage
00 1k clk 4.1ms fast rising power or BOD enabled
01 1k clk 65ms slowly rising power
10 32k clk 65ms Stable frequency at startup
11 reserved reserved reserved
option 00 and option 01 should only be used if frequency stability at startup is not important

External RC oscillator

The frequency is roughly 1/(3*R*C), with C at least 22pf between XTAL1 and GND.
The CKOPT fuse enables the internal 36pF cap between XTAL1 and GND.
Frequency selection, page 27
CKSEL3..0 Nominal frequency
0101 <= 0.9 MHz
0110 0.9 - 3.0 MHz
0111 3.0 - 8.0 MHz
1000 8.0 - 12.0 MHz

Startup times for the external RC oscillator, page 27
SUT1..0 Startup from powerdown & powersave additionaldelayfrom reset @ Vcc=5V recommended usage
00 18clk - BOD enabled
01 18clk 4.1ms fast rising power
10 18clk 65ms Slowly rising power
11 6clk 4.1ms fast rising power or BOD enabled
option 11 should not be selected close to the max frequency of the device

Calibrated internal RC oscillator

Set CKOPT=1
Frequency selection, page 27
CKSEL3..0 Nominal frequency
0001 1.0 MHz
0010 2.0 MHz
0011 4.0 MHz
0100 8.0 MHz
The 0001 is factory default.

Startup times for internal calibrated RC oscillator, page 28
SUT1..0 Startup from powerdown & powersave additionaldelayfrom reset @ Vcc=5V recommended usage
00 6clk - BOD enabled
01 6clk 4.1ms fast rising power
10 6clk 65ms Slowly rising power
11 reserved reserved reserved
option 10 is default when shipped.
The calibration value is written to register OSCCAL.

Internal RC Osc calibration value, page 28
OSCCAL value min frequency in percentage from nominal max frequency in percentage from nominal
$00 50 100
$7F 75 150
$FF 100 200

The RC oscillator is intended for 1.0, 2.0, 4.0 or 8.0MHz. Calibrating it to other frequencies is not guaranteed.

external clock

Connect the external oscliiator to XTAL1 while leaving the XTAL2 open.
Set Cksel3..0=0000, CKOPT is 1 or a 36pf cap is enabled between XTAL1 and GND.

Startup times for external clock, page 29
SUT1..0 Startup from powerdown & powersave additionaldelayfrom reset @ Vcc=5V recommended usage
00 6clk - BOD enabled
01 6clk 4.1ms fast rising power
10 6clk 65ms Slowly rising power
11 reserved reserved reserved

Timer/counter oscillator

AVRs with Timer/Counter oscillator pins (TOsc1 & TOsc2), a watch cristal of 32768Hz can be directly coonected to them. No caps are needed. Applying an external clock at these pins is not recommended.

Questions ?
Suggestions?
Feedback ?



Questions ?
Suggestions?
Feedback ?







sponsored links




embedded page
home


last updated 4.march.06 or perhaps later



Copyright (99,2006) Ing.Büro R.Tschaggelar