General Porting Considerations. Memory EEPROM XRAM



Similar documents
AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR134: Real Time Clock (RTC) using the Asynchronous Timer. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

8-bit Microcontroller. Application Note. AVR400: Low Cost A/D Converter

AVR106: C functions for reading and writing to Flash memory. 8-bit Microcontrollers. Application Note. Features. Introduction

8-bit Microcontroller. Application Note. AVR105: Power Efficient High Endurance Parameter Storage in Flash Memory

8-bit Microcontroller. Application Note. AVR222: 8-point Moving Average Filter

8-bit RISC Microcontroller. Application Note. AVR182: Zero Cross Detector

AT89C5131A Starter Kit... Software User Guide

Application Note. C51 Bootloaders. C51 General Information about Bootloader and In System Programming. Overview. Abreviations

AVR030: Getting Started with IAR Embedded Workbench for Atmel AVR. 8-bit Microcontrollers. Application Note. Features.

AVR245: Code Lock with 4x4 Keypad and I2C LCD. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

How to Calculate the Capacitor of the Reset Input of a C51 Microcontroller 80C51. Application Note. Microcontrollers. Introduction

8-bit RISC Microcontroller. Application Note. AVR236: CRC Check of Program Memory

AT91 ARM Thumb Microcontrollers. Application Note. Interfacing a PC Card to an AT91RM9200-DK. Introduction. Hardware Interface

Application Note. 8-bit Microcontrollers. AVR091: Replacing AT90S2313 by ATtiny2313. Features. Introduction

8-bit Microcontroller. Application Note. AVR415: RC5 IR Remote Control Transmitter. Features. Introduction. Figure 1.

AT91 ARM Thumb Microcontrollers. AT91SAM CAN Bootloader. AT91SAM CAN Bootloader User Notes. 1. Description. 2. Key Features

8-bit Microcontroller. Application Note. AVR314: DTMF Generator

AVR32110: Using the AVR32 Timer/Counter. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Quick Start Guide. CAN Microcontrollers. ATADAPCAN01 - STK501 CAN Extension. Requirements

Tag Tuning/RFID. Application Note. Tag Tuning. Introduction. Antenna Equivalent Circuit

3-output Laser Driver for HD-DVD/ Blu-ray/DVD/ CD-ROM ATR0885. Preliminary. Summary

8-bit Microcontroller. Application Note. AVR201: Using the AVR Hardware Multiplier

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

AVR033: Getting Started with the CodeVisionAVR C Compiler. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR120: Characterization and Calibration of the ADC on an AVR. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR32701: AVR32AP7 USB Performance. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

AVR353: Voltage Reference Calibration and Voltage ADC Usage. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

AVR442: PC Fan Control using ATtiny13. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

8-bit Microcontroller. Application. Note. AVR204: BCD Arithmetics. Features. Introduction. 16-bit Binary to 5-digit BCD Conversion bin2bcd16

AVR034: Mixing C and Assembly Code with IAR Embedded Workbench for AVR. 8-bit Microcontroller. Application Note. Features.

AVR241: Direct driving of LCD display using general IO. 8-bit Microcontrollers. Application Note. Features. Introduction AVR

AVR32100: Using the AVR32 USART. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

8-bit RISC Microcontroller. Application Note. AVR155: Accessing an I 2 C LCD Display using the AVR 2-wire Serial Interface

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

AVR1318: Using the XMEGA built-in AES accelerator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

8-bit Microcontroller. Application Note. AVR461: Quick Start Guide for the Embedded Internet Toolkit. Introduction. System Requirements

Application Note. USB Mass Storage Device Implementation. USB Microcontrollers. References. Abbreviations. Supported Controllers

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

AVR055: Using a 32kHz XTAL for run-time calibration of the internal RC. 8-bit Microcontrollers. Application Note. Features.

Application Note. 8-bit Microcontrollers. AVR280: USB Host CDC Demonstration. 1. Introduction

AT86RF230 (2450 MHz band) Radio Transceiver... User Guide

