Microchip Technology megaAVR 0 Series Manual page 66

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

Advertisement

The page buffer will be automatically cleared after the operation is finished.
Erase Command
The Erase command erases the current page. There must be one byte written in the page buffer for the
Erase command to take effect.
For erasing the Flash, first, write to one address in the desired page, then execute the command. The
whole page in the Flash will then be erased. The CPU will be halted while the erase is ongoing.
For the EEPROM, only the bytes written in the page buffer will be erased when the command is
executed. To erase a specific byte, write to its corresponding address before executing the command. To
erase a whole page all the bytes in the page buffer have to be updated before executing the command.
The CPU can continue running code while the operation is ongoing.
The page buffer will automatically be cleared after the operation is finished.
Erase-Write Operation
The Erase/Write command is a combination of the Erase and Write command, but without clearing the
page buffer after the Erase command: The erase/write operation first erases the selected page, then it
writes the content of the page buffer to the same page.
When executed on the Flash, the CPU will be halted when the operations are ongoing. When executed
on EEPROM, the CPU can continue executing code.
The page buffer will automatically be cleared after the operation is finished.
Page Buffer Clear Command
The Page Buffer Clear command clears the page buffer. The contents of the page buffer will be all 1's
after the operation. The CPU will be halted when the operation executes (seven CPU cycles).
Chip Erase Command
The Chip Erase command erases the Flash and the EEPROM. The EEPROM is unaltered if the
EEPROM Save During Chip Erase (EESAVE) fuse in FUSE.SYSCFG0 is set. The Flash will not be
protected by Boot Section Lock (BOOTLOCK) or Application Code Section Write Protection (APCWP) in
NVMCTRL.CTRLB. The memory will be all 1's after the operation.
EEPROM Erase Command
The EEPROM Erase command erases the EEPROM. The EEPROM will be all 1's after the operation.
The CPU will be halted while the EEPROM is being erased.
Fuse Write Command
The Fuse Write command writes the fuses. It can only be used by the UPDI, the CPU cannot start this
command.
Follow this procedure to use this command:
Write the address of the fuse to the Address register (NVMCTRL.ADDR)
Write the data to be written to the fuse to the Data register (NVMCTRL.DATA)
Execute the Fuse Write command.
After the fuse is written, a Reset is required for the updated value to take effect.
For reading fuses, use a regular read on the memory location.
8.3.3
Preventing Flash/EEPROM Corruption
During periods of low V
too low for the CPU and the Flash/EEPROM to operate properly. These issues are the same as for board
level systems using Flash/EEPROM, and the same design solutions should be applied.
©
2018 Microchip Technology Inc.
, the Flash program or EEPROM data can be corrupted if the supply voltage is
DD
Datasheet Preliminary
megaAVR
Nonvolatile Memory Controller (NVMCTRL)
®
0-Series
DS40002015A-page 66

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