– 124 Powerful Instructions - Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 1 MIPS Throughput at 1 MHz
• Nonvolatile Program and Data Memories
– 40K Bytes of In-System Self-Programmable Flash, Endurance: 10,000 Write/Erase
Cycles
– Optional Boot Code Section with Independent Lock Bits
– Extensive On-chip Debug Support
– Available through JTAG interface
• Battery Management Features
– Two, Three, or Four Cells in Series
– Deep Under-voltage Protection
– Over-current Protection (Charge and Discharge)
– Short-circuit Protection (Discharge)
– Integrated Cell Balancing FETs
– High Voltage Outputs to Drive Charge/Precharge/Discharge FETs
• Peripheral Features
– One 8-bit Timer/Counter with Separate Prescaler, Compare Mode, and PWM
– One 16-bit Timer/Counter with Separate Prescaler and Compare Mode
– 12-bit Voltage ADC, Eight External and Two Internal ADC Inputs
– High Resolution Coulomb Counter ADC for Current Measurements
– TWI Serial Interface for SM-Bus
– Programmable Wake-up Timer
– Programmable Watchdog Timer
• Special Microcontroller Features
– Power-on Reset
– On-chip Voltage Regulator
– External and Internal Interrupt Sources
– Four Sleep Modes: Idle, Power-save, Power-down, and Power-off
• Packages
– 48-pin LQFP
• Operating Voltage: 4.0 - 25V
• Maximum Withstand Voltage (High-voltage pins): 28V
• Temperature Range: -30°C to 85°C
– Speed Grade: 1 MHz
®
8-bit Microcontroller
8-bit
Microcontroller
with 40K Bytes
In-System
Programmable
Flash
Typical values contained in this datasheet are based on simulations and characterization of
other AVR microcontrollers manufactured on the same process technology. Min and Max values
will be available after the device is characterized.
2548ES–AVR–07/06
2.Overview
The ATmega406 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC
architecture. By executing powerful instructions in a single clock cycle, the ATmega406
achieves throughputs approaching 1 MIPS at 1 MHz.
2.1Block Diagram
Figure 2-1.Block Diagram
ATmega406
RESET
VFET
VREG
XTAL1
XTAL2
BATT
VCC
GND
Oscillator
Circuits /
Clock
Generation
Watchdog
Oscillator
Watchdog
Timer
Powe r
Supervision
POR &
RESET
Charger
Detect
Voltage
Regulator
PD1..0
PORTD (2)
Wake-Up
Timer
CPU
JTAG
SRAMFlash
DATA BU S
PORTC (1)
PB7..0
PORTB (8)
8 bit T/C0
16 bit T/C1
EEPROM
PORTA (8)TWI
FET
Control
Battery
Protection
Cell
Balancing
Voltage
ADC
Voltage
Reference
Coulumb
Counter ADC
PA3..0
OPC
OC
OD
PPI
NNI
PVT
PV4
PV3
PV2
PV1
NV
SGND
VREF
VREFGND
PI
NI
2548ES–AVR–07/06
PC0SCASCL
PA7..0
The ATmega406 provides the following features: a Voltage Regulator, dedicated Battery Protection Circuitry, integrated cell balancing FETs, high-voltage analog front-end, and an MCU with
two ADCs with On-chip voltage reference for battery fuel gauging.
The voltage regulator operates at a wide range of voltages, 4.0 - 25 volts. This voltage is regulated to a constant supply voltage of nominally 3.3 volts for the integrated logic and analog
functions.
The battery protection monitors the battery voltage and charge/discharge current to detect illegal
conditions and protect the battery from these when required. The illegal conditions are deep
under-voltage during discharging, short-circuit during discharging and over-current during charging and discharging.
3
The integrated cell balancing FETs allow cell balancing algorithms to be implemented in
software.
The MCU provides the following features: 40K bytes of In-System Programmable Flash with
Read-While-Write capabilities, 512 bytes EEPROM, 2K byte SRAM, 32 general purpose working
registers, 18 general purpose I/O lines, 11 high-voltage I/O lines, a JTAG Interface for On-chip
Debugging support and programming, two flexible Timer/Counters with PWM and compare
modes, one Wake-up Timer, an SM-Bus compliant TWI module, internal and external interrupts,
a 12-bit Sigma Delta ADC for voltage and temperature measurements, a high resolution Sigma
Delta ADC for Coulomb Counting and instantaneous current measurements, a programmable
Watchdog Timer with internal Oscillator, and four software selectable power saving modes.
The AVR core combines a rich instruction set with 32 general purpose working registers. All the
32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent
registers to be accessed in one single instruction executed in one clock cycle. The resulting
architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers.
The Idle mode stops the CPU while allowing the other chip function to continue functioning. The
Power-down mode allows the voltage regulator, battery protection, regulator current detection,
Watchdog Timer, and Wake-up Timer to operate, while disabling all other chip functions until the
next Interrupt or Hardware Reset. In Power-save mode, the Wake-up Timer and Coulomb
Counter ADC continues to run.
The device is manufactured using Atmel’s high voltage high density non-volatile memory technology. The On-chip ISP Flash allows the program memory to be reprogrammed In-System, by
a conventional non-volatile memory programmer or by an On-chip Boot program running on the
AVR core. The Boot program can use any interface to download the application program in the
Application Flash memory. Software in the Boot Flash section will continue to run while the
Application Flash section is updated, providing true Read-While-Write operation. By combining
an 8-bit RISC CPU with In-System Self-Programmable Flash, fuel gauging ADCs, dedicated battery protection circuitry, Cell Balancing FETs, and a voltage regulator on a monolithic chip, the
Atmel ATmega406 is a powerful microcontroller that provides a highly flexible and cost effective
solution for Li-ion Smart Battery applications.
The ATmega406 AVR is supported with a full suite of program and system development tools
including: C Compilers, Macro Assemblers, Program Debugger/Simulators, and On-chip
Debugger.
4
ATmega406
2548ES–AVR–07/06
2.2Pin Descriptions
2.2.1VFET
High voltage supply pin. This pin is used as supply for the internal voltage regulator, described in
”Voltage Regulator” on page 114. In addition the voltage level on this pin is monitored by the bat-
tery protection circuit, for deep-under-voltage protection. For details, see ”Battery Protection” on
page 125.
2.2.2VCC
Digital supply voltage. Normally connected to VREG.
2.2.3VREG
Output from the internal Voltage Regulator. Used for external decoupling to ensure stable regulator operation. For details, see ”Voltage Regulator” on page 114.
2.2.4VREF
Internal Voltage Reference for external decoupling. For details, see ”Voltage Reference and
Temperature Sensor” on page 121.
ATmega406
2.2.5VREFGND
Ground for decoupling of Internal Voltage Reference. For details, see ”Voltage Reference and
Temperature Sensor” on page 121.
2.2.6GND
Ground
2.2.7SGND
Signal ground pin, used as reference for Voltage-ADC conversions. For details, see ”Voltage
ADC – 10-channel General Purpose 12-bit Sigma-Delta ADC” on page 116.
2.2.8Port A (PA7:PA0)
PA3:PA0 serves as the analog inputs to the Voltage A/D Converter.
Port A also serves as a low-voltage 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). As inputs, Port A pins that are externally pulled low will source current if
the pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes
active, even if the clock is not running.
Port A also serves the functions of various special features of the ATmega406 as listed in ”Alter-
nate Functions of Port A” on page 68.
2.2.9Port B (PB7:PB0)
Port B is a low-voltage 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). As inputs, Port B pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port B pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
2548ES–AVR–07/06
Port B also serves the functions of various special features of the ATmega406 as listed in ”Alter-
nate Functions of Port B” on page 70.
5
2.2.10Port C (PC0)
Port C is a high voltage Open Drain output port.
2.2.11Port D (PD1:PD0)
Port D is a low-voltage 2-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). As inputs, Port D pins that are externally pulled low will source current if the pull-up
resistors are activated. The Port D pins are tri-stated when a reset condition becomes active,
even if the clock is not running.
Port D also serves the functions of various special features of the ATmega406 as listed in ”Alter-
nate Functions of Port D” on page 72.
2.2.12SCL
SMBUS clock, Open Drain bidirectional pin.
2.2.13SDA
SMBUS data, Open Drain bidirectional pin.
2.2.14OC/OD/OPC
High voltage output to drive external Charge/Discharge/Pre-charge FETs. For details, see ”FET
Control” on page 133.
2.2.15PI/NI
Unfiltered positive/negative input from external current sense resistor, used by the battery protection circuit, for over-current and short-circuit detection. For details, see ”Battery Protection” on
page 125.
2.2.16PPI/NNI
Filtered positive/negative input from external current sense resistor, used to by the Coulomb
Counter ADC to measure charge/discharge currents flowing in the battery pack. For details, see
NV, PV1, PV2, PV3, and PV4 are the inputs for battery cells 1, 2, 3 and 4, used by the Voltage
ADC to measure each cell voltage. For details, see ”Voltage ADC – 10-channel General Pur-
pose 12-bit Sigma-Delta ADC” on page 116.
2.2.18PVT
PVT defines the pull-up level for the OD output.
2.2.19BATT
Input for detecting when a charger is connected. This pin also defines the pull-up level for OC
and OPC outputs.
2.2.20RESET
Reset input. A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running. The minimum pulse length is given in Table 11 on page
38. Shorter pulses are not guaranteed to generate a reset.
6
ATmega406
2548ES–AVR–07/06
2.2.21XTAL1
2.2.22XTAL2
3.Resources
ATmega406
Input to the inverting Oscillator amplifier.
Output from the inverting Oscillator amplifier.
A comprehensive set of development tools, application notes and datasheets are available for
download on http://www.atmel.com/avr.
Notes:1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses
should never be written.
2. I/O registers within the address range $00 - $1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions.
3. Some of the status flags are cleared by writing a logical one to them. Note that the CBI and SBI instructions will operate on
all bits in the I/O register, writing a one back into any flag read as set, thus clearing the flag. The CBI and SBI instructions
work with registers 0x00 to 0x1F only.
4. When using the I/O specific commands IN and OUT, the I/O addresses $00 - $3F must be used. When addressing I/O registers as data space using LD and ST instructions, $20 must be added to these addresses. The ATmega406 is a complex
microcontroller with more peripheral units than can be supported within the 64 location reserved in Opcode for the IN and
OUT instructions. For the Extended I/O space from $60 - $FF in SRAM, only the ST/STS/STD and LD/LDS/LDD instructions
can be used.
––––––OCF1ATOV1102
–––––OCF0BOCF0ATOV094
––––––DDD1DDD074
––––––PIND1PIND074
2548ES–AVR–07/06
11
5.Instruction Set Summary
MnemonicsOperandsDescriptionOperationFlags#Clocks
ARITHMETIC AND LOGIC INSTRUCTIONS
ADDRd, RrAdd two RegistersRd ← Rd + RrZ,C,N,V,H1
ADCRd, RrAdd with Carry two RegistersRd ← Rd + Rr + CZ,C,N,V,H1
ADIWRdl,KAdd Immediate to WordRdh:Rdl ← Rdh:Rdl + KZ,C,N,V,S2
SUBRd, RrSubtract two RegistersRd ← Rd - RrZ,C,N,V,H1
SUBIRd, KSubtract Constant from Register Rd ← Rd - KZ,C,N,V,H1
SBCRd, RrSubtract with Carry two RegistersRd ← Rd - Rr - CZ,C,N,V,H1
SBCIRd, KSubtract with Carry Constant from Reg.Rd ← Rd - K - CZ,C,N,V,H1
SBIWRdl,KSubtract Immediate from WordRdh:Rdl ← Rdh:Rdl - KZ,C,N,V,S2
ANDRd, RrLogical AND RegistersRd ← Rd • RrZ,N,V1
ANDIRd, KLogical AND Register and ConstantRd ← Rd • KZ,N,V1
ORRd, RrLogical OR RegistersRd ← Rd v RrZ,N,V1
ORIRd, KLogical OR Register and ConstantRd ← Rd v KZ,N,V1
EORRd, RrExclusive OR RegistersRd ← Rd ⊕ RrZ,N,V1
COMRdOne’s ComplementRd ← 0xFF − RdZ,C,N,V1
NEGRdTwo’s ComplementRd ← 0x00 − RdZ,C,N,V,H1
SBRRd,KSet Bit(s) in RegisterRd ← Rd v KZ,N,V1
CBRRd,KClear Bit(s) in RegisterRd ← Rd • (0xFF - K)Z,N,V1
INCRdIncrementRd ← Rd + 1Z,N,V1
DECRdDecrementRd ← Rd − 1 Z,N,V1
TSTRdTest for Zero or MinusRd ← Rd • Rd Z,N,V1
CLRRdClear RegisterRd ← Rd ⊕ RdZ,N,V1
SERRdSet RegisterRd ← 0xFFNone1
MULRd, RrMultiply UnsignedR1:R0 ← Rd x RrZ,C2
MULSRd, RrMultiply SignedR1:R0 ← Rd x RrZ,C2
MULSURd, RrMultiply Signed with UnsignedR1:R0 ← Rd x RrZ,C2
FMULRd, RrFractional Multiply UnsignedR1:R0 ← (Rd x Rr) << 1Z,C2
FMULSRd, RrFractional Multiply SignedR1:R0 ← (Rd x Rr) << 1Z,C2
FMULSURd, RrFractional Multiply Signed with UnsignedR1:R0 ← (Rd x Rr) << 1Z,C2
BRANCH INSTRUCTIONS
RJMPkRelative JumpPC ← PC + k + 1None2
IJMPIndirect Jump to (Z)PC ← Z None2
JMPkDirect JumpPC ← kNone3
RCALLkRelative Subroutine Call PC ← PC + k + 1None3
ICALLIndirect Call to (Z)PC ← ZNone3
CALLkDirect Subroutine Call PC ← kNone4
RETSubroutine ReturnPC ← STACKNone4
RETIInterrupt ReturnPC ← STACKI4
CPSERd,RrCompare, Skip if Equalif (Rd = Rr) PC ← PC + 2 or 3None1/2/3
CPRd,RrCompareRd − RrZ, N,V,C,H1
CPCRd,RrCompare with CarryRd − Rr − CZ, N,V,C,H1
CPIRd,KCompare Register with ImmediateRd − KZ, N,V,C,H1
SBRCRr, bSkip if Bit in Register Clearedif (Rr(b)=0) PC ← PC + 2 or 3 None1/2/3
SBRSRr, bSkip if Bit in Register is Setif (Rr(b)=1) PC ← PC + 2 or 3None1/2/3
SBICP, bSkip if Bit in I/O Register Clearedif (P(b)=0) PC ← PC + 2 or 3 None1/2/3
SBISP, bSkip if Bit in I/O Register is Setif (P(b)=1) PC ← PC + 2 or 3None1/2/3
BRBSs, kBranch if Status Flag Setif (SREG(s) = 1) then PC←PC+k + 1None1/2
BRBCs, kBranch if Status Flag Clearedif (SREG(s) = 0) then PC←PC+k + 1None1/2
BREQ kBranch if Equal if (Z = 1) then PC ← PC + k + 1None1/2
BRNE kBranch if Not Equalif (Z = 0) then PC ← PC + k + 1None1/2
BRCS kBranch if Carry Setif (C = 1) then PC ← PC + k + 1None1/2
BRCC kBranch if Carry Clearedif (C = 0) then PC ← PC + k + 1None1/2
BRSH kBranch if Same or Higher if (C = 0) then PC ← PC + k + 1None1/2
BRLO kBranch if Lowerif (C = 1) then PC ← PC + k + 1None1/2
BRMI kBranch if Minusif (N = 1) then PC ← PC + k + 1None1/2
BRPL kBranch if Plus if (N = 0) then PC ← PC + k + 1None1/2
BRGE kBranch if Greater or Equal, Signedif (N ⊕ V= 0) then PC ← PC + k + 1None1/2
BRLT kBranch if Less Than Zero, Signedif (N ⊕ V= 1) then PC ← PC + k + 1None1/2
BRHS kBranch if Half Carry Flag Setif (H = 1) then PC ← PC + k + 1None1/2
BRHC kBranch if Half Carry Flag Clearedif (H = 0) then PC ← PC + k + 1None1/2
BRTS kBranch if T Flag Setif (T = 1) then PC ← PC + k + 1None1/2
BRTC kBranch if T Flag Clearedif (T = 0) then PC ← PC + k + 1None1/2
BRVS kBranch if Overflow Flag is Setif (V = 1) then PC ← PC + k + 1None1/2
BRVC kBranch if Overflow Flag is Clearedif (V = 0) then PC ← PC + k + 1None1/2
12
ATmega406
2548ES–AVR–07/06
ATmega406
5.Instruction Set Summary (Continued)
MnemonicsOperandsDescriptionOperationFlags#Clocks
BRIE kBranch if Interrupt Enabledif ( I = 1) then PC ← PC + k + 1None1/2
BRID kBranch if Interrupt Disabledif ( I = 0) then PC ← PC + k + 1None1/2
SEHSet Half Carry Flag in SREGH ← 1H1
CLHClear Half Carry Flag in SREGH ← 0 H1
DATA TRANSFER INSTRUCTIONS
MOVRd, RrMove Between RegistersRd ← RrNone1
MOVWRd, RrCopy Register Word
LDIRd, KLoad ImmediateRd ← KNone1
LDRd, XLoad IndirectRd ← (X)None2
LDRd, X+Load Indirect and Post-Inc.Rd ← (X), X ← X + 1None2
LDRd, - XLoad Indirect and Pre-Dec.X ← X - 1, Rd ← (X)None2
LDRd, YLoad IndirectRd ← (Y)None2
LDRd, Y+Load Indirect and Post-Inc.Rd ← (Y), Y ← Y + 1None2
LDRd, - YLoad Indirect and Pre-Dec.Y ← Y - 1, Rd ← (Y)None2
LDDRd,Y+qLoad Indirect with DisplacementRd ← (Y + q)None2
LDRd, ZLoad Indirect Rd ← (Z)None2
LDRd, Z+Load Indirect and Post-Inc.Rd ← (Z), Z ← Z+1None2
LDRd, -ZLoad Indirect and Pre-Dec.Z ← Z - 1, Rd ← (Z)None2
LDDRd, Z+qLoad Indirect with DisplacementRd ← (Z + q)None2
LDSRd, kLoad Direct from SRAMRd ← (k)None2
STX, RrStore Indirect(X) ← RrNone2
STX+, RrStore Indirect and Post-Inc.(X) ← Rr, X ← X + 1None2
ST- X, RrStore Indirect and Pre-Dec.X ← X - 1, (X) ← RrNone2
STY, RrStore Indirect(Y) ← RrNone2
STY+, RrStore Indirect and Post-Inc.(Y) ← Rr, Y ← Y + 1None2
ST- Y, RrStore Indirect and Pre-Dec.Y ← Y - 1, (Y) ← RrNone2
STDY+q,RrStore Indirect with Displacement(Y + q) ← RrNone2
STZ, RrStore Indirect(Z) ← RrNone2
STZ+, RrStore Indirect and Post-Inc.(Z) ← Rr, Z ←
ST-Z, RrStore Indirect and Pre-Dec.Z ← Z - 1, (Z) ← RrNone2
STDZ+q,RrStore Indirect with Displacement(Z + q) ← RrNone2
STSk, RrStore Direct to SRAM(k) ← RrNone2
LPMLoad Program MemoryR0 ← (Z)None3
LPMRd, ZLoad Program MemoryRd ← (Z)None3
LPMRd, Z+Load Program Memory and Post-IncRd ← (Z), Z ← Z+1None3
SPMStore Program Memory(Z) ← R1:R0None-
INRd, PIn PortRd ← PNone1
Rd+1:Rd ← Rr+1:Rr
Z + 1None2
None1
2548ES–AVR–07/06
13
5.Instruction Set Summary (Continued)
MnemonicsOperandsDescriptionOperationFlags#Clocks
OUTP, RrOut PortP ← RrNone1
PUSHRrPush Register on StackSTACK ← RrNone2
POPRdPop Register from StackRd ← STACKNone2
MCU CONTROL INSTRUCTIONS
NOPNo OperationNone1
SLEEPSleep(see specific descr. for Sleep function)None1
WDRWatchdog Reset(see specific descr. for WDR/timer)None1
BREAKBreakFor On-chip Debug OnlyNoneN/A
14
ATmega406
2548ES–AVR–07/06
ATmega406
6.Ordering Information
Speed (MHz)Power SupplyOrdering CodePackage
14.0 - 25VATmega406-1AAU
Notes:1. This device can also be supplied in wafer form. Please contact your local Atmel sales office for detailed ordering information
and minimum quantities.
2. Pb-free packaging alternative, complies to the European Directive for Restriction of Hazardous Substances (RoHS directive). Also Halide free and fully Green.
(2)
48AA
(1)
Operation Range
Industrial
(-30°C to 85°C)
Package Type
48AA48-lead, 7 x 7 x 1.44 mm body, 0.5 mm lead pitch, Low Profile Plastic Quad Flat Package (LQFP)
2548ES–AVR–07/06
15
7.Packaging Information
7.148AA
PIN 1
PIN 1 IDENTIFIER
B
e
E1E
D1
D
C
0˚~7˚
A1
L
Notes:1. This package conforms to JEDEC reference MS-026, Variation BBC.
2. Dimensions D1 and E1 do not include mold protrusion. Allowable
protrusion is 0.25 mm per side. Dimensions D1 and E1 are maximum
plastic body size dimensions including mold mismatch.
3. Lead coplanarity is 0.08 mm maximum.
A2A
SYMBOL
COMMON DIMENSIONS
(Unit of Measure = mm)
MIN
A––1.60
A10.05–0.15
A2 1.351.401.45
D8.759.009.25
D16.907.007.10Note 2
E8.759.009.25
E16.907.007.10Note 2
B 0.17–0.27
C0.09–0.20
L0.45– 0.75
e0.50 TYP
NOM
MAX
NOTE
16
2325 Orchard Parkway
R
San Jose, CA 95131
ATmega406
TITLE
48AA, 48-lead, 7 x 7 mm Body Size, 1.4 mm Body Thickness,
0.5 mm Lead Pitch, Low Profile Plastic Quad Flat Package (LQFP)
10/5/2001
DRAWING NO.
48AA
2548ES–AVR–07/06
REV.
C
8.Errata
8.1Rev. F
ATmega406
• Voltage-ADC Common Mode Offset
• Voltage Reference Spike
1.Voltage-ADC Common Mode Offset
The cell conversion will have an Offset-error depending on the Common Mode (CM) level.
This means that the error of a cell is depending on the voltage of the lower cells. The CM
Offset is calibrated away in Atmel production when the cells are balanced. When the cells
get un-balanced the CM depending offset will reappear:
a. Cell 1 defines its own CM level, and will never be affected by the CM dependent
offset.
b. The CM level for Cell 2 will change if Cell 1 voltage deviates from Cell 2 voltage.
c.The CM level for Cell 3 will change if Cell 1 and/or Cell 2 voltage deviates from the
voltage at Cell 3. The worst-case error is when Cell 1 and 2 are balanced while Cell 3
voltage deviates from the voltage at Cell 1 and 2.
d. The CM level for Cell 4 will change if Cell 1, Cell 2 and/or Cell 3 deviate from the volt-
age at Cell 4. The worst-case error is when Cell 1, Cell 2 and Cell 3 are balanced
while Cell 4 voltage deviates from the voltage at Cell 1, 2 and 3.
Figure 9-1 on page 18, shows the error of Cell2, Cell3 and Cell4 with 5% and 10% unbal-
anced cells.
2548ES–AVR–07/06
17
Figure 8-1.CM Offset with unbalanced cells.
18
Problem Fix/Workaround
Avoid getting unbalanced cells by using the internal cell balancing FETs.
2.Voltage Reference spike
The Voltage Reference, VREF, will spike each time the internal temperature sensor is
enabled. The temperature sensor is enabled when the VTEMP is selected in the VADMUX
register and the V-ADC is enabled by the VADEN bit.
The spike will be approximately 50mV and lasts for about 5ms, and it will affect any ongoing
current accumulation in the CC-ADC, as well as V-ADC conversions in the period of the
spike. Figure 9-2 on page 19 illustrates the Voltage Reference spike.
ATmega406
2548ES–AVR–07/06
Figure 8-2.Voltage Reference Spike
e
Voltage
ATmega406
1.1 V
VADEN
VADMUX3:0XXXVTEMP
V~50mV
t ~< 5ms
VREF
tim
Problem workaround:
To get correct temperature measurement, the VADSC bit should not be written until the
spike has settled (external decoupling capacitor of 1μF).
2548ES–AVR–07/06
19
8.2Rev. E
• Voltage ADC not functional below 0°C
•
Voltage-ADC Common Mode Offset
• Voltage Reference Spike
1. Voltage-ADC Failing at Low Temperatures
Voltage ADC not functional below 0°C. The voltage ADC has a very large error below 0°C,
and can not be used
Problem Fix/Workaround
Do not use this revision below 0 celsius.
2.Voltage-ADC Common Mode Offset
The cell conversion will have an Offset-error depending on the Common Mode (CM) level.
This means that the error of a cell is depending on the voltage of the lower cells. The CM
Offset is calibrated away in Atmel production when the cells are balanced. When the cells
get un-balanced the CM depending offset will reappear:
a. Cell 1 defines its own CM level, and will never be affected by the CM dependent
offset.
b. The CM level for Cell 2 will change if Cell 1 voltage deviates from Cell 2 voltage.
c.The CM level for Cell 3 will change if Cell 1 and/or Cell 2 voltage deviates from the
voltage at Cell 3. The worst-case error is when Cell 1 and 2 are balanced while Cell 3
voltage deviates from the voltage at Cell 1 and 2.
d. The CM level for Cell 4 will change if Cell 1, Cell 2 and/or Cell 3 deviate from the volt-
age at Cell 4. The worst-case error is when Cell 1, Cell 2 and Cell 3 are balanced
while Cell 4 voltage deviates from the voltage at Cell 1, 2 and 3.
Figure 9-1 on page 18, shows the error of Cell2, Cell3 and Cell4 with 5% and 10% unbal-
anced cells.
20
ATmega406
2548ES–AVR–07/06
Figure 8-3.CM Offset with unbalanced cells.
ATmega406
2548ES–AVR–07/06
Problem Fix/Workaround
Avoid getting unbalanced cells by using the internal cell balancing FETs.
3. Voltage Reference Spike
The Voltage Reference, VREF, will spike each time a temperature measurement is started
with the Voltage-ADC.
Problem Fix/Workaround
An accurate temperature measurement could be obtained by doing 10 temperature conversions immediately after each other. The first 9 results would be inaccurate, but the 10th
conversion will be correct.
Figure 9-4 on page 22 illustrates the spike on the Voltage Reference when doing 10 temper-
ature conversions in a row (external decoupling capacitor of 1μF).
21
Figure 8-4.Voltage Reference Spike
e
Voltage
8.3Rev. D
1.1 V
VADSC(10 VTEMP conversion in a row)
VADMUX3:0
V~50mV
t ~< 5ms
XXXVTEMP
VREF
tim
If the CC-ADC is doing current accumulation while the V-ADC is doing temperature measurement, both the Instantaneous and the Accumulated conversion results will be affected.
The spike on VREF will be visible on 1 Accumulated Current (CADAC3…0) and 2 Instantaneous Current (CADIC1…0) conversion results.
• Voltage ADC not functional below 0°C
•
Voltage-ADC Common Mode Offset
• Voltage Reference Spike
• Voltage Regulator Start-up sequence
• V
influenced by MCU state
REF
• EEPROM read from application code does not work in Lock Bit Mode 3
22
1. Voltage-ADC Failing at Low Temperatures
Voltage ADC not functional below 0°C. The voltage ADC has a very large error below 0°C,
and can not be used
Problem Fix/Workaround
1.Voltage-ADC Common Mode Offset
The cell conversion will have an Offset-error depending on the Common Mode (CM) level.
This means that the error of a cell is depending on the voltage of the lower cells. The CM
Offset is calibrated away in Atmel production when the cells are balanced. When the cells
get un-balanced the CM depending offset will reappear:
ATmega406
2548ES–AVR–07/06
ATmega406
a. Cell 1 defines its own CM level, and will never be affected by the CM dependent
offset.
b. The CM level for Cell 2 will change if Cell 1 voltage deviates from Cell 2 voltage.
c.The CM level for Cell 3 will change if Cell 1 and/or Cell 2 voltage deviates from the
voltage at Cell 3. The worst-case error is when Cell 1 and 2 are balanced while Cell 3
voltage deviates from the voltage at Cell 1 and 2.
d. The CM level for Cell 4 will change if Cell 1, Cell 2 and/or Cell 3 deviate from the volt-
age at Cell 4. The worst-case error is when Cell 1, Cell 2 and Cell 3 are balanced
while Cell 4 voltage deviates from the voltage at Cell 1, 2 and 3.
Figure 9-1 on page 18, shows the error of Cell2, Cell3 and Cell4 with 5% and 10% unbal-
anced cells.
Figure 8-5.CM Offset with unbalanced cells.
2548ES–AVR–07/06
Problem Fix/Workaround
Avoid getting unbalanced cells by using the internal cell balancing FETs.
23
3. Voltage Reference Spike
e
The Voltage Reference, VREF, will spike each time a temperature measurement is started
with the Voltage-ADC.
Problem Fix/Workaround
An accurate temperature measurement could be obtained by doing 10 temperature conversions immediately after each other. The first 9 results would be inaccurate, but the 10th
conversion will be correct.
Figure 9-6 illustrates the spike on the Voltage Reference when doing 10 temperature con-
versions in a row (external decoupling capacitor of 1μF).
Figure 8-6.Voltage Reference Spike
Voltage
1.1 V
VADSC(10 VTEMP conversion in a row)
VADMUX3:0
V~50mV
t ~< 5ms
XXXVTEMP
VREF
tim
If the CC-ADC is doing current accumulation while the V-ADC is doing temperature measurement, both the Instantaneous and the Accumulated conversion results will be affected.
The spike on VREF will be visible on 1 Accumulated Current (CADAC3…0) and 2 Instantaneous Current (CADIC1…0) conversion results.
24
ATmega406
2548ES–AVR–07/06
ATmega406
4. Voltage Regulator Start-up sequence
When powering up ATmega406 some precautions are necessary to ensure proper start-up
of the Voltage Regulator.
Problem Fix/Workaround
The three steps below are needed to ensure proper start-up of the voltage regulator.
a. Do NOT connect a capacitor larger than 100 nF on the VFET pin. This is to ensure
fast rise time on the VFET pin when a supply voltage is connected.
b.During assembly, always connect Cell1 first, then Cell2 and so on until the top cell is
connected to PVT. If the cell voltages are about 2 volts or larger, the Voltage Regula-
tor will normally start up properly in Power-off mode (VREG appr. 2.8 volts).
c.After all cells have been assembled as described in step 2, a charger source must be
connected at the BATT+ terminal to initialize the chip, see Section 8.3 ”Power-on
Reset and Charger Connect” on page 38 in the datasheet.
If the Voltage Regulator started up in Power-off during assembly of the cells, the chip will initialize when the charger source makes the voltage at the BATT pin exceed 7 - 8 Volts.
If the Voltage Regulator did not start up properly, the charger source has one additional
requirement to ensure proper start up and initialization. In this case the charger source must
ensure that the voltage at the VFET pin increases quickly at least 3 Volts above the voltage
at the PVT pin, and that the voltage at the BATT pin exceeds 7 - 8 Volts. This will start up
and initialize the chip directly.
5. V
influenced by MCU state
REF
The reference voltage at the V
pin depends on the following conditions of the device:
REF
a. Charger Over-current and/or Discharge Over-current Protection active but Short-cir-
cuit inactive. This will increase V
voltage with typical 1 mV compared to a
REF
condition were all Current Protections are disabled.
b. Short-circuit Protection active. Short-circuit measurements are activated when SCD
in BPCR is zero (default) and DFE in FET Control and Status Register (FCSR) is set.
This will increase V
voltage with typical 8 mV compared to a condition with short-
REF
circuit measurements inactive.
c.V-ADC conversion of the internal VTEMP voltage. This will increase V
voltage
REF
with typical 15 mV compared to a condition with short-circuit measurements inactive.
Problem Fix/Work around
To ensure the highest accuracy, set the Bandgap Calibration Register (BGCC) to get 1.100
V at V
after the chip is configured with the actual Battery Protection settings and the Dis-
REF
charge FET is enabled.
6. EEPROM read from application code does not work in Lock Bit Mode 3
When the Memory Lock Bits LB2 and LB1 are programmed to mode 3, EEPROM read does
not work from the application code.
Problem Fix/Work around
Do not set Lock Bit Protection Mode 3 when the application code needs to read from
EEPROM.
2548ES–AVR–07/06
25
9.Datasheet Revision History
9.1Rev 2548E - 07/06
1.Updated ”Pin Configurations” on page 2.
2.Updated ”ADC Noise Reduction Mode” on page 32.
3.Updated ”Power-save Mode” on page 32.
4.Updated ”Power-down Mode” on page 33.
5Updated ”Power-off Mode” on page 33.
6.Updated ”Power Reduction Register” on page 36.
7.Added ”Voltage ADC” on page 37 and ”Coloumb Counter” on page 38.
8.Updated ”Reset Sources” on page 39.
9.Updated ”Power-on Reset and Charger Connect” on page 40.
10.Updated ”External Reset” on page 41.
11.V
12.Updated ”Alternate Port Functions” on page 66.
13.Updated ”Internal Clock Source” on page 103.
14.Updated ”External Clock Source” on page 103.
15.Updated Features in ”Coulomb Counter - Dedicated Fuel Gauging Sigma-delta ADC”