RA6M3 firmware update, reboot from image 1 after the second MCU restart


I am working on the EK-RA6M3, I have a project that's working fine performing FW update through UART using XMODEM,

I am using the swap bootloader example project as is didn't change anything,

And then I created 2 bare metal blinky projects and configure them to use the bootloader,

And set the same configuration and copied the same code from the bare metal example in the following forum thread :


As I already mentioned the project is working as expected but I have 2 problems:

- After updating the firmware the MCU reboots from image 2 (as expected) but on the next restart the MCU reboots from image 1 again.

- After updating the firmware, I am unable to redo the firmware update from image 2, when trying to erase the secondary slot I am getting err = FSP_ERR_CMD_LOCKED, (FCU is in locked state, typically as a result of attempting to Erase an area that is protected by an Access Window)

I believe I am missing something here,

Can you please help me with these two problems,

Best regards,