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.

  • Hi Filip,

    Thank you for reaching out to Renesas!

    A timeout error occurred in Renesas Flash Programmer, this matches the issue described in the RFP Error Guide – Section: Timeout.
    Renesas Flash Programmer Error Guide | Renesas

    This error often occurs if the MCU is protected or not in the correct mode for programming. If the device was previously programmed with security settings (e.g., TrustZone enabled or Option-Setting Memory modified), it can block further access.


    As per the guide, please try forcing the device into Boot Mode by setting the MD pin to high (logic 1) during reset.

    Then retry erase using Renesas Flash Programmer.

    This should bypass user code and allow reprogramming.

    You can also try factory reset functionality of e2 studio.

    Let me know if you need further assistance!

    Kind regards,

    Payodhi

  • Thank you for the answer, I have tried setting MD pin to logic 1 but the issue persists.

    How can I try factory reset from e2 studio, is there a tutorial ?

  • Hi Filip,

    Thank you for your response! To factory reset in e2 studio, you need to go to Run -->Renesas debug tool --> Renesas device partition manager then, click the checkbox of Initialize device then, click Run.

    Kind refards,

    PS

  • OK, I tried running Partition Manager but got this error: 

    Starting connection with the following settings:
        Device family    : RA
        Emulator information    :
            - Emulator type        : Segger J-Link
            - Connection interface    : SCI
            - Emulator selected    : Auto
            - Supply voltage (V)    : Using external power supply.
        Baud rate (bps)        : Default baud rate
        Display errors in    : English

    Connecting...
        Loading library                : SUCCESSFUL!
        Establishing connection            : FAILED! SCI boot communication setting error has occurred.

    Disconnecting...
    DISCONNECTED.

    ----------SUMMARY OF RESULT----------
    Connection        : FAILED!
    -------------END SUMMARY-------

    Can you please advise ?

    I'm adding a link to a photo of hardware connection just to confirm if everything is connected properly :

    https://imgur.com/a/ElYUjfw

  • Hi,

    Please ensure that only one J-Link is connected at a time, either the on-board J-Link or the external J-Link, not both simultaneously.

    Also, kindly disconnect all other devices and connect only the J-Link. Then, go to the power settings and select "Power device via J-Link".

    If communication is not working via SCI, please try using SWD mode instead. If you are using an EVK board, make sure the MD (Mode) pin is in its default state, and then attempt connection via SWD.

    Let me know if you need further assistance.

    Kind regards,

    PS

  • Where can I find the Power Settings ? If I choose J-link, there is no Power Settings in the Debugger tab, including GDB Settings, Connection Settings, Debug Tool Settings.

    I have tried both SCI and SWD mode, with MD pin in both positions but the issue persists.

  • 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. 

  • 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) ?