AVR529: Migrating from ATmega165P/169P to ATmega165PA/169PA 8-bit Microcontrollers 1 Introduction In order to optimize the manufacturing process and to further reduce current consumption, an optimized version of ATmega165P/169P has been introduced. Application Note Preliminary The ATmega165PA/169PA is a functionally identical, drop-in replacement for the ATmega165P/169P. All devices are subject to the same qualification process and same set of production tests. ATmega165P/169P and ATmega165PA/169PA have separate datasheets. This application note outlines the differences between the two devices and the datasheets. There is also a detailed change log to assist the user at the end of the ATmega165PA/169PA datasheet. Remember to always use the latest revision of the device datasheet. Minor differences in typical characteristics are not discussed in this document as long as the low and high limits remain the same. For detailed information about the typical characteristics, see sections “Electrical Characteristics” and “Typical Characteristics” of the device datasheets. Note: This application note serves as a guide to ease migration. For complete device details, always refer to the most recent version of the ATmega165PA/169PA datasheet. Rev. 8190B-AVR-04/10 2 Changes in Characteristics This section outlines major differences in characteristics that may have an effect on the application in which the device is used. For detailed information, refer to the most recent version of the device datasheets. 2.1 Current Consumption Active and Idle mode current consumption of the device has been reduced significantly. The tables below present typical current consumption figures at room temperature. All values are taken from device datasheets, unless otherwise noted. Table 2-1. Typical Current Consumption of Device at Room Temperature Mode Active Idle Condition ATmega165P ATmega165PA Change VCC=2V, f=1 MHz 0.35 mA 0.25 mA - 29% VCC=3V , f=4 MHz 2.3 mA 1.45 mA - 37% VCC=5V , f=8 MHz 8.4 mA 4.95 mA - 41% VCC=2V, f=1 MHz 0.1 mA 0.055 mA - 45% VCC=3V , f=4 MHz 0.7 mA 0.36 mA - 49% VCC=5V , f=8 MHz 3.0 mA 1.6 mA - 47% Table 2-2. Typical Current Consumption of Device at Room Temperature Mode Active Idle Condition ATmega169P ATmega169PA Change VCC=2V, f=1 MHz 0.35 mA 0.25 mA - 29% VCC=3V , f=4 MHz 2.3 mA 1.45 mA - 37% VCC=5V , f=8 MHz 8.4 mA 4.95 mA - 41% VCC=2V, f=1 MHz 0.1 mA 0.055 mA - 45% VCC=3V , f=4 MHz 0.7 mA 0.36 mA - 49% VCC=5V , f=8 MHz 3.0 mA 1.6 mA - 47% 2.2 System and Reset Characteristics The table below shows the changes in characteristics of the power-on reset threshold between ATmega165P/ATmega169P and ATmega165PA/ATmega169PA. Table2-3. Changes in characteristics of Power-On Reset Threshold Device Symbol ATmega165P/ ATmega169P VPOT ATmega165PA/ ATmega169PA 2 VPOT Min. Typ. Max. Units POR Threshold voltage (rising) Parameter 0.7 1.0 1.4 V POR Threshold voltage (falling) 0.05 0.9 1.3 V POR Threshold voltage (rising) 1.1 1.4 1.6 V POR Threshold voltage (falling) 0.6 1.3 1.6 V AVR529 8190B-AVR-04/10 AVR529 3 Bits and Registers Some of the register bits have been changed and some register bits have been added. 3.1 Moved Register bits In ATmega165PA/169PA, some register bits are in different locations within a register than with ATmega165P/169P, but neither the registers nor the bits have different names, nor are any bits relocated into other registers. The register bits that have been moved are listed in Table 3-1 Name Device ATmega165PA EIMSK ATmega169PA ATmega165P ATmega169P ATmega165PA EIFR ATmega169PA ATmega165P ATmega169P Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 --- --- PCIE1 PCIE0 --- --- --- INT0 PCIE1 PCIE0 --- --- --- --- --- INT0 --- --- PCIF1 PCIF0 --- --- --- INTF0 PCIF1 PCIF0 --- --- --- --- --- INTF0 To make code can work for both ATmega165P/169P and ATmega165PA/169PA, it is recommended to use bit mask for writing and reading these bits. Some examples are shown below. #define PCIE1_bm ((1<<7)|(1<<5)) #define PCIE0_bm ((1<<6)|(1<<4)) #define PCIF1_bm ((1<<7)|(1<<5)) #define PCIF0_bm ((1<<6)|(1<<4)) EIMSK |= PCIE0_bm; //Set PCIE0 in EIMSK EIMSK &= ~PCIE0_bm; //Clear PCIE0 in EIMSK temp = EIFR & PCIF1_bm; //Read PCIF1 EIFR = PCIF1_bm | PCIF0_bm; //Clear PCIF1 and PCIF0 3 8190B-AVR-04/10 3.2 New Register Bits Table 3-2 lists registers and bits that have been added to the device as a result of functional enhancements. In ATmega165P and ATmega169P these bit were reserved. Table3-2. New register bits in ATmega165PA/169PA Addr. Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 0x35 MCUCR - BODS BODSE - - - - - 4 Datasheet Changes For a summary of changes, see the datasheet revision history at the end of the ATmega165PA/169PA datasheet. 4 AVR529 8190B-AVR-04/10 Disclaimer Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Atmel Asia Unit 1-5 & 16, 19/F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon Hong Kong Tel: (852) 2245-6100 Fax: (852) 2722-1369 Atmel Europe Le Krebs 8, Rue Jean-Pierre Timbaud BP 309 78054 Saint-Quentin-enYvelines Cedex France Tel: (33) 1-30-60-70-00 Fax: (33) 1-30-60-71-11 Atmel 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 Technical Support [email protected] Sales Contact www.atmel.com/contacts Product Contact Web Site www.atmel.com Literature Request 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. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. ® ® ® © 2010 Atmel Corporation. All rights reserved. Atmel , Atmel logo and combinations thereof, AVR , AVR logo and others, are the registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. 8190B-AVR-04/10