SPRADN2 January 2025 MSPM0G1518 , MSPM0G1519 , MSPM0G3518 , MSPM0G3519 , MSPM0L1227 , MSPM0L1228 , MSPM0L2227 , MSPM0L2228
The erase and write operation on DATA bank are identical to the MAIN region, and can be called from Flash. Erase can happen at set or bank granularity. These feature makes the DATA bank as an excellent design for data logging. Please find a more detailed description in the device technical reference manual. An example how to use the DATA bank is shown below.
/* Address in DATA memory to write to */
#define DATA_BASE_ADDRESS (0x41D00000)
bool status = false;
uint8_t gData8 = 0x11;
DL_FlashCTL_unprotectSector(
FLASHCTL, DATA_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
DL_FlashCTL_eraseMemory(
FLASHCTL, DATA_BASE_ADDRESS, DL_FLASHCTL_COMMAND_SIZE_SECTOR);
status = DL_FlashCTL_waitForCmdDone(FLASHCTL);
while(status == false){};
DL_FlashCTL_unprotectSector(
FLASHCTL, DATA_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
DL_FlashCTL_programMemory8WithECCGenerated(
FLASHCTL, DATA_BASE_ADDRESS, &gData8);