Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ATtiny104_Datasheet.pdf
Скачиваний:
0
Добавлен:
12.02.2026
Размер:
3.8 Mб
Скачать

2.Write the Flash section word by word

20.4.3.1.Chip Erase

The Chip Erase command will erase the entire code section of the Flash memory and the NVM Lock Bits. For security reasons, the NVM Lock Bits are not reset before the code section has been completely erased. Configuration, Signature and Calibration sections are not changed.

Before starting the Chip erase, the NVMCMD register must be loaded with the CHIP_ERASE command. To start the erase operation a dummy byte must be written into the high byte of a word location that resides inside the Flash code section. The NVMBSY bit remains set until erasing has been completed. While the Flash is being erased neither Flash buffer loading nor Flash reading can be performed.

The Chip Erase can be carried out as follows:

1.Write the 0x10 (CHIP_ERASE) to the NVMCMD register

2.Start the erase operation by writing a dummy byte to the high byte of any word location inside the code section

3.Wait until the NVMBSY bit has been cleared

20.4.3.2.Erasing the Code Section

The algorithm for erasing all pages of the Flash code section is as follows:

1.Write the 0x14 (SECTION_ERASE) to the NVMCMD register

2.Start the erase operation by writing a dummy byte to the high byte of any word location inside the code section

3.Wait until the NVMBSY bit has been cleared

20.4.3.3.Writing a Code Word

The algorithm for writing a word to the code section is as follows:

1.Write the 0x1D (WORD_WRITE) to the NVMCMD register

2.Write the low byte of the data into the low byte of a word location

3.Write the high byte of the data into the high byte of the same word location. This will start the Flash write operation

4.Wait until the NVMBSY bit has been cleared

20.4.3.4.Erasing the Configuration Section

The algorithm for erasing the Configuration section is as follows:

1.Write the 0x14 (SECTION_ERASE) to the NVMCMD register

2.Start the erase operation by writing a dummy byte to the high byte of any word location inside the configuration section

3.Wait until the NVMBSY bit has been cleared

20.4.3.5.Writing a Configuration Word

The algorithm for writing a Configuration word is as follows:

1.Write the 0x1D (WORD_WRITE) to the NVMCMD register

2.Write the low byte of the data to the low byte of a configuration word location

3.Write the high byte of the data to the high byte of the same configuration word location. This will start the Flash write operation.

4.Wait until the NVMBSY bit has been cleared

20.4.4.Reading NVM Lock Bits

The Non-Volatile Memory Lock Byte can be read from the mapped location in data memory.

Atmel ATtiny102 / ATtiny104 [DATASHEET] 193

Atmel-42505D-ATtiny102-ATtiny104_Datasheet_Complete-10/2016