RA6M3 on EK-RA6M3 won't erase/program.

Hello,

I have an issue with programming/erasing the MCU on EK-RA6M3 via on-board J-Link or standalone J-link.

At first I was programming various codes to MCU without any issues, but all of a sudden an error occured, here are the screenshots from both Renesas Flash Programmer and J Flash     

I can detect MCU, read Flash memory, but cannot erase or program it anymore. Maybe some kind of protection was enabled, but I'm not able to figure it out.

Can you please help me ?

Thanks in advance for your reply.

Regards,
Filip.

Parents Reply
  • Looking at SECMPUAC register at 0000 0438h, you have enabled the security MPU protection on 4 regions:

    If Security MPU is valid (which means SECMPUAC is not 0xFFFF), boot firmware goes into an infinite loop without transition to either mode and hangs indefinitely.

    The only way to erase the device is to issue the “ALeRASE” command. To send the ALeRASE command from the debugger, you will need to use the attached script. Edit the file JLink_path.bat to point to where the Segger software is installed. If the script is successful you will see MCUSTAT read as 0x00000002

    RA6M3_ALeRASE.rar

    If it fails, I am afraid that you need to replace the device. 

Children
  • Thank you for the reply.

    Unfortunately the script didn't help, here is the log :


    Connecting to target via SWD
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xD0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xF0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    Error occurred: Could not connect to the target device.
    For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
    J-Link>

    We will replace the device according to your instructions. If this issue happens again, would it be possible for you to have a look at the HEX file that was programmed just before the issue happened (that may caused the issue) ?

  • Thank you for the reply.

    Unfortunately the script didn't help, here is the log :


    Connecting to target via SWD
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xD0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xF0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    Error occurred: Could not connect to the target device.
    For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
    J-Link>

    If this happens again, would it be possible for you to have a look at the HEX file that was programmed just before the issue happened in order to determine the cause ?

  • Thank you for the reply.

    Unfortunately the script didn't help, here is the log :


    Connecting to target via SWD
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xD0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xF0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    Error occurred: Could not connect to the target device.
    For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
    J-Link>

    If this happens again, would it be possible for you to have a look at the HEX file that was programmed just before the issue happened in order to determine the cause ?

  • Thank you for the reply.

    Unfortunately the script didn't help, here is the log :


    Connecting to target via SWD
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xD0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xF0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    Error occurred: Could not connect to the target device.
    For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
    J-Link>

    If this happens again, would it be possible for you to have a look at the HEX file that was programmed just before the issue happened in order to determine the cause ?

  • Thank you for the reply.

    Unfortunately the script didn't help, here is the log :


    Connecting to target via SWD
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xD0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xF0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    Error occurred: Could not connect to the target device.
    For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
    J-Link>

    If this happens again, would it be possible for you to have a look at the HEX file that was programmed just before the issue happened in order to determine the cause ?

  • Thank you for the reply.

    Unfortunately the script didn't help, here is the log :


    Connecting to target via SWD
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xD0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    InitTarget() start

    RA ALeRASE J-Link script InitTarget

    ALeRASE CMD
    SWO:

    DAP-CtrlStat: 0xF0000040
    DAP-CtrlStat: 0xC0000040
    RESET assert
    RESET de-assert
    SWO:

    DAP-CtrlStat: 0xF0000040
    MCUSTAT: 0x00000000
    ...
    ...
    ...
    MCUSTAT: 0x00000000
    InitTarget() end - Took 60.1s
    Found SW-DP with ID 0x5BA02477
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Attach to CPU failed. Executing connect under reset.
    DPIDR: 0x5BA02477
    CoreSight SoC-400 or earlier
    Scanning AP map to find all available APs
    AP[2]: Stopped AP scan as end of AP map has been reached
    AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Could not read CPUID register
    AP[1]: Skipped. Not an AHB-AP
    Could not find core in Coresight setup
    Error occurred: Could not connect to the target device.
    For troubleshooting steps visit: wiki.segger.com/J-Link_Troubleshooting
    J-Link>

    If this happens again, would it be possible for you to have a look at the HEX file that was programmed just before the issue happened in order to determine the cause ?

  • I am afraid the device is locked, please proceed to replace it.

    This could happen if you programmed a hex file which was mistakenly created for another device and not RA6M3.

  • The ALeRASE command will not work if the security MPU is enabled (even if the ALeRASE command is sent via the debugger). You could try the attached JLink script that attempts to erase block zero of the code flash by directly writing to the FCU control registers.

    Install the JLink Software and documentation pack ( SEGGER - The Embedded Experts - Downloads - J-Link / J-Trace ), change the path in JLink_path.bat to point to where jlink.exe is located, and run the batch file, it might work, it might not.

    2100.RA6M3_Erase_Block_0.zip