Hello!
I currently face a problem, in which I'm unable to flash my EK-RA6M1. Im currently trying to develop a USBFS-interface but cant really test my code, since flashing is not possible. What I try to do is erasing my Device via the j-Link Commander V7.94. When using the Erase command i get the following Error:
Type "connect" to establish a target connection, '?' for help J-Link>connect Please specify device / core. <Default>: R7FA6M1AD Type '?' for selection dialog Device> Please specify target interface: J) JTAG (Default) S) SWD T) cJTAG TIF>S Specify target interface speed [kHz]. <Default>: 4000 kHz Speed> Device "R7FA6M1AD" selected. Connecting to target via SWD InitTarget() start Identifying target device... SWD selected. Executing JTAG -> SWD switching sequence... Initializing DAP... DAP initialized successfully. Low power mode detected. Waking device from low power mode. InitTarget() end - Took 10.8ms 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) AP[1]: APB-AP (IDR: 0x44770002) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410FC241. Implementer code: 0x41 (ARM) Found Cortex-M4 r0p1, Little endian. FPUnit: 6 code (BP) slots and 2 literal slots CoreSight components: ROMTbl[0] @ E00FF000 [0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7 [0][1]: E0001000 CID B105E00D PID 003BB002 DWT [0][2]: E0002000 CID B105E00D PID 002BB003 FPB [0][3]: E0000000 CID B105E00D PID 003BB001 ITM [0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU [0][5]: E0041000 CID B105900D PID 000BB925 ETM [0][6]: E0042000 CID B105900D PID 002BB908 CSTF [0][7]: E0043000 CID B105900D PID 001BB961 TMC [0][8]: E0044000 CID B105F00D PID 001BB101 TSG Memory zones: Zone: "Default" Description: Default access mode Cortex-M4 identified. J-Link>erase No address range specified, 'Erase Chip' will be executed 'erase': Performing implicit reset & halt of MCU. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Erasing device... J-Link: Flash download: Only internal flash banks will be erased. To enable erasing of other flash banks like QSPI or CFI, it needs to be enabled via "exec EnableEraseAllFlashBanks" ****** Error: Failed to erase sectors 0 @ address 0x0100A150 ((erase error)) Failed to erase sectors. J-Link: Flash download: Total time needed: 0.211s (Prepare: 0.151s, Compare: 0.000s, Erase: 0.016s, Program: 0.000s, Verify: 0.000s, Restore: 0.043s) ERROR: Erase returned with error code -5.
Hello,
What is the value of Access Window Setting Register (AWS) at 0x 0100 A164 ?
Sadly I didnt received an answer to the approving request over the weekend. I try to repost this answer.
Here's the screenshot:
What are bits 127 and 126 of the OSIS register (ID code) ?
Try to run the attached ALERASE script.
Modify the JLink_path file to your JLink installation path.
Open a command prompt and run the other .bat file.
ALERASE_RA6M1.zip
So after executing ID_Code_ERASEALL_RA6M1 it never successfully executed. It kept displaying
MCUSTAT: 0x00000000
J-Link Command File read successfully. Processing script file... J-Link>Device R7FA6M1AD J-Link connection not established yet but required for command. Connecting to J-Link via USB...O.K. Firmware: J-Link OB-S124 compiled Dec 13 2023 14:39:54 Hardware version: V1.00 J-Link uptime (since boot): 0d 00h 29m 42s S/N: 831485060 USB speed mode: Full speed (12 MBit/s) VTref=3.300V J-Link>si SWD Selecting SWD as current target interface. J-Link>speed 4000 Selecting 4000 kHz as target interface speed J-Link>connect Device "R7FA6M1AD" selected. Connecting to target via SWD InitTarget() start RA ALeRASE J-Link script InitTarget ALeRASE CMD SWO: DAP-CtrlStat: 0xF0000040 DAP-CtrlStat: 0xFFFFFFFF RESET assert RESET de-assert SWO: DAP-CtrlStat: 0xF0000040 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 InitTarget() end - Took 60.4s 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) AP[1]: APB-AP (IDR: 0x44770002) 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) AP[1]: APB-AP (IDR: 0x44770002) 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 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 MCUSTAT: 0x00000000 InitTarget() end - Took 60.2s 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) AP[1]: APB-AP (IDR: 0x44770002) 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) AP[1]: APB-AP (IDR: 0x44770002) 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 Cannot connect to target. Script processing completed. Type "connect" to establish a target connection, '?' for help J-Link>
When entering J-Link Commander for the first time after trying to execute that batch-script I was asked to enter my ID-Code, whicht i never activly enabled. I typed 0xFFFF FFFF FFFF FFFF and it was succesfull (I guess). I got the following output:
J-Link>mem32 0x0100A150 32 Target connection not established yet but required for command. Device "R7FA6M1AD" selected. Connecting to target via SWD InitTarget() start Identifying target device... SWD selected. Executing JTAG -> SWD switching sequence... Initializing DAP... DAP initialized successfully. Low power mode detected. Waking device from low power mode. InitTarget() end - Took 10.5s 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) AP[1]: APB-AP (IDR: 0x44770002) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FF000 CPUID register: 0x410FC241. Implementer code: 0x41 (ARM) Found Cortex-M4 r0p1, Little endian. FPUnit: 6 code (BP) slots and 2 literal slots CoreSight components: ROMTbl[0] @ E00FF000 [0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7 [0][1]: E0001000 CID B105E00D PID 003BB002 DWT [0][2]: E0002000 CID B105E00D PID 002BB003 FPB [0][3]: E0000000 CID B105E00D PID 003BB001 ITM [0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU [0][5]: E0041000 CID B105900D PID 000BB925 ETM [0][6]: E0042000 CID B105900D PID 002BB908 CSTF [0][7]: E0043000 CID B105900D PID 001BB961 TMC [0][8]: E0044000 CID B105F00D PID 001BB101 TSG Memory zones: Zone: "Default" Description: Default access mode Cortex-M4 identified. 0100A150 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A160 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A170 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A180 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A190 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A1A0 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A1B0 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A1C0 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A1D0 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A1E0 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A1F0 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A200 = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 0100A210 = FFFFFFFF FFFFFFFF
Is jumper J8 on pins 1-2 on the EK-RA6M1 ?
Since I'm utilizing USBFS it was placed on P1/P3. But same behaviour appears when connecting jumper on j1/j2
J8 is to configure the operating mode of the device. If it is on P1-P3 boot mode will be selected after the reset. You need to place it on P1-P3 if you want to enter USB boot mode.
Anyway, if the script fails while you have J8 at P1-P2 and connected the Debug USB, you should replace the device as it has been locked.
You may be able to erase/program code flash but not option-setting memory.
Now I'm concerned about how that happened. I know it's probably hard for you to answer it this way, but I was working perfectly fine with that device. After X successful flash instances it suddenly stopped working. .ld files are untouched and just minor application changes were made. How can I avoid running into the same mistake twice?
I have a similar issue on my MCK-RA6T2. I used a sample project "Sensorless vector control for dual permanent magnetic synchronous motor (For MCK/MCB, RA Family)" as base for my code and then made some adjustments trying to implement an UART-Interface, using the default debug-configuration for the project. After a while, i encountered the same problem as in post "Failed to erase sectors 0 @ address 0x00000000 ((erase error)) of RA6M1 - Forum - RA MCU - Renesas Engineering Community". I followed the steps with the J-Link Commander V7.94 like Dansen and got the following error:
Type "connect" to establish a target connection, '?' for help J-Link>connect Please specify device / core. <Default>: R7FA6T2BD Type '?' for selection dialog Device> Please specify target interface: J) JTAG (Default) S) SWD T) cJTAG TIF>S Specify target interface speed [kHz]. <Default>: 4000 kHz Speed> Device "R7FA6T2BD" selected. Connecting to target via SWD ConfigTargetSettings() start Configuring FlashDLNoRMWThreshold=0x200 in order to make sure that option bytes programming is done via read-modify-write ConfigTargetSettings() end - Took 419us InitTarget() start SWD selected. Executing JTAG -> SWD switching sequence. DAP initialized successfully. Determining TrustZone configuration... Secure Debug: Enabled (SSD) Determining currently configured transfer type by reading the AHB-AP CSW register. --> Correct transfer type configured. Done. InitTarget() end - Took 7.82ms Found SW-DP with ID 0x6BA02477 DPIDR: 0x6BA02477 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: 0x84770001) AP[1]: APB-AP (IDR: 0x54770002) Iterating through AP map to find AHB-AP to use AP[0]: Core found AP[0]: AHB-AP ROM base: 0xE00FE000 CPUID register: 0x410FD214. Implementer code: 0x41 (ARM) Feature set: Mainline Cache: No cache Found Cortex-M33 r0p4, Little endian. FPUnit: 8 code (BP) slots and 0 literal slots Security extension: implemented Secure debug: enabled CoreSight components: ROMTbl[0] @ E00FE000 [0][0]: E0044000 CID B105900D PID 005BB906 DEVARCH 00000000 DEVTYPE 14 CTI (?) [0][1]: E0047000 CID B105900D PID 003BB908 DEVARCH 00000000 DEVTYPE 12 CSTF [0][2]: E0048000 CID B105900D PID 001BB961 DEVARCH 00000000 DEVTYPE 21 ETB [0][3]: E0049000 CID B105F00D PID 001BB101 TSG [0][4]: E0040000 CID B105900D PID 000BBD21 DEVARCH 00000000 DEVTYPE 11 TPIU [0][5]: E00FF000 CID B105100D PID 000BB4C9 ROM Table ROMTbl[1] @ E00FF000 [1][0]: E000E000 CID B105900D PID 000BBD21 DEVARCH 47702A04 DEVTYPE 00 Cortex-M33 [1][1]: E0001000 CID B105900D PID 000BBD21 DEVARCH 47701A02 DEVTYPE 00 DWT [1][2]: E0002000 CID B105900D PID 000BBD21 DEVARCH 47701A03 DEVTYPE 00 FPB [1][3]: E0000000 CID B105900D PID 000BBD21 DEVARCH 47701A01 DEVTYPE 43 ITM [1][5]: E0041000 CID B105900D PID 002BBD21 DEVARCH 47724A13 DEVTYPE 13 ETM [1][6]: E0042000 CID B105900D PID 000BBD21 DEVARCH 47701A14 DEVTYPE 14 CSS600-CTI Memory zones: Zone: "Default" Description: Default access mode Cortex-M33 identified. J-Link>erase No address range specified, 'Erase Chip' will be executed 'erase': Performing implicit reset & halt of MCU. Reset: ARMv8M core with Security Extension enabled detected. Reset: Halt core after reset via DEMCR.VC_CORERESET. Reset: Reset device via AIRCR.SYSRESETREQ. Erasing device... CPU is running at low speed (2079 kHz). J-Link: Flash download: Total time needed: 0.254s (Prepare: 0.221s, Compare: 0.000s, Erase: 0.032s, Program: 0.000s, Verify: 0.000s, Restore: 0.000s) ****** Error: Failed to erase sectors. ERROR: Erase returned with error code -5.
I encountered the same issues as described in "Failed to erase sectors 0 @ address 0x00000000 ((erase error)) of RA6M1 - Forum - RA MCU - Renesas Engineering Community".
In e2-Studio i get teh following log:
GDB Server for Renesas targets. Version 9.1.0.v20230405-115727 [dd3207d3] (Apr 6 2023 16:06:04) Starting server with the following options: Raw options : C:\Users\mzerl\.eclipse\com.renesas.platform_1435879475\DebugComp\\RA\e2-server-gdb -g SEGGERJLINKARM -t R7FA6T2BD -uConnectionTimeout= 30 -uSelect= USB -uJLinkSetting= C:\Users\mzerl\e2_studio\workspace\pucMoc/pucMoc Debug_Flat.jlink -uJLinkLog= C:\Users\mzerl\e2_studio\workspace\pucMoc/JLinkLog.log -uLowPower= 0 -uInteface= SWD -uIfSpeed= 4000 -uNoReset= 1 -uResetPreRun= 1 -uResetCon= 1 -uResetBefDownload= 1 -uReleaseCM3= 0 -uDisconnectionMode= 1 -uSWOcoreClock= 0 -uEnableSciBoot= 1 -uresetOnReload= 1 -n 0 -uFlashBp= 1 -uSimulation= 0 -ueraseRomOnDownload= 0 -ueraseDataRomOnDownload= 0 -uOSRestriction= 0 -uProgReWriteIRom= 0 -uCPUFrequency= 0 -uCECycle= 1 -uMemRegion= 0x00000000:0x80000:FLASH:n -uMemRegion= 0x08000000:0x4000:DATA_FLASH:n -uTz= SSD -l -uCore= SINGLE_CORE|enabled|1|main -uSyncMode= async -uFirstGDB= main --gdbVersion= 7.2 Using J-Link version V7.88d - C:\Users\mzerl\.eclipse\com.renesas.platform_1435879475\DebugComp\RA\ARM\Segger_v7.88.4\JLinkARM.dll Connecting to R7FA6T2BD, ARM Target GDBServer endian : little Target power from emulator : Off Starting target connection Current TrustZone device status DLM state : Secure Software Development (SSD) Debug level : 2 Secure/NSC memory partition size : - Code Flash Secure (kB) : 40 - Code Flash NSC (kB) : 24 - Data Flash Secure (kB) : 0 - SRAM Secure (kB) : 5 - SRAM NSC (kB) : 3 Finished target connection GDB: 58818 Target connection status - OK Target connection status - OK Starting download Option Function Select, writing to address 0x0100a100 with data ffffffffffffffffffffffffffffffff Option Function Select, writing to address 0x0100a134 with data ffffffff Option Function Select, writing to address 0x0100a200 with data fffdf0ffffffffffffffffffffffffff... Finished download GDB action 'Finished download', has failed with error report, failed to download Hardware breakpoint set at address 0x327c Hardware breakpoint set at address 0x3364 Hardware breakpoint set at address 0x33bc Hardware breakpoint set at address 0x48d6 GDB action 'read memory', has failed with error code, 0xffffffff Disconnected from the Target Debugger.
Please create a new post as this is a different device.