[SOLVED] Connection lost after ResetTarget()

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Connection lost after ResetTarget()

    I working on a project which is based on a HiSilicon HI3518EV300 device.
    J-Link is connected to the device via JTAG (RST, TDO, TDI, TMS, TCK).

    As we don't have the chips nRESET signal i have overwritten the default reset strategy in my JLinkScript like this to issue the reset by a write to the respective system-controll register:

    C Source Code

    1. void ResetTarget(void)
    2. {
    3. JLINK_MEM_WriteU32(0x12020004, 0xFF); //any write to SC_SYSRES will issue a system reset
    4. JLINK_SYS_Sleep(1000);
    5. JLINK_TARGET_Halt();
    6. }

    The software running on the HI3518EV is seperated in a bootloader and an application.

    The bootloader does all the low level initialization like PLL and external memory.
    For that reason the bootloader code must be executed before J-Link can load the application into RAM.
    To make this happen, i added the `JLINK_SYS_Sleep(1000)` command before `JLINK_TARGET_Halt()`.

    The reset, the delay and the halt seems to work. However, afterwards i get read erros.
    It seems like the JTAG connection got lost...

    Source Code

    1. EGGER J-Link GDB Server V6.94d Command Line Version
    2. JLinkARM.dll V6.94d (DLL compiled Feb 12 2021 15:56:18)
    3. Command line: -jlinkscriptfile gdbserver.JLinkScript -device CORTEX-A7 -if JTAG -speed 12000
    4. -----GDB Server start settings-----
    5. GDBInit file: none
    6. GDB Server Listening port: 2331
    7. SWO raw output listening port: 2332
    8. Terminal I/O port: 2333
    9. Accept remote connection: yes
    10. Generate logfile: off
    11. Verify download: off
    12. Init regs on start: off
    13. Silent mode: off
    14. Single run mode: off
    15. Target connection timeout: 0 ms
    16. ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: gdbserver.JLinkScript
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: CORTEX-A7
    22. Target interface: JTAG
    23. Target interface speed: 12000kHz
    24. Target endian: little
    25. Connecting to J-Link...
    26. J-Link is connected.
    27. Firmware: J-Link V11 compiled Oct 21 2022 11:14:15
    28. Hardware: V11.00
    29. S/N: 601000927
    30. Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
    31. Checking target voltage...
    32. Target voltage: 3.32 V
    33. Listening on TCP/IP port 2331
    34. Connecting to target...
    35. J-Link found 1 JTAG device, Total IRLen = 4
    36. JTAG ID: 0x4BA00477 (Cortex-A7)
    37. Connected to target
    38. Waiting for GDB connection...Connected to 127.0.0.1
    39. Reading all registers
    40. WARNING: Failed to read memory @ address 0x1A0159EE
    41. WARNING: Failed to read memory @ address 0x1A0159EA
    Display All

    If i quit the GDB server and start it again, it reconnects to the HI3518 and then i can load the application into the RAM and start debugging the applicaion.


    Any ideas how to solve this problem. Or how to automate the reconnect?


    Thanks and best regards
    Manuel
  • Hi,

    Sounds like the register you are using to reset the chip, also resets the debug logic, which is usually not what you want because it results in
    - loss of hardware breakpoints being set
    - J-Link being unable to halt the core before potential user code execution
    - loss of debug connection (debug connection needs to be re-established manually from within the script, by writing several debug registers)
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.