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.
Can you read the values of these regions ?
Yes, please find the screenshot :
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 SWDInitTarget() startRA ALeRASE J-Link script InitTargetALeRASE CMDSWO:DAP-CtrlStat: 0xD0000040DAP-CtrlStat: 0xC0000040RESET assertRESET de-assertSWO:DAP-CtrlStat: 0xF0000040MCUSTAT: 0x00000000.........MCUSTAT: 0x00000000InitTarget() end - Took 60.1sFound SW-DP with ID 0x5BA02477DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APAttach to CPU failed. Executing connect under reset.DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APCould not find core in Coresight setupInitTarget() startRA ALeRASE J-Link script InitTargetALeRASE CMDSWO:DAP-CtrlStat: 0xF0000040DAP-CtrlStat: 0xC0000040RESET assertRESET de-assertSWO:DAP-CtrlStat: 0xF0000040MCUSTAT: 0x00000000.........MCUSTAT: 0x00000000InitTarget() end - Took 60.1sFound SW-DP with ID 0x5BA02477DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APAttach to CPU failed. Executing connect under reset.DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APCould not find core in Coresight setupError occurred: Could not connect to the target device.For troubleshooting steps visit: wiki.segger.com/J-Link_TroubleshootingJ-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 SWDInitTarget() startRA ALeRASE J-Link script InitTargetALeRASE CMDSWO:DAP-CtrlStat: 0xD0000040DAP-CtrlStat: 0xC0000040RESET assertRESET de-assertSWO:DAP-CtrlStat: 0xF0000040MCUSTAT: 0x00000000.........MCUSTAT: 0x00000000InitTarget() end - Took 60.1sFound SW-DP with ID 0x5BA02477DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APAttach to CPU failed. Executing connect under reset.DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APCould not find core in Coresight setupInitTarget() startRA ALeRASE J-Link script InitTargetALeRASE CMDSWO:DAP-CtrlStat: 0xF0000040DAP-CtrlStat: 0xC0000040RESET assertRESET de-assertSWO:DAP-CtrlStat: 0xF0000040MCUSTAT: 0x00000000.........MCUSTAT: 0x00000000InitTarget() end - Took 60.1sFound SW-DP with ID 0x5BA02477DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APAttach to CPU failed. Executing connect under reset.DPIDR: 0x5BA02477CoreSight SoC-400 or earlierScanning AP map to find all available APsAP[2]: Stopped AP scan as end of AP map has been reachedAP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)AP[1]: APB-AP (IDR: 0x44770002, ADDR: 0x01000000)Iterating through AP map to find AHB-AP to useAP[0]: Skipped. Could not read CPUID registerAP[1]: Skipped. Not an AHB-APCould not find core in Coresight setupError occurred: Could not connect to the target device.For troubleshooting steps visit: wiki.segger.com/J-Link_TroubleshootingJ-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