31.2.4 Flash Architecture

Each Flash partition is built up of several pages, also called sectors. The controller works with panels made from 4KB pages with each page containing 4 rows of Flash data. A row is the largest selectable region for contiguous programming of Write Words. A Row contains 128 Write Words.

A page of Flash is the smallest unit of memory that can be erased in a single operation. A panel’s Program Flash Memory (PFM) space can also be erased in a single operation. All other erases use multiple operations.

A Write Word is the only unit of memory that can be programmed at a time. All other programming operations are made up of several contiguous Write Word Program operations. The FCW supports:

  • Row Write: Write Word by Write Word programming until the whole Row is written. Data is read by the FCW from System SRAM.
  • Quad Write: The FCW performs 4 writes of data from holding registers
  • Single Write: The FCW performs one write of data from holding register(s)

Program Flash Memory (PFM)

PFM is the largest section of Flash memory. It is where the main application code resides. When a series of parts have the same feature but different Flash size, the PFM is the only partition that changes size.

Each panel contains PFM. The natural order is for Panel 1 PFM to exist in the lower address range and Panel 2 PFM to exist in the upper address range. The order in which each PFM exist in the Flash memory space can be controlled by software. The PFM address range is contiguous across both panels.

Dual panel systems support Live Update which allows reading from one panel while write to the other. It does not matter which of the logical regions are being accessed as long as they are in different panels.

Boot Flash Memory (BFM)

Boot Flash Memory is meant to support sophisticated boot loaders and therefore have 16 pages in each panel’s BFM.

PIC32C devices have a Boot ROM to control the loading of configuration and to provide a root of trust for secure boot. When the Boot ROM is finished it sets up the CPU to start execution from the base of BFM.

With a dual panel system, each panel has BFM. The BFM can be used in either Dual Boot or Single Boot. Dual Boot designates each panel’s BFM as a boot source. This allows the safe updating of one boot image while the other image stays intact. Single boot allows the boot image to span both panel’s BFM space providing a larger boot code space.

Configuration Flash Memory (CFM)

CFM contains eight pages (four pages in each panel) dedicated to configuration of the device. (See the following table.) These pages have hardware-imposed restrictions on their usage. They are not for code and may not be accessible after the device is protected.

Three pages contain factory calibration data including the unique ID of the device (Cal-OTP, Cal-Backup, and Test). These pages are cannot be written or erased.

The Debug Access Level Configuration page (DAL CFG) holds the selected allowable access provided to the debug host. This page can only be written via the SDAL command. It cannot be erased by a Page Erase. The Boot ROM is allowed to issue SDAL commands in order to restore DAL to the appropriate level.

The Boot Configuration page (Boot CFG) contains pre-boot options to be configured by the Boot ROM. This page can be read protected and write/erase protected by the Flash system.

The User-OTP page implements a flash based One Time Programmable regions. It is always erase protected by hardware such that its content survives a Chip Erase operation. It is intended to store calibration values for external devices but is fully user defined.

The User Configuration page (User CFG) stores pre-boot options that have a different protection model than Boot CFG. This page can be write/erase locked.

The second panel’s CFM contains additional pages to support dual boot. Boot CFG 2 and User CFG 2 allow safe updates of configuration when also updating application code in PFM or boot code in BFM.

Table 31-1. Flash CFM Configuration Address Map
Panel:Address: Size: Contents: Notes:
Start:End:
10x0A00_00000x0A00_0FFF4 KByteUser CFG-1
10x0A00_10000x0A00_1FFF4 KByteUser OTP-1
10x0A00_20000x0A00_2FFF4 KByteBOOT CFG-1
10x0A00_30000x0A00_3FFF4 KByteRSVDNo access.
10x0A00_40000x0A00_4FFF4 KByteDAL CFG
10x0A00_50000x0A00_5FFF4 KByteTESTCannot be written or erased.
10x0A00_60000x0A00_6FFF4 KByteCAL-BackupCannot be written or erased.
10x0A00_70000x0A00_7FFF4 KByteCAL-OTPCannot be written or erased.
20x0A00_80000x0A00_8FFF4 KByteUser CFG-2
20x0A00_90000x0A00_9FFF4 KByteUser OTP-2
20x0A00_A0000x0A00_AFFF4 KByteBOOT CFG-2
20x0A00_B0000x0A00_BFFF4 KByteRSVDNo access.
20x0A00_C0000x0A00_CFFF4 KByteRSVD
20x0A00_D0000x0A00_DFFF4 KByteRSVD
20x0A00_E0000x0A00_EFFF4 KByteRSVD
20x0A00_F0000x0A00_FFFF4 KByteRSVD
Note: All RSVD addresses are “Address Holes” and therefore generate a bus error back to the initiator.