Microchip Technology megaAVR 0 Series Manual page 65

Hide thumbs Also See for megaAVR 0 Series:
Table of Contents

Advertisement

written. The resulting data will be a binary and operation between the new and the previous content of the
page buffer. The page buffer will automatically be erased (all bits set) after:
A device Reset
Any page write or erase operation
A Clear Page Buffer command
The device wakes up from any sleep mode
8.3.2.3
Programming
For page programming, filling the page buffer and writing the page buffer into Flash, User Row, and
EEPROM are two separate operations.
Before programming a Flash page with the data in the page buffer, the Flash page must be erased. The
page buffer is also erased when the device enters a sleep mode. Programming an unerased Flash page
will corrupt its content.
The Flash can either be written with the erase and write separately, or one command handling both:
Alternative 1:
Fill the page buffer
Write the page buffer to Flash with the Erase/Write Page command
Alternative 2:
Write to a location in the page to set up the address
Perform an Erase Page command
Fill the page buffer
Perform a Write Page command
The NVM command set supports both a single erase and write operation, and split Page Erase and Page
Write commands. This split commands enable shorter programming time for each command, and the
erase operations can be done during non-time-critical programming execution.
The EEPROM programming is similar, but only the bytes updated in the page buffer will be written or
erased in the EEPROM.
8.3.2.4
Commands
Reading of the Flash/EEPROM and writing of the page buffer is handled with normal load/store
instructions. Other operations, such as writing and erasing the memory arrays, are handled by commands
in the NVM.
To execute a command in the NVM:
1.
Confirm that any previous operation is completed by reading the Busy Flags (EEBUSY and
FBUSY) in the NVMCTRL.STATUS register.
2.
Write the NVM command unlock to the Configuration Change Protection register in the CPU
(CPU.CCP).
3.
Write the desired command value to the CMD bits in the Control A register (NVMCTRL.CTRLA)
within the next four instructions.
Write Command
The Write command of the Flash controller writes the content of the page buffer to the Flash or EEPROM.
If the write is to the Flash, the CPU will stop executing code as long as the Flash is busy with the write
operation. If the write is to the EEPROM, the CPU can continue executing code while the operation is
ongoing.
©
2018 Microchip Technology Inc.
Nonvolatile Memory Controller (NVMCTRL)
Datasheet Preliminary
®
megaAVR
0-Series
DS40002015A-page 65

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the megaAVR 0 Series and is the answer not in the manual?

This manual is also suitable for:

Atmega4808Atmega4809Atmega3208Atmega3209

Table of Contents