AVR1600: Using the XMEGA Quadrature Decoder. 8-bit Microcontrollers. Application Note. Features. 1 Introduction. Sensors

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

Table of Contents. Section 1 Introduction Section 2 Getting Started Section 3 Hardware Description

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

USB Test Environment ATUSBTEST- SS7400. Summary

AVR1510: Xplain training - XMEGA USART. 8-bit Microcontrollers. Application Note. Prerequisites. 1 Introduction

How To Prevent Power Supply Corruption On An 8Bit Microcontroller From Overheating

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

AVR1922: Xplain Board Controller Firmware. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR2006: Design and characterization of the Radio Controller Board's 2.4GHz PCB Antenna. Application Note. Features.

DIP Top View VCC A16 A15 A12 A7 A6 A5 A4 A3 A2 A1 A0 I/O0 I/O1 I/O2 GND A17 A14 A13 A8 A9 A11 A10 I/O7 I/O6 I/O5 I/O4 I/O3. PLCC Top View VCC A17

Two-wire Automotive Serial EEPROM AT24C01A AT24C02 AT24C04 AT24C08 (1) AT24C16 (2)

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

3-output Laser Driver for HD-DVD/ Blu-ray/DVD/ CD-ROM ATR0885. Preliminary. Summary. Features. Applications. 1. Description

USB 2.0 Full-Speed Host/Function Processor AT43USB370. Summary. Features. Overview

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

Application Note. Migrating from RS-232 to USB Bridge Specification USB Microcontrollers. Doc Control. References. Abbreviations

Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

AVR444: Sensorless control of 3-phase brushless DC motors. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR068: STK500 Communication Protocol. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

Application Note. 8-bit Microcontrollers. AVR272: USB CDC Demonstration UART to USB Bridge

8-bit RISC Microcontroller. Application Note. AVR910: In-System Programming

APPLICATION NOTE. Atmel AT04389: Connecting SAMD20E to the AT86RF233 Transceiver. Atmel SAMD20. Description. Features

Step Motor Controller. Application Note. AVR360: Step Motor Controller. Theory of Operation. Features. Introduction

ATF15xx Product Family Conversion. Application Note. ATF15xx Product Family Conversion. Introduction

2-wire Serial EEPROM AT24C1024. Advance Information

STK 500, AVRISP, AVRISP

Two-wire Serial EEPROM AT24C1024 (1)

8-bit Microcontroller. Application Note. AVR410: RC5 IR Remote Control Receiver

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

2-Wire Serial EEPROM AT24C32 AT24C64. 2-Wire, 32K Serial E 2 PROM. Features. Description. Pin Configurations. 32K (4096 x 8) 64K (8192 x 8)

Application Note. Atmel ATSHA204 Authentication Modes. Prerequisites. Overview. Introduction

AT91 ARM Thumb Microcontrollers. Application Note. GNU-Based Software Development on AT91SAM Microcontrollers. 1. Introduction. 2.

AT88CK490 Evaluation Kit

Application Note. 8-bit Microcontrollers. AVR307: Half Duplex UART Using the USI Module

AT15007: Differences between ATmega328/P and ATmega328PB. Introduction. Features. Atmel AVR 8-bit Microcontrollers APPLICATION NOTE

AT91SAM ARM-based Flash MCU. Application Note

USER GUIDE EDBG. Description

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

Application Note. 8-bit Microcontrollers. AVR293: USB Composite Device

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR064: A Temperature Monitoring System with LCD Output. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Secure Personalization with Transport Key Authentication. ATSHA204A, ATECC108A, and ATECC508A. Introduction.

AVR2004: LC-Balun for AT86RF230. Application Note. Features. 1 Introduction

Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers. 8-bit Atmel Microcontrollers. Application Note.

Transcription:

