This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ra question about code flash erase

Hello, guys

      Now I am using ra6t1 to develop my application, and get a problem when I use flash erase, and I will show my problem with an simple example.

      first, I make a new simple project like this.


      In this simple project, I just use gpt12, open the gpt12 overflow interrupt, with 1ms cycle.

      And the problem is once run the function R_FLASH_HP_Erase(), and the mcu will go out of control, if in the debug mode, it will go here below.


    I guess it is about the interrupt problem when the mcu  is in flash erase situation. But I don't know the problem exactly, and how to solve this problem, because there will be several interrupts when do the flash programming.



  • Hi Alex,

    Thanks for reaching out to Engineering Community.

    For code flash, BGO ( Background Operation) is not supported, so a code flash operation will not return before the operation has completed. If an interrupt occurs during the code flash operation, then code flash will be accessed to fetch the interrupt's starting address and an error will occur. The simplest way to overcome this issue is to disable interrupts before entering code flash operations and enabling them again after they have completed.

    You can check here the example about flash_hp to see how to do it. 

    Best regards,


  • Thanks, this helps.

Reply Children
No Data