This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-MSPM0G3507: Error writing at last sector in flash.

Part Number: LP-MSPM0G3507

Hi Support team,

I have found some issue while re-writing at last sector i.e.(0x1FC00 - 0x1FFFF) in MSPM03507 mcu.

I am trying to write at location 0x0001FF00. Initially When i write at this location its working fine. But when i try to erase that area and re-write something. It doing nothing. I am using example code only and modified as per my requirement.

/* Address in main memory to write to */
#define MAIN_BASE_ADDRESS (0x0001FF00)

/* 32-bit data to write to flash */
uint32_t gData32 = 0x33333333;

/* 32-bit data to write to flash */
uint32_t gData32_1 = 0x44444444;

int main(void)
{
SYSCFG_DL_init();

/* Unprotect sector in main memory with ECC generated by hardware */
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
/* Erase sector in main memory */
gCmdStatus = DL_FlashCTL_eraseMemoryFromRAM(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_COMMAND_SIZE_SECTOR);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set error flag */
gErrorType = ERROR_ERASE;
}

if (gErrorType == NO_ERROR) {
/* 32-bit write to flash in main memory with ECC generated by hardware */
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
gCmdStatus = DL_FlashCTL_programMemoryFromRAM32WithECCGenerated(
FLASHCTL, (MAIN_BASE_ADDRESS), &gData32_1);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set error flag */
gErrorType = ERROR_32BIT_W;
}
}

/* Unprotect sector in main memory with ECC generated by hardware */
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
/* Erase sector in main memory */
gCmdStatus = DL_FlashCTL_eraseMemoryFromRAM(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_COMMAND_SIZE_SECTOR);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set error flag */
gErrorType = ERROR_ERASE;
}

if (gErrorType == NO_ERROR) {
/* 32-bit write to flash in main memory with ECC generated by hardware */
DL_FlashCTL_unprotectSector(
FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
gCmdStatus = DL_FlashCTL_programMemoryFromRAM32WithECCGenerated(
FLASHCTL, (MAIN_BASE_ADDRESS), &gData32);
if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
/* If command was not successful, set error flag */
gErrorType = ERROR_32BIT_W;
}
}

/* After successful completion, toggle LED and USER_TEST pin */
if (gErrorType == NO_ERROR) {
/*
* Check the contents of MAIN_BASE_ADDRESS at breakpoint:
* FF FF FF 11
* FF FF FF FF
* FF FF 22 22
* FF FF FF FF
* 33 33 33 33
* FF FF FF FF
* AB CD EF 00
* 12 34 56 78
*/
while (1) {
DL_GPIO_togglePins(GPIO_LEDS_PORT,
GPIO_LEDS_USER_LED_1_PIN | GPIO_LEDS_USER_TEST_PIN);
delay_cycles(16000000);
}
}
/* Unsuccessful example run */
else {
/* Check gErrorType value */
__BKPT(0);
}
}