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.

MSPM0L1306: MCU goes into Default Handler while writing in Flash Memory

Part Number: MSPM0L1306

I am using MSPM0L1306 MCU in CCS 12.5.

I am trying to access flash memory and have referred to the driver library files.

While writing to flash the MCU goes in the default handler infinite loop.

I have exactly copied the same code flow from example file into my source code.

Can you please help me how to debug the problem further?

Thanks and Regards.

  • Hi Rahul,

    What FLASH address range are you attempting to write to?

  • Hello Sir,

    I am trying to write at following address:

    #define MAIN_BASE_ADDRESS (0x00001000)

    The flow of code in my source code goes like this:

    //Variables declared

    uint8_t gData8 = 0x55;
    unsigned char Test = 0;
    unsigned char *pTest;

    //Unprotect Flash
    DL_FlashCTL_unprotectSector(FLASHCTL, MAIN_BASE_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);

    //Write to Flash

    gCmdStatus = DL_FlashCTL_programMemoryFromRAM8(FLASHCTL, MAIN_BASE_ADDRESS, &gData8);

    (Note here we get PASSED in gCmdStatus and sometimes the program goes in default handler here)

    //Read_Verify flash

    gCmdStatus = DL_FlashCTL_readVerifyFromRAM8(FLASHCTL, MAIN_BASE_ADDRESS, &gData8);

    (Even when write function is passed this function always outputs FAILS)

    pTest = (void *)(MAIN_BASE_ADDRESS+8);
    Test = *pTest;

    (Test variable don't get the same value as gData8)

    Thanks and Regards.

  • Hi Rahul,

    I ran your code several times without ever branching to default handler.

    One thing I did catch is you are storing 0x55 at MAIN_BASE_ADDRESS, but you are setting the pTest pointer to MAIN_BASE_ADDRESS + 8.  That would explain why the values don't match.

  • Alright, thanks Dennis for your support.

  • Hi Rahul,

    Are you able to get this working for you?

  • Hi Dennis, 

    Actually we are working on this project on a really urgent notice so I didn't got a chance to retry flash access again, we found another way to implement our objective without using flash. I will let you know if we get to it again.

    Thanks and Regards.