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.

CC2340R5: How can I change the image currently running and reset the device to a new one?

Part Number: CC2340R5

Tool/software:

Good afternoon,

I'm working on a OAD on chip project with the CC2340R5 chip.

My application consists of :

-MCUboot Bootloader

-Persistent Application

-User Application

I want to invalidate my application and went back to Persistent Application to create a new application for the mobile application.
What's the procedure for this?

I understand that the example used the following solution:

Status_t SwUpdate_RevokeImage(uint8 imageSlot)
{
Status_t status = FLASH_SUCCESS;
struct image_header emptyHeader = {0};

status = flash_open();

if(INT_PRIMARY_SLOT == imageSlot)
{
writeFlash(HDR_OFFSET, (uint8_t *)&(emptyHeader),sizeof(pSwUpdateModuleGlobalData->primaryHdr));

}
flash_close();

return (status);
}

so I tried implementing this function in my code and restarting my chip. On restart, my application restarted in my User Application without switching back to the persitent app.

Have I misunderstood how to do this? Is there another solution? Is there anything else I need to do?

Yohan,

Regards

  • Hi Yohan, 

    Thank you for reaching out. 

    The procedure you are following seems correct to me. I can then think about two potential issues: 1) the header is not properly altered, or 2) the bootloader does not select the expected image.

    In order to verify 1), I would recommend ensuring the header is altered as expected. This can be done using the debugger and monitoring the application's header content. 

    In order to verify 2), I would first recommend to ensure the reset occurs as expected (i.e. MCUboot is executed). Assuming MCUboot is executed, run it in debug mode so you understand why the application image keeps being selected. 

    I hope this will help,

    Best regards,