AVR097: Migration between ATmega128 and ATmega2561 Features General Porting Considerations Memory Clock sources Interrupts Power Management BOD WDT Timers/Counters USART & SPI ADC Analog Comparator ATmega103 Compatibility Operational Range 8-bit Microcontrollers Application Note Introduction This application note summarizes the differences between ATmega128 and ATmega2561. For detailed information on the devices, refer to the datasheets. ATmega128 and ATmega2561 are designed to be a pin and functionality compatible sub family. This application note points out the differences to be aware of when porting code between the devices. Rev.

General Porting Considerations Between the devices described in this application note, some register bits are in different locations within a register. But note that neither registers nor bits have different names. The only bits that are relocated into other registers are the XRAM register bits SRE and SRW10. To make the porting process as easy as possible, always refer to registers and bit positions using their defined names. Avoid using absolute addresses and values. In most cases, the register and bit names are unchanged from device to device. When you are porting a design, it is more convenient to include the correct definition file for the new device, rather than manually changing all your addresses and bit values. It is also considered good programming practice to use named references instead of absolute values. An example is shown below. PORTE = (1<<PORTE5); // Set pin 5 on port E high DDR &= ~(1<<PORTE5); // Set pin 5 on port E as input // Configure USI USICR = (1<<USISIE) (0<<USIOIE) (1<<USIWM1) (0<<USIWM0) (1<<USICS1) (0<<USICS0) (0<<USICLK) (0<<USITC); To avoid conflicts with added features and register functionality, never access registers that are marked as reserved. Reserved bits should always be written to zero if accessed. This ensures forward compatibility, and added features will stay in their default states when unused. Memory The sizes of the memories are the main difference between the ATmega128, ATmega2561. They are all summarized in Table 1. Table 1. Memory sizes FLASH [bytes] SRAM [bytes] EEPROM [bytes] ATmega128 128k 4k 4k ATmega2561 256k 8k 4k EEPROM The time to wait for a programming of an EEPROM page is different on ATmega128 compared to ATmega2561. Typical programming times are listed in Table 2. Note that ATmega2561 has an additional option for splitting the eeprom write into a separate erase and write operation. For more details on this feature refer to the datasheet or the application note: AVR103: Using the EEPROM Programming Modes. Table 2. Wait times when programming EEPROM ATmega128 ATmega2561 Typical programming time 8.5 ms 3.3 ms XRAM 2 AVR097 The register bits SRE (External SRAM/XMEM Enable) and SRW10 (Wait-state Select Bit) is located in MCUCR in ATmega128 and in XMCRA in ATmega2561.

AVR097 Clock sources ATmega128 has nearly all the same clock options, settings and timing as the ATmega2561. An exception is that ATmega2561 has an additional internal 128kHz RC Oscillator. All start-up delays on ATmega2561 have a constant of 14 clock cycles added to the standard value compared to Atmega128. The functionality of the Clock Select bits (CKSEL3..0, SUT1,0, CKOPT) themselves are not equal between the devices. Refer to the datasheet to find new matching settings for the clock select configuration. The ATmega2561 has a system clock prescaler that can/has to be altered runtime from the application code to achieve the desired system clock frequency. Interrupts ATmega2561 has 57 interrupts. ATmega128 has 35 interrupts. The additional interrupts in ATmega2561 reflects the additional features in the device. ATmega2561 can trigger on 9 pin change events with two different interrupt vectors. ATmega128 does not have this feature. Power Management ATmega2561 has a Power Reduction Register (PRR) that provides a method to stop the clock to individual peripherals. ATmega128 does not have this feature. BOD The Brown Out Detection (BOD) options are similar between the devices, except for that ATmega2561 has an additional level to support the extended operation range. The bit setting to select the BOD configuration varies, Table 3 and Table 4 show the settings for the two devices. Note that the voltage BOD levels are slightly higher on ATmega2561 then on ATmega128. Table 3. BOD fuse configuration on ATmega128 BODEN BODLEVEL Typical V BOT [V] 0 1 2.7 0 0 4.0 1 1 BOD disabled 1 0 BOD disabled Table 4. BOD fuse configuration on ATmega2561 BODLEVEL 2..0 Typical V BOT [V] 111 BOD disabled 110 1.8 101 2.7 100 4.3 3

