1 Flash Memory

The Flash memory on dsPIC33AK512MC510 and dsPIC33AK512MPS512 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 which can be written into the Flash. The address of each quadword is aligned by 16 bytes. Also, the Flash memory can be written by rows. Each row consists of 32 quadwords or 512 bytes. The address of each row is aligned by 512-byte boundaries.

The Flash must be erased before a write operation can be initiated. The Flash 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 dsPIC33AK512MC510 and dsPIC33AK512MPS512 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 Pages
User OTP0x7F2C00-0x7F2FFC642Not applicable
User Configuration A1 (UCA1)0x7F3000-0x7F3FFC25681
User Configuration B (UCB)0x7F4000-0x7F4FFC25681
User Configuration A2 (UCA2)0x7FB000-0x7FBFFC25681
Code Memory256-Kbyte Flash Memory DevicesSingle Boot800000-83FFFC16,38451264
Dual Boot800000-81FFFC8,18225632
C00000-C1FFFC8,18225632
512-Kbyte Flash Memory DevicesSingle Boot800000-87FFFC32,7681024128
Dual Boot800000-83FFFC16,38451264
C00000-C3FFFC16,38451264

Some dsPIC33AK512MC510 and dsPIC33AK512MPS512 family device registers are used in the programming procedures. These registers’ addresses and descriptions are listed in Table 1-2.

Table 1-2. Registers Used in the Programming Procedures
Register NameAddressDescription
VISI0x0007C0This register moves (shifts) data out of the device through the ICSP™ interface.
NVMCON0x003000This register selects type and initiates an erase or write Flash operation.
NVMADR0x003004The destination Flash address for erase or write operations.
NVMDATA00x003008This register with data is programmed to Flash when quadword write is used.
NVMDATA10x00300CThis register with data is programmed to Flash when quadword write is used.
NVMDATA20x003010This register with data is programmed to Flash when quadword write is used.
NVMDATA30x003014This register with data is 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.