
150
ATtiny40 [DATASHEET]
8263B–AVR–01/2013
19.4.3.4
Erasing the Configuration Section
The algorithm for erasing the Configuration section is as follows:
1.
Write the SECTION_ERASE command to the NVMCMD register
2.
Start the erase operation by writing a dummy byte to the high byte of any word location inside the configu-
ration section
3.
Wait until the NVMBSY bit has been cleared
19.4.3.5
Writing a Configuration Word
The algorithm for writing a Configuration word is as follows.
1.
Write the CODE_WRITE command to the NVMCMD register
2.
Write the low byte of the data word to the low byte of the configuration word location
3.
Write the high byte of the data word to the high byte of the same configuration word location
4.
5.
Write a dummy byte to the low byte of the next configuration word location
6.
Write a dummy byte to the high byte of the same configuration word location.
7.
8.
Write a dummy byte to the low byte of the next configuration word location
9.
Write a dummy byte to the high byte of the same configuration word location.
11. Write a dummy byte to the low byte of the next configuration word location
12. Write a dummy byte to the high byte of the same configuration word location. This will start the Flash write
operation
13. Wait until the NVMBSY bit has been cleared
19.4.4
Reading NVM Lock Bits
The Non-Volatile Memory Lock Byte can be read from the mapped location in data memory.
19.4.5
Writing NVM Lock Bits
The algorithm for writing the Lock bits is as follows.
1.
Write the CODE_WRITE command to the NVMCMD register.
2.
Write the lock bits value to the Non-Volatile Memory Lock Byte location. This is the low byte of the Non-
Volatile Memory Lock Word.
3.
Start the NVM Lock Bit write operation by writing a dummy byte to the high byte of the NVM Lock Word
location.
4.
Wait until the NVMBSY bit has been cleared.
19.5
Self programming
The ATtiny40 doesn't support internal programming.
19.6
External Programming
The method for programming the Non-Volatile Memories by means of an external programmer is referred to as
external programming. External programming can be done both in-system or in mass production.