16.9 Error Correcting Code (ECC) and Flash Programming
The PIC32CX-BZ6 devices incorporate Error Correcting Code (ECC) features that detect and correct errors resulting in extended Flash memory life. For more details on this feature, see Prefetch Cache from Related Links.
ECC is implemented in 256-bit Quad Flash Words or 64-bit DWORD. As a result, when programming Flash memory on a device with ECC, the programming operation must be, at minimum, four instruction Words or in groups of four instruction Words. This is the reason that the Quad Double Word programming command exists and why row programming always programs multiples of four Words.
For a given software application, ECC can be enabled at all times, disabled at all times or dynamically enabled using the ECCCTL Configuration bits in the CFGCON0 register. When ECC is enabled at all times, the DWORD NVMOP programming command does not function and the Quad Double Word is the smallest unit of memory that can be programmed. If disabling or enabling the ECC dynamically, both the DWORD and Quad Double Word programming NVMOP commands are functional and the programming method used determines how ECC is handled.
If dynamic ECC and if the memory was programmed with the DWORD command, ECC is turned-off for that Word, and, when it is read, no error correction is performed. If the memory was programmed with the Quad Double Word or row programming commands, ECC data is written and tested for errors (and corrected if needed) when read. The following table describes the different ECC scenarios.
ECCCTL Setting | Programming Operation | Data Read | ||
---|---|---|---|---|
DWord | Quad Double Word | Row Write | ||
Disabled | Allowed | Allowed | Allowed | ECC is never applied on a Flash read |
Enabled | Not allowed | Allowed | Allowed | ECC is applied on every Flash Word read |
Dynamic | Allowed but when used, the programmed Word is flagged to NOT USE ECC | Writes ECC data and flags programmed Words to USE ECC | Writes ECC data and flags programmed Words to USE ECC | ECC is only applied on Words that are flagged to USE ECC |
Note: When using dynamic ECC, the user must program
all the non-ECC locations with the 64-bit Word programming command
and program all the ECC-enabled locations with a 256-bit Double Quad
Double Word or row programming command. Divisions between ECC and
non-ECC memory must be on even Quad Word boundaries (address bits 0
through 3 are equal to ‘ 0 ’). |