WDT Timers/Counters USART & SPI ADC 4 AVR097 The ATmega2561 has the Enhanced Watchdog Timer (WDT) which is improved compared to the one in ATmega128. If the WDT is not used, it is still recommended to disable it initially in the application code to clear unintentional WDT enabled events. If the operation voltage is 5V and the WDTON fuse is left unprogrammed, the WDT will behave similar on both devices. The frequency of the Watchdog Oscillator in ATmega2561 is approximately 128 khz for all supply voltages. The typical frequency of the Watchdog Oscillator in ATmega128 is close to 1.0 MHz at 5V, but the time-out period increases with decreasing VCC. This means that the selection of Time-out period for the Watchdog Timer (in terms of number of WDT Oscillator cycles) must be reconsidered when porting the design. In ATmega128, the Watchdog Timer is either enabled or disabled, while ATmega2561 supports two safety levels selected by the WDTON Fuse. The ATmega2561 has a watchdog interrupt mode that is not supported in ATmega128. Refer to the ATmega2561 datasheet or the Application note "AVR132 - Enhanced Watchdog Timer" for more information. Timer/counter 1 and 3 are equal between the devices, except for the TIMSK registers. Here the register names and bits are differently organized. Refer to the datasheets to find the new configuration settings. Essentially the timers/counters 0 and 2 are only swapped between the devices. I.e. the features of timer 0 in ATmega128 can be found in timer 2 in ATmega2561, and vice versa. The pin mappings for these timers are also swapped. I.e. after porting the code to the other timer the pin features are still associated with the same pin as the other device. The control registers are differently organized between the devices. Please check the naming and positioning of all registers associated with timer/counter 0 and 2 when porting code, and find the new settings according to the datasheets. ATmega2561 has two Output Compare units on both timer/counter 0 and 2, while ATmega128 has one on each. The USART s are equal between the devices, except for that the ATmega2561 has an additional SPI master mode within the USART that is not available in ATmega128. For additional SPI interface support one can use a software implementation as described in AVR320: Software SPI Master. Both devices have an option to use an internal 2.56V voltage reference. In addition the Atmega2561 also has an option for 1.1V internal voltage reference. Both devices have an option to run the ADC in a Free Running Mode. But due to that Atmega2561 also has an option to use many other auto trigger sources; the name of the feature enable bit in the control register is different. On Atmega128 it is ADFR (ADC Free Running Select), and on Atmega2561 it is ADATE (ADC Auto Trigger Enable). The default setting of the ADATE is Free Running Mode. The internal bandgap reference used in Atmega128 is typical 1.23V, and in Atmega2561 it is 1.1V.

AVR097 Analog Comparator The ACME (Analog Comparator Multiplexer Enable) bit is located in different register bytes in the two devices. In Atmega128 it is located in SFIOR, and in Atmega2561 it is located in ADCSRB. The internal bandgap reference used in Atmega128 is typical 1.23V, and in Atmega2561 it is 1.1V. ATmega103 Compatibility ATmega128 has a special option for compatibility to ATmega103. ATmega2561 does not have this option. Operational Range Table 5. Operating voltage and Speed grades. Operating Voltage Speed Grade ATmega128 4.5-5.5V 0-16 MHz ATmega128L 2.7-5.5V 0-8 MHz ATmega2561 2.7-5.5V 0-8 MHz @ 2.7-5.5V 0-16MHz @ 4.5-5.5V ATmega2561V 1.8-5.5V 0-4 MHz @ 1.8-5.5V 0-8 MHz @ 2.7-5.5V 5

Disclaimer Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Regional Headquarters Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Atmel Operations Memory 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 Microcontrollers 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60 ASIC/ASSP/Smart Cards Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743 RF/Automotive Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80 Literature Requests www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON- INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Atmel s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. Atmel Corporation 2004. All rights reserved. Atmel, logo and combinations thereof, AVR, and AVR Studio are registered trademarks, and Everywhere You Are are the trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others.