1 Flash Memory

The Flash memory on dsPIC33AK256MPS306 family devices is divided into quadwords (16 bytes each), write rows (512 bytes each) and erase pages (4096 bytes each). The quadword (four 32-bit long words) is the minimum data size that can be written into the Flash. The address of each quadword is aligned by 16 bytes. The Flash memory can be written by rows, and each row consists of 32 quadwords or 512 bytes. The address of each row is aligned by 512-byte boundaries.

The Flash memory must be erased before a write operation can be initiated, and it can be erased by pages. Each erase page consists of eight rows or 4096 bytes. The address of each erase page is aligned by 4096-byte boundaries.

The dsPIC33AK256MPS306 family devices’ Flash memory regions are shown in Table 1-1.

Table 1-1. Flash Memory Map
Memory RegionAddressNumber of QuadwordsNumber of Write RowsNumber of Erase PagesDescription
User OTP0x7F2C00-0x7F3000642Not applicableQuadword or row programmed, never erasable
User Configuration A (UCA1)0x7F3000-0x7F3FFC25681Bulk or page erased, quadword programmed
User Configuration B (UCB)0x7F4000-0x7F4FFC25681
User Configuration A2 (UCA2)0x7FB000-0x7FBFFC25681(1)
Code Memory128-Kbyte Flash Memory DevicesSingle Boot800000-81FFFC818225632Bulk or page erased, quadword or row programmed
Dual Boot800000-80FFFC409112816
C00000-C0FFFC409112816
256-Kbyte Flash Memory DevicesSingle Boot800000-83FFFC1638451264
Dual Boot800000-81FFFC818225632
C00000-C1FFFC818225632
Note:
  1. UCA2 is used only when the device operates in a Dual Partition Flash mode. In Single Partition mode, only UCA1 is active.

Some dsPIC33AK256MPS306 family device registers are used in the programming procedures. The descriptions and addresses of these registers are listed in Table 1-2.

Table 1-2. Registers Used in the Programming Procedures
Register NameAddressDescription
VISI0x0007C0This is a register to move (shift) data out of the device through the ICSP interface.
NVMCON0x003000This is a register to select type and initiate erase or write Flash operations.
NVMADR0x003004This register is the destination Flash address for erase or write operations.
NVMDATA00x003008This is a register with data to be programmed to Flash when quadword write is used.
NVMDATA10x00300CThis is a register with data to be programmed to Flash when quadword write is used.
NVMDATA20x003010This is a register with data to be programmed to Flash when quadword write is used.
NVMDATA30x003014This is a register with data to be programmed to Flash when quadword write is used.
NVMSRCADR0x003018This register should be set to the address of the RAM buffer loaded with the Flash row data to be programmed.
NVMCRCCON0x003048This register controls the Cyclic Redundancy Check (CRC) calculation of the Flash region.
NVMCRCST0x00304CThis register contains the start address of the 4-Kbyte Flash memory block for the CRC calculation.
NVMCRCEND0x003050This register contains the end address of the 4-Kbyte Flash memory block minus one byte for the CRC calculation.
NVMCRCSEED0x003054The initial CRC value (seed) should be loaded into this register. If the CRC-32 is calculated for the multiple memory blocks, then the previous CRC result must be written directly to NVMCRCSEED before the next block of CRC calculations.
NVMCRCDATA0x003058This register contains the CRC calculation result.