Can't program a RA4M2 with J-Link

Hello,

I'm working with custom boards equipped with R7FA4M2ABC3FP devices. I use a J-Link prob and the SWD interface to debug/program the RA4M2 and it's usually running fine.

But for some reason I can't program some of them anymore, I was able to program these boards before but after usingthem a few times I get an error each time I try to flash or erase a program. I don't know the reason for the error or what operation can cause the problem. Has this appened to anyone ?

I tried to program with J-Flash Lite V7.56d and e2 studio.

With e2 studio I get this error message when I try to start a debug session:

Failed to execute MI command:

load

...

Error message from debugger back end:

Could not write register "pc"; remote failure reply

'E..FFFFFFFF'

I also have this in the Console log :

Connecting to R7FA4M2AB, ARM Target
GDBServer endian : little
Target power from emulator : Off
Starting target connection

Current status of the RA TrustZone device
DLM state : Non-debugging Mode
Debug level : N/A
Secure/NSC memory partition size :
- Code Flash Secure (kB) : 0
- Code Flash NSC (kB) : 0
- Data Flash Secure (kB) : 0
- SRAM Secure (kB) : 0
- SRAM NSC (kB) : 0

Finished target connection
GDB: 56306
Target connection status - OK
Target connection status - OK
Starting download
GDB action 'write register', has failed with error code, 0xfffffffc
Disconnected from the Target Debugger.

  • Hi,

    The DLM state is set as non-debugging mode. It looks like you have changed the DLM (Device Lifecycle Manangment) state to a state with debug level 0 where the debugger is not allowed to connect. If the DLM state is Deployed (DPL) then you should be able to initialise the device and clear the DLM mode back to SSD. But if the DLM state is either LCK_DBG (Locked Debug) or LCK_BOOT (Locked Boot) then the debug interface will be permanently locked.

    To try and initialise the device use either the partition manager in e2studio or use RFP (Renesas Flash Programmer).

    Ian.

  • Hello Ian, thank you for your answer,

    I tried using the partition manager and RFP but it didn't work (The tool is not supported apparently). I managed to read the DLMMON register on my device using J-Mem from Segger and the register reads as 0x00000001 (CM).

    RFP can apparently work with a COM port interface but I couldn't find any information on how to connect the COM to the device. I would like to use RFP to do a factory reset on my device to see if it resolves the problem. 

  • Hi,

    A colleague has suggested the following. Thanks MM.

    The problem is probably due to a mismatch between the J-Link firmware and the JLinkARM.DLL in the e2 studio. If you updated the J-Link firmware with J-Link v7.56b, the JLinkARM.DLL also needs to be updated to v7.56 or later. This issue seems to occur in the J-Link v7.56 or later.

    Steps:

    1. Navigate to the e2studio support area:

    2. In e2studio select Help -> About e2studio then click on "Installation Details".

    3. Select the last tab "Support Folders".
    4. Click on the first link to open e2studio support area
    5. Copy the JLinkARM.DLL v7.56b (fromm the Segger JLink install folder) to {e2 studio support area}\DebugComp\RA\ARM\Segger_v7.56.2 folder.
    6. Open ra4m2.3.4.0.xml and replace the path for the dll file like below.
      Before:

    <SeggerInformation>

    <Path>ARM/Segger_v7.50.1</Path>

    <FileName>JLinkARM.dll</FileName>

    </SeggerInformation>

    After:

      <SeggerInformation>

        <Path>ARM/Segger_v7.56.2</Path>

        <FileName>JLinkARM.dll</FileName>

      </SeggerInformation>

    Hopefully you will then be able to connect to the board with e2studio.

    Ian.

  • Hi,

    Thank you for the quick reply, I tried this solution but it didn't change anything, e2studio is not the only software that cannot connect to the board I also can't use the J-Link Flash programmer from Segger.

    Benjamin

  • Hi,

    Ok. I suggest you put the device into boot mode and see if you can connect using Renesas Flash Programmer (RFP) - https://www.renesas.com/us/en/software-tool/renesas-flash-programmer-programming-gui

    You should use v3.08 or later.

    You can connect either via USB if you have that configured for host mode on your board. Or you can use a UART interface. I normally use a USB-TTL adapter from FTDI etc. You must use SCI9 with RxD9 on P110 and TxD9 on P109. The MD pin must be set to 0 (normally 1 for single chip mode). Then reset the device and connect with RFP. From within RFP you can initialise the device to factory reset it if possible. But if the locked debug DLM state you won't be able to connect the debugger again. If it is in the locked boot state you won't be able to connect in boot mode.

    Ian.

  • I am also observing the same issue.

    I am using the EK-RA6M3 board. 

    As per my observation, when I reduce the code size around 2K the debugging works properly.

    My original code size was around 133K.

    When I reduce it it to 131K, the code started get debugged properly.

    Also I don't need to comment a specific code for this. Randomly if I commented any code to reduce the size by 2K the debugging works properly.

    Please suggest some solution related to this.

  • Hi,

    The upper code flash blocks are 32kB in size on 32kB boundaries. What address is failing in your device. Could it be in the block after the 128kB boundary? If so it looks like this flash block could be locked either via FAW settings or MPU.

    Ian.

  • Hi Mukund-

    Looks like Ian's suggestion helped. I will mark this as solved- please repost if you still have issues.

  • Hi,

    It looks like this may be caused by an issue with the Segger JLink-OB. v7.60d of the JLink software has been released today with the following fix in the release notes:

    J-Link-OB-S124

    1. If bigger chunks of memory were read / written (>= 8 KB) the USB communication could break down and the OB has reset itself. Fixed.

    So, please download and install this update and try flashing the device with JLink-Lite from this version which should trigger a firmware update.

    https://www.segger.com/downloads/jlink/

    Ian.