3 Programming Procedures
The dsPIC33AK512MC510 and dsPIC33AK512MPS512 family devices programming flow consists of the following steps:
- Enter ICSP mode
- Bulk Erase entire Flash:
- Enter ICSP mode
- Bulk Erase
- Exit ICSP mode
- Program FBOOT_BACKUP and FBOOT:
- Enter ICSP mode
- Program FBOOT_BACKUP
- Exit ICSP mode
- Enter ICSP mode
- Program FBOOT
- Exit ICSP Mode.
- Write code memory
- Read back CRC to verify the code memory
- Write User Configuration A1 backup memory
- Read back and verify
- Write User Configuration B backup memory
- Read back and verify
- Write User Configuration A1 primary memory:
- Read back and verify
- Write User Configuration B primary memory
- Read back and verify
- Exit ICSP mode
If the programming or erase operations are disabled in the Configuration Words of the UCAx and UCB areas, then the Flash erase or write procedures will fail with no effect on the protected areas. To erase all Flash memory, the protected regions defined in the UCB area must be disabled by erasing UCB and exiting/re-entering ICSP mode.
Perform the following steps to remove the code protection:
- Enter ICSP mode
- Bulk Erase to erase UCAx memory, including the code protection bits of UCB memory
- Exit ICSP mode to reload Configuration Words
- Enter ICSP mode
- Bulk Erase to erase UCB memory, including the code protection bits. This procedure will also erase the entire Code Flash memory
- Exit ICSP mode to reload Configuration Words
When the Code Flash memory is not protected from programming or erase, then the Bulk Erase does a parallel erase operation and completes quickly (refer to the data sheet for the Bulk Erase time). Conversely, if any erase, write or OTP protected regions are defined in the Code Flash, the Bulk Erase command will still be accepted. However, internally, the NVM controller will perform the Bulk Erase as a self-iterated sequential Page Erase, resulting in a significantly longer Bulk Erase time.