AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly

Similar documents
AT60142H/HT. Rad-Hard 512Kx8 Very Low Power CMOS SRAM ERRATA-SHEET. Active Errata List. Errata History. Abbreviations. 1.

AT03975: Getting Started with SAM L21. Descripton. Features. SMART ARM-Based Microcontroller APPLICATION NOTE

AT09381: SAM D - Debugging Watchdog Timer Reset. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

APPLICATION NOTE. Generating Random Secrets. ATSHA204A, ATECC108A, and ATECC508A. Description. Topics

APPLICATION NOTE. 3-lead CONTACT Package Usage. ATSHA204A, ATECC108A, and ATECC508A. Introduction. 3-lead CONTACT Package

AT21CS Series Reset and Discovery. Introduction. Serial EEPROM APPLICATION NOTE

APPLICATION NOTE. AT6486: Using DIVAS on SAMC Microcontroller. SMART ARM-Based Microcontroller. Introduction. Features

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

ATAES132A Firmware Development Library. Introduction. Features. Atmel CryptoAuthentication USER GUIDE

APPLICATION NOTE. AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I. Atmel AVR XMEGA. Introduction. Features

AT06467: Getting started with SAM D09/D10/D11. Features. Description. SMART ARM-based Microcontrollers APPLICATION NOTE

AT03262: SAM D/R/L/C System Pin Multiplexer (SYSTEM PINMUX) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Smart RF Device Family - Getting Started Guide. Features. Description. References ATAN0115 APPLICATION NOTE

APPLICATION NOTE. Atmel AT03160: Migrating Bootloader from ATxmega128A1 to other Atmel XMEGA Devices. Atmel AVR XMEGA. Features.

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE

AT11512: SAM L Brown Out Detector (BOD) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

ATtiny817 QTouch Moisture Demo User Guide. Description. Features. AVR 8-bit Microcontrollers USER GUIDE

Ethernet1 Xplained Pro

ATECC508A Public Key Validation. Introduction. Atmel CryptoAuthentication APPLICATION NOTE

APPLICATION NOTE. AT04470: Differences between SAM D21 Variants A, B, and L. 32-bit Microcontroller. Introduction

ATECC108/ATSHA204 USER GUIDE. Atmel Firmware Library. Features. Introduction

EDBG. Description. Programmers and Debuggers USER GUIDE

Native route discovery algorithm

This user guide describes how to run the Atmel ATWINC3400 Bluetooth Low Energy (BLE) Provisioning demo from out-of-box conditions.

AT10942: SAM Configurable Custom Logic (CCL) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

QT3 Xplained Pro. Preface. Atmel QTouch USER GUIDE

AVR1315: Accessing the XMEGA EEPROM. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

USER GUIDE. Atmel QT6 Xplained Pro. Preface

APPLICATION NOTE. CryptoAuthentication Personalization Guide. ATSHA204A and ATECC508A. Introduction. Features

ATtiny104 Xplained Nano. Preface. AVR 8-bit Microcontrollers USER GUIDE

APPLICATION NOTE. AT03324: Atmel REB212BSMA-EK Quick Start Guide. Atmel MCU Wireless. Introduction

DGILib USER GUIDE Atmel-42771A-DGILib_User Guide-09/2016

SAMA5D2 Quad SPI (QSPI) Performance. Introduction. SMART ARM-based Microprocessor APPLICATION NOTE

AT88CK101 HARDWARE USER GUIDE. Atmel CryptoAuthentication Development Kit. Atmel CryptoAuthentication AT88CK101 Daughterboard

APPLICATION NOTE. AT05567: TC Capture on External Interrupt with the Event System on SAM D20. Preface ASF PROJECT DOCUMENTATION

QT2 Xplained Pro. Preface. Atmel QTouch USER GUIDE

APPLICATION NOTE. Atmel QT4 Xplained Pro User Guide ATAN0114. Preface

APPLICATION NOTE. Atmel AT03304: SAM D20 I 2 C Slave Bootloader SAM D20. Description. Features

Atmel QT600 Quick Start Guide Touch Solutions

USER GUIDE. ATWINC1500 Xplained Pro. Preface

Atmel AVR32847: Migration from/to the UC3L0 64/32/16 from/to the UC3L0 256/ bit Atmel Microcontrollers. Application Note.

APPLICATION NOTE. How to Securely Switch Atmel s LIN Transceiver ATA6662/ATA6662C to Sleep Mode ATA6662/ATA6662C. Concerning Atmel ATA6662

APPLICATION NOTE. Atmel AVR1638: XMEGA RTC Calibration. 8-bit Atmel Microcontrollers. Features. Introduction

