atmega128a.pdf

(532 KB) Pobierz
ATmega128A Datasheet Summary
Features
High-performance, Low-power AVR ® 8-bit Microcontroller
Advanced RISC Architecture
– 133 Powerful Instructions – Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers + Peripheral Control Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
High Endurance Non-volatile Memory segments
– 128K Bytes of In-System Self-programmable Flash program memory
– 4K Bytes EEPROM
– 4K Bytes Internal SRAM
– Write/Erase cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C (1)
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– Up to 64K Bytes Optional External Memory Space
– Programming Lock for Software Security
– SPI Interface for In-System Programming
JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EEPROM, Fuses and Lock Bits through the JTAG Interface
Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– Two Expanded 16-bit Timer/Counters with Separate Prescaler, Compare Mode and
Capture Mode
– Real Time Counter with Separate Oscillator
– Two 8-bit PWM Channels
– 6 PWM Channels with Programmable Resolution from 2 to 16 Bits
– Output Compare Modulator
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
– Byte-oriented Two-wire Serial Interface
– Dual Programmable Serial USARTs
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with On-chip Oscillator
– On-chip Analog Comparator
Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby,
and Extended Standby
– Software Selectable Clock Frequency
– ATmega103 Compatibility Mode Selected by a Fuse
– Global Pull-up Disable
I/O and Packages
– 53 Programmable I/O Lines
– 64-lead TQFP and 64-pad QFN/MLF
Operating Voltages
– 2.7 - 5.5V
Speed Grades
– 0 - 16 MHz
8-bit
Microcontroller
with 128K Bytes
In-System
Programmable
Flash
ATmega128A
Summary
Rev. 8151GS–AVR–07/10
490197622.250.png 490197622.261.png 490197622.272.png 490197622.283.png 490197622.001.png 490197622.012.png 490197622.023.png
 
ATmega128A
1. Pin Configurations
Figure 1-1. Pinout ATmega128A
PEN
RXD0/(PDI) PE0
(TXD0/PDO) PE1
(XCK0/AIN0) PE2
(OC3A/AIN1) PE3
(OC3B/INT4) PE4
(OC3C/INT5) PE5
(T3/INT6) PE6
(ICP3/IN T7 ) PE7
(SS) PB0
(SCK) PB1
(MOSI) PB2
(MISO) PB3
(OC0) PB4
(OC1A) PB5
(OC1B) PB6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
PA3 (AD3)
PA4 (AD4)
PA5 (AD5)
PA6 (AD6)
PA7 (AD7)
PG2(ALE)
PC7 (A15)
PC6 (A14)
PC5 (A13)
PC4 (A12)
PC3 (A11)
PC2 (A10)
PC1 (A9)
PC0 (A8 )
PG1( RD )
PG0(WR)
Note: The Pinout figure applies to both TQFP and MLF packages. The bottom pad under the QFN/MLF
package should be soldered to ground.
2. Overview
The ATmega128A 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 ATmega128A
achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize
power consumption versus processing speed.
19
8151GS–AVR–07/10
490197622.044.png 490197622.055.png 490197622.066.png 490197622.077.png 490197622.088.png 490197622.099.png 490197622.110.png 490197622.121.png 490197622.132.png
 
ATmega128A
2.1 Block Diagram
Figure 2-1. Block Diagram
PF0 - PF7
PA0 - PA7
PC0 - PC7
VCC
GND
PORTF DRIVERS
PORTA DRIVERS
PORTC DRIVERS
DATA REGISTER
PORTF
DATA DIR.
REG. PORTF
DATA REGISTER
PORTA
DATA DIR.
REG. PORTA
DATA REGISTER
PORTC
DATA DIR.
REG. PORTC
8-BIT DATA BUS
AVCC
CALIB. OSC
INTERNAL
OSCILLATOR
AGND
ADC
AREF
OSCILLATOR
JTAG TAP
PROGRAM
COUNTER
STACK
POINTER
WATCHDOG
TIMER
OSCILLATOR
ON-CHIP DEBUG
PROGRAM
FLASH
SRAM
MCU CONTROL
REGISTER
TIMING AND
CONTROL
BOUNDARY-
SCAN
INSTRUCTION
REGISTER
GENERAL
PURPOSE
REGISTERS
TIMER/
COUNTERS
X
PROGRAMMING
LOGIC
PEN
INSTRUCTION
DECODER
Y
INTERRUPT
UNIT
Z
CONTROL
LINES
ALU
EEPROM
STATUS
REGISTER
USART0
SPI
USART1
TWO-WIRE SERIAL
INTERFACE
DATA REGISTER
PORTE
DATA DIR.
REG. PORTE
DATA REGISTER
PORTB
DATA DIR.
REG. PORTB
DATA REGISTER
PORTD
DATA DIR.
REG. PORTD
DATA REG.
PORTG
DATA DIR.
REG. PORTG
PORTE DRIVERS
PORTB DRIVERS
PORTD DRIVERS
PORTG DRIVERS
PE0 - PE7
PB0 - PB7
PD0 - PD7
PG0 - PG4
19
8151GS–AVR–07/10
490197622.153.png 490197622.164.png 490197622.175.png 490197622.186.png 490197622.197.png 490197622.208.png 490197622.219.png 490197622.221.png 490197622.222.png 490197622.223.png 490197622.224.png 490197622.225.png 490197622.226.png 490197622.227.png 490197622.228.png 490197622.229.png 490197622.230.png 490197622.231.png 490197622.232.png 490197622.233.png 490197622.234.png 490197622.235.png 490197622.236.png 490197622.237.png 490197622.238.png 490197622.239.png 490197622.240.png 490197622.241.png 490197622.242.png 490197622.243.png 490197622.244.png 490197622.245.png 490197622.246.png 490197622.247.png 490197622.248.png 490197622.249.png 490197622.251.png 490197622.252.png 490197622.253.png 490197622.254.png 490197622.255.png 490197622.256.png 490197622.257.png 490197622.258.png 490197622.259.png 490197622.260.png 490197622.262.png 490197622.263.png 490197622.264.png 490197622.265.png 490197622.266.png 490197622.267.png 490197622.268.png 490197622.269.png 490197622.270.png 490197622.271.png 490197622.273.png 490197622.274.png 490197622.275.png 490197622.276.png 490197622.277.png 490197622.278.png 490197622.279.png 490197622.280.png 490197622.281.png 490197622.282.png 490197622.284.png 490197622.285.png 490197622.286.png 490197622.287.png 490197622.288.png 490197622.289.png 490197622.290.png 490197622.291.png 490197622.292.png 490197622.293.png 490197622.002.png 490197622.003.png 490197622.004.png 490197622.005.png 490197622.006.png 490197622.007.png 490197622.008.png 490197622.009.png 490197622.010.png 490197622.011.png 490197622.013.png 490197622.014.png 490197622.015.png 490197622.016.png 490197622.017.png 490197622.018.png 490197622.019.png 490197622.020.png 490197622.021.png 490197622.022.png 490197622.024.png 490197622.025.png 490197622.026.png 490197622.027.png 490197622.028.png 490197622.029.png 490197622.030.png 490197622.031.png 490197622.032.png 490197622.033.png 490197622.034.png 490197622.035.png 490197622.036.png 490197622.037.png 490197622.038.png 490197622.039.png 490197622.040.png 490197622.041.png 490197622.042.png 490197622.043.png 490197622.045.png 490197622.046.png 490197622.047.png 490197622.048.png 490197622.049.png 490197622.050.png 490197622.051.png 490197622.052.png 490197622.053.png 490197622.054.png 490197622.056.png 490197622.057.png 490197622.058.png 490197622.059.png 490197622.060.png 490197622.061.png 490197622.062.png 490197622.063.png 490197622.064.png 490197622.065.png 490197622.067.png 490197622.068.png 490197622.069.png 490197622.070.png 490197622.071.png 490197622.072.png 490197622.073.png 490197622.074.png 490197622.075.png 490197622.076.png 490197622.078.png 490197622.079.png 490197622.080.png 490197622.081.png 490197622.082.png 490197622.083.png 490197622.084.png 490197622.085.png 490197622.086.png 490197622.087.png 490197622.089.png 490197622.090.png 490197622.091.png 490197622.092.png 490197622.093.png 490197622.094.png 490197622.095.png 490197622.096.png 490197622.097.png 490197622.098.png 490197622.100.png 490197622.101.png 490197622.102.png 490197622.103.png 490197622.104.png 490197622.105.png 490197622.106.png 490197622.107.png 490197622.108.png 490197622.109.png 490197622.111.png 490197622.112.png 490197622.113.png 490197622.114.png 490197622.115.png 490197622.116.png 490197622.117.png 490197622.118.png 490197622.119.png 490197622.120.png 490197622.122.png 490197622.123.png 490197622.124.png 490197622.125.png 490197622.126.png 490197622.127.png 490197622.128.png 490197622.129.png 490197622.130.png 490197622.131.png 490197622.133.png 490197622.134.png 490197622.135.png 490197622.136.png 490197622.137.png 490197622.138.png 490197622.139.png 490197622.140.png 490197622.141.png 490197622.142.png 490197622.143.png 490197622.144.png 490197622.145.png 490197622.146.png 490197622.147.png 490197622.148.png 490197622.149.png 490197622.150.png 490197622.151.png 490197622.152.png 490197622.154.png 490197622.155.png 490197622.156.png 490197622.157.png 490197622.158.png 490197622.159.png 490197622.160.png 490197622.161.png 490197622.162.png 490197622.163.png 490197622.165.png 490197622.166.png 490197622.167.png 490197622.168.png 490197622.169.png 490197622.170.png 490197622.171.png 490197622.172.png 490197622.173.png 490197622.174.png 490197622.176.png 490197622.177.png 490197622.178.png 490197622.179.png 490197622.180.png 490197622.181.png 490197622.182.png 490197622.183.png 490197622.184.png 490197622.185.png 490197622.187.png 490197622.188.png 490197622.189.png 490197622.190.png 490197622.191.png 490197622.192.png 490197622.193.png 490197622.194.png 490197622.195.png 490197622.196.png 490197622.198.png 490197622.199.png 490197622.200.png 490197622.201.png 490197622.202.png 490197622.203.png 490197622.204.png 490197622.205.png 490197622.206.png 490197622.207.png 490197622.209.png 490197622.210.png 490197622.211.png 490197622.212.png 490197622.213.png 490197622.214.png 490197622.215.png
ATmega128A
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 con-
ventional CISC microcontrollers.
The ATmega128A provides the following features: 128K bytes of In-System Programmable
Flash with Read-While-Write capabilities, 4K bytes EEPROM, 4K bytes SRAM, 53 general pur-
pose I/O lines, 32 general purpose working registers, Real Time Counter (RTC), four flexible
Timer/Counters with compare modes and PWM, 2 USARTs, a byte oriented Two-wire Serial
Interface, an 8-channel, 10-bit ADC with optional differential input stage with programmable
gain, programmable Watchdog Timer with Internal Oscillator, an SPI serial port, IEEE std.
1149.1 compliant JTAG test interface, also used for accessing the On-chip Debug system and
programming and six software selectable power saving modes. The Idle mode stops the CPU
while allowing the SRAM, Timer/Counters, SPI port, and interrupt system to continue function-
ing. The Power-down mode saves the register contents but freezes the Oscillator, disabling all
other chip functions until the next interrupt or Hardware Reset. In Power-save mode, the asyn-
chronous timer continues to run, allowing the user to maintain a timer base while the rest of the
device is sleeping. The ADC Noise Reduction mode stops the CPU and all I/O modules except
Asynchronous Timer and ADC, to minimize switching noise during ADC conversions. In Standby
mode, the Crystal/Resonator Oscillator is running while the rest of the device is sleeping. This
allows very fast start-up combined with low power consumption. In Extended Standby mode,
both the main Oscillator and the Asynchronous Timer continue to run.
The device is manufactured using Atmel’s high-density nonvolatile memory technology. The On-
chip ISP Flash allows the program memory to be reprogrammed in-system through an SPI serial
interface, by a conventional nonvolatile 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 on a monolithic chip,
the Atmel ATmega128A is a powerful microcontroller that provides a highly flexible and cost
effective solution to many embedded control applications.
The ATmega128A AVR is supported with a full suite of program and system development tools
including: C compilers, macro assemblers, program debugger/simulators, in-circuit emulators,
and evaluation kits.
2.2 ATmega103 and ATmega128A Compatibility
The ATmega128A is a highly complex microcontroller where the number of I/O locations super-
sedes the 64 I/O locations reserved in the AVR instruction set. To ensure backward compatibility
with the ATmega103, all I/O locations present in ATmega103 have the same location in
ATmega128A. Most additional I/O locations are added in an Extended I/O space starting from
$60 to $FF, (i.e., in the ATmega103 internal RAM space). These locations can be reached by
using LD/LDS/LDD and ST/STS/STD instructions only, not by using IN and OUT instructions.
The relocation of the internal RAM space may still be a problem for ATmega103 users. Also, the
increased number of interrupt vectors might be a problem if the code uses absolute addresses.
To solve these problems, an ATmega103 compatibility mode can be selected by programming
the fuse M103C. In this mode, none of the functions in the Extended I/O space are in use, so the
internal RAM is located as in ATmega103. Also, the Extended Interrupt vectors are removed.
19
8151GS–AVR–07/10
490197622.216.png 490197622.217.png
ATmega128A
The ATmega128A is 100% pin compatible with ATmega103, and can replace the ATmega103
on current Printed Circuit Boards. The application note “Replacing ATmega103 by
ATmega128A” describes what the user should be aware of replacing the ATmega103 by an
ATmega128A.
2.2.1
ATmega103 Compatibility Mode
By programming the M103C fuse, the ATmega128 will be compatible with the ATmega103
regards to RAM, I/O pins and interrupt vectors as described above. However, some new fea-
tures in ATmega128 are not available in this compatibility mode, these features are listed below:
One USART instead of two, Asynchronous mode only. Only the eight least significant bits of
the Baud Rate Register is available.
One 16 bits Timer/Counter with two compare registers instead of two 16-bit Timer/Counters
with three compare registers.
Two-wire serial interface is not supported.
Port C is output only.
Port G serves alternate functions only (not a general I/O port).
Port F serves as digital input only in addition to analog input to the ADC.
Boot Loader capabilities is not supported.
It is not possible to adjust the frequency of the internal calibrated RC Oscillator.
The External Memory Interface can not release any Address pins for general I/O, neither
configure different wait-states to different External Memory Address sections.
In addition, there are some other minor differences to make it more compatible to
ATmega103:
Only EXTRF and PORF exists in MCUCSR.
Timed sequence not required for Watchdog Time-out change.
External Interrupt pins 3 - 0 serve as level interrupt only.
USART has no FIFO buffer, so data overrun comes earlier.
Unused I/O bits in ATmega103 should be written to 0 to ensure same operation in ATmega128.
2.3 Pin Descriptions
2.3.1
VCC
Digital supply voltage.
2.3.2
GND
Ground.
2.3.3
Port A (PA7:PA0)
Port A is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The
Port A output buffers have symmetrical drive characteristics with both high sink and source
capability. 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 ATmega128A as listed on
page 73 .
19
8151GS–AVR–07/10
490197622.218.png 490197622.220.png
Zgłoś jeśli naruszono regulamin