where : ibrtses embedded

AVR Mega128

The manual of the Mega128 (Rev 2467J-AVR-12/03) 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 35, 36
CKSEL0 1 select the clock from internal RC, ceramic, XTAL, external clock 35, 36
CKOPT 1 clock amplifier for crystal oscillator or so, depends on the clocksource itself 36
SUT1..0 10 startup time selector 37
OCDEN 1 never ship as programmed 290
SPIEN 0 enable SPI programming mode 290
JTAGEN 0 enable JTAG programming 290
EESave 1 preserve EEPROM through chip erase 290
BOOTSZ1..0 00 select boot sector size as
00=4k at F000,
01=2k at F800,
10=1k at FC00,
11=512 at FE00
290
BOOTRST 1 select boot reset vector, 0 = in bootsector, at 0000 otherwise, set IVSEL in MCUCR register for the interrupts 290
BODLEVEL 1 brownout detection on 2.7V = 1, or 4.0V = 0 290 & 50
BODEN 1 brownout detection enabled = 0 290 & 50
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 35.

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 36
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 37
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 37
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 38
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 38
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 frequnecy of the device

Calibrated internal RC oscillator

Set CKOPT=1
Frequency selection
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 39
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 which is not available in Mega103 mode.

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

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 40
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


Questions ?
Suggestions?
Feedback ?



Questions ?
Suggestions?
Feedback ?







sponsored links




embedded page
home


last updated 27.may.05 or perhaps later



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