APPLICATION NOTE. Scope. Reference Documents. Software Ethernet Bridge on SAMA5D3/D4. Atmel SMART SAMA5D3/D4 Series

Atmel AVR1619: XMEGA-B1 Xplained Demonstration. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

RELEASE NOTES. GNU Toolchain for Atmel ARM Embedded Processors. Introduction

Hardware Prerequisites Atmel Xplained Pro Evaluation Kit Atmel WINC1500 extension USB Micro Cable (TypeA / MicroB)

USER GUIDE. Atmel Segment LCD1 Xplained Pro. Preface

AVR32752: Using the AVR32 UC3 Static Memory Controller. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AT03261: SAM D20 System Interrupt Driver (SYSTEM INTERRUPT) SAM D20 System Interrupt Driver (SYSTEM INTERRUPT)

a clock signal and a bi-directional data signal (SCL, SDA)

SAM4 Reset Controller (RSTC)

AVR1503: Xplain training - XMEGA Programmable Multi Interrupt Controller 8-bit Microcontrollers Application Note Prerequisites

AVR1303: Use and configuration of IR communication module. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

I/O1 Xplained Pro. Preface. Atmel MCUs USER GUIDE

OLED display with pixels resolution Ambient light sensor CPU load Analog filter Quadrature Encoder with push button Digital I/O

USER GUIDE EDBG. Description

USER GUIDE. ZigBit USB Stick User Guide. Introduction

USER GUIDE. Atmel QT1 Xplained Pro. Preface

APPLICATION NOTE. Atmel AVR536: Migration from ATmega644 to ATmega644A. 8-bit Atmel Microcontrollers. Introduction

APPLICATION NOTE. Atmel AT02260: Driving AT42QT1085. Atmel QTouch. Features. Description

APPLICATION NOTE. Atmel AVR057: Internal RC Oscillator Calibration for ATtiny4/5/9/10/20/40. 8-bit Atmel Microcontrollers. Features.

AVR1518: XMEGA-A1 Xplained Training - XMEGA Clock System. 8-bit Atmel Microcontrollers. Application Note. Prerequisites.

64K (8K x 8) Battery-Voltage Parallel EEPROM with Page Write and Software Data Protection AT28BV64B

AT88RF04C. CryptoRF EEPROM Memory 13.56MHz, 4 Kilobits SUMMARY DATASHEET. Features

Atmel ATtiny1634 MCU Atmel ATA SBC LIN transceiver with integrated voltage regulator Touch. Three Atmel QTouch buttons One Atmel QTouch slider

Application Note Using the ATV750, ATV750B, and ATF750C Erasable Programmable Logic Device Introduction 1.1 Device Names and Pin/Node Assignments

Atmel LF-RFID Kit Comparison Chart. Application Note. Atmel LF-RFID Kit Comparison Chart. 1. Description

APPLICATION NOTE. Atmel AT01080: XMEGA E Schematic Checklist. Atmel AVR XMEGA E. Features. Introduction

USER GUIDE. Atmel OLED1 Xplained Pro. Preface

AT88SC3216CRF. CryptoRF EEPROM Memory 13.56MHz, 32 Kilobits SUMMARY DATASHEET. Features

APPLICATION NOTE. Atmel AVR3009: Driving QTouch Device with I 2 C Interface. Atmel QTouch. Introduction

MySonicWall Secure Upgrade Plus

USER GUIDE. Atmel maxtouch Xplained Pro. Preface

SMART ARM-based Microcontrollers ATSAMD21E16LMOTOR USER GUIDE

AVR097: Migration between ATmega128 and ATmega1281/ATmega bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. AT07216: SAM G55 Schematic Checklist. Atmel SMART SAM G55. Introduction

AT07942: SAM4L Asynchronous Timer (AST) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

AVR4018: Inertial Two (ATAVRSBIN2) Hardware User's Guide. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

USER GUIDE. Wireless Production Test Reference Protocol Specification Document. Atmel MCU Wireless. Description

Atmel and the use of Verilator to create uc Device Models

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

AVR32401: AVR32 AP7 Linux Interfacing DataFlash. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

STK521. User Guide B AVR 01/12

Atmel AT697F. Rad-Hard 32-bit SPARC v8 Processor ERRATA SHEET. Active Errata List

APPLICATION NOTE. Atmel AVR116: Wear Leveling on DataFlash. 32-bit Atmel Microcontrollers. Features. Description. Wear leveling

AT697E. Application Note. Checking AT697E Code for Occurrence of LDF/FPOPd Instructions Sequence with a dependency on an Odd-Numbered Register

USER GUIDE. ATmega168 Xplained Mini User Guide. Introduction

AVR1501: Xplain training XMEGA Timer/Counter 8-bit Microcontrollers Application Note Prerequisites 1 Introduction

AVR32901: EVKLCD100/EVKLCD101 Hardware User's Guide. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

32Kbytes on-chip SRAM. Viterbi decoding and CRC PRIME compliant 128-bit AES encryption Channel sensing and collision pre-detection

AVR532: Migration from ATmega48/88/168 to ATmega48A/88A/168A. 8-bit Microcontrollers. Application Note. 1 Introduction

ATECC108. Atmel CryptoAuthentication SUMMARY DATASHEET. Features. Applications NOT RECOMMENDED FOR NEW DESIGNS. Replaced by ATECC108A

AVR based 125kHz RFID Evaluation Kit (Re)Programming Guide ATA2270-EK1. Overview. Fuse Settings: ISP Programming

Atmel AVR ATxmega384C3 microcontroller OLED display with 128x32 pixels resolution Analog sensors. Ambient light sensor Temperature sensor

Atmel AVR1926: XMEGA-B1 Xplained Getting Started Guide. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

USER GUIDE. Atmel PROTO1 Xplained Pro. Preface

SonicWall Mobile Connect for Chrome OS

AVR32917: picopower Board getting started. 32-bit Microcontrollers. Application Note. Preliminary. Features. 1 Introduction

AT91 ARM Thumb Microcontrollers. Application Note. Using the ECC Controller on AT91SAM9260/9263 and AT91SAM7SE Microcontrollers. 1.

Transcription:

AVR 8-bit Microcontrollers AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly APPLICATION NOTE

Table of Contents 1. What has Changed...3 1.1. What This Means and How to Adapt...4 2. Revision History...5 2

1. What has Changed On the new family of Atmel tinyavr devices (ATtiny417, ATtiny814, ATtiny816, and ATtiny817) the flash has been included into the CPU data space. This means that it shares the same address space and instructions as SRAM, EEPROM, and I/O registers. This data space is accessible through the use of LD/ST instructions in assembly. Previously, on some of the older Tiny devices flash has been accessible only through the LPM and SPM instructions. In the new tinyavr devices the LPM instruction still exists, but not the SPM instruction. For the LPM instruction, address 0x0000 is the start of flash, as can be seen in the Memory map figure for LD and ST it is 0x8000. Figure 1-1. Memory Map of New Devices 0x0000 CPU Code space UPDI/CPU Data space 64 I/O Registers 960 Ext I/O Registers 0x0000 0x003F 0x0040 0x0FFF NVM I/O Registers and data 0x1000 0x13FF EEPROM128B 0x1400-0x1480 (Reserved) 0x3F00 (for SRAM 256B)/ 0x3E00 (for SRAM 512B) Flash code 4/8KB Internal SRAM 256/512B 0x3FFF (Reserved) 0x8000 Flash code 4/8KB 0x8FFF (for Flash 4K)/ 0x9FFF (for Flash 8K) 3

In addition to this, writing to flash now has to happen by using the NVM controller where previously this has been done through a combination of the Z-pointer and the SPMCTRL register. 1.1. What This Means and How to Adapt If existing assembly code that writes to flash is to be ported from older to new tinyavr devices, the SPM instructions have to be replaced by ST instructions. The ST instruction will not be able to access flash directly, but instead data will be written to the page buffer. This is similar to how it has been done previously, but now handling page erase and page commits are handled by the NVM controller. Where you would previously store the address to a page in flash in the Z-pointer, this is now handled by an address register in the NVM controller. Note that the address register in the NVM controller is updated automatically when data is written using the ST instruction. Make certain not to write data to a new page before committing the page buffer. If this is done, the data intended to be written to the new page will be with the data already in the page buffer with a bit-wise AND. The same will happen if data is written to the same address twice without committing the page buffer. Along with the addresses, the commands to erase a page or write the page buffer is now also located in the NVM controller. The commands should now be written to the Control A register in the NVM controller. See the Control A register in the datasheet for a list of the available commands. These changes will make it necessary to change code written in C or assembly for older tinyavrs for it to work on the new tinyavr family (ATtiny417, ATtiny814, ATtiny816, and ATtiny817). 4

2. Revision History Doc. Rev. Date Comments 42779A 11/2016 Initial document release 5

Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 www.atmel.com 2016 Atmel Corporation. / Rev.: Atmel, Atmel logo and combinations thereof, Enabling Unlimited Possibilities, AVR, tinyavr, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and other countries. Other terms and product names may be trademarks of others. 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 THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, 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 AND 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 products 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 products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death ( Safety-Critical Applications ) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.