15 NVM - Nonvolatile Memory Control
The Nonvolatile Memory (NVM) module provides run-time read and write access to the Program Flash Memory (PFM), Data Flash Memory (DFM), and Configuration bits. PFM includes the program memory and user ID space. DFM is also referred to as EEPROM which is accessed one byte at a time and the erase before write is automatic.
NVM is accessible using both FSR and INDF registers or through the NVMREG register interface (see Table 15-1).
The write time is controlled by an on-chip timer. The write/erase voltages are generated by an on-chip charge pump rated to operate over the operating voltage range of the device.
PFM and DFM can be protected in two ways: code protection and write protection. Code protection (Configuration bits CP (PFM)/CPD (DFM)) disables PFM/DFM read and write access through an external device programmer. Write protection prevents user software writes to NVM areas tagged for protection by the WRTn Configuration bits. Code protection does not affect the self-write and erase functionality, whereas write protection does. Attempts to write a protected location will set the WRERR bit. Code protection and write protection can only be reset on a Bulk Erase performed by an external programmer.
The Bulk Erase command is used to completely erase program memory. The Bulk Erase command can only be issued through an external programmer. There is no run time access for this command.
If the device is code-protected and a Bulk Erase command for the configuration memory is issued; all other memory regions are also erased. Refer to the “Family Programming Specification” document for more details.
Main Values | NVMREG Access | FSR Access | |||||
---|---|---|---|---|---|---|---|
Memory Function | Memory Type | Program Counter (PC), ICSP™ Address | NVMREGS bit (NVMCON1) | NVMADR[14:0] | Allowed Operations | FSR Address | FSR Programming Access |
Reset Vector | Program Flash Memory | 0x0000 | 0 |
0x0000 | Read/Write | 0x8000 | Read-Only |
User Memory | 0x0001 | 0 |
0x0001 | 0x8001 | |||
0x0003 | 0x0003 | 0x8003 | |||||
INT Vector | 0x0004 | 0 |
0x0004 | 0x8004 | |||
User Memory | 0x0005 | 0 |
0x0005 | 0x8005 | |||
0x3FFF(1) | 0x3FFF(1) | 0xFFFF | |||||
User ID | Program Flash Memory | 0x8000 | 1 |
0x0000 | Read/Write | No Access | |
0x8003 | 0x0003 | ||||||
Reserved | — | — | — | 0x0004 | — | ||
Revision ID | Hard Coded in Program Flash Memory | 0x8005 | 1 |
0x0005 | Read | ||
Device ID | 0x8006 | 1 |
0x0006 | ||||
CONFIG1 | Program Flash Memory | 0x8007 | 1 |
0x0007 | Read/Write | ||
CONFIG2 | 0x8008 | 1 |
0x0008 | ||||
CONFIG3 | 0x8009 | 1 |
0x0009 | ||||
CONFIG4 | 0x800A | 1 |
0x000A | ||||
CONFIG5 | 0x800B | 1 |
0x000B | ||||
DIA and DCI | Hard Coded in Program Flash Memory | 0x8100 | 1 |
0x0100 | Read | ||
0x82FF | 1 |
0x02FF | |||||
EEPROM | Data Flash Memory | 0xF000 | 1 |
0x7000 | Read/Write | 0x7000 | Read |
0xF0FF | 0x70FF | 0x70FF |
- The maximum Program Flash Memory address for the PIC16F171 family is 0x3FFF.