J-Link Lite-XMC4000 on XMC4500 relax board is working sporadically

  • J-Link Lite-XMC4000 on XMC4500 relax board is working sporadically

    Hi all, I need help some help with the following setup:

    Hardware: J-Link Lite on XMC4500 relax board
    Software: Ubuntu 22.04, JLink version 8.10g, Zephyr main branch

    Programming did not work at all until I re-flashed the firmware with JLinkConfig. Now it is (mostly) working *one* time after connecting the board over USB to the
    computer, but fails on every subsequent run. As the setup is described in the Zephyr documentation, I guess it was working sometime.

    `dmesg` output:

    Source Code

    1. [246043.070397] usb 1-4.1: new full-speed USB device number 27 using xhci_hcd
    2. [246043.206717] usb 1-4.1: New USB device found, idVendor=1366, idProduct=0101, bcdDevice= 1.00
    3. [246043.206731] usb 1-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    4. [246043.206735] usb 1-4.1: Product: J-Link
    5. [246043.206738] usb 1-4.1: Manufacturer: SEGGER
    6. [246043.206740] usb 1-4.1: SerialNumber: 000551019312


    Working case

    Source Code

    1. west -v flash
    2. -- west flash: rebuilding
    3. cmake version 3.22.1 is OK; minimum version is 3.13.1
    4. Running CMake: /usr/bin/cmake --build zephyrproject/zephyr/build
    5. ninja: no work to do.
    6. -- west flash: using runner jlink
    7. -- runners.jlink: reset after flashing requested
    8. runners.jlink: JLINKARM_GetDLLVersion()=81007
    9. -- runners.jlink: JLink version: 8.10g
    10. runners.jlink: JLink commander script:
    11. ExitOnError 1
    12. r
    13. LE
    14. loadfile "zephyrproject/zephyr/build/zephyr/zephyr.bin" 0xc000000
    15. r
    16. g
    17. writeDP 1 0
    18. readDP 1
    19. q
    20. -- runners.jlink: Flashing file: zephyrproject/zephyr/build/zephyr/zephyr.bin
    21. runners.jlink: /opt/SEGGER/JLink_V810g/JLinkExe -nogui 1 -if swd -speed auto -device XMC4500-1024 -CommanderScript /tmp/tmp5rexrq4xjlink/runner.jlink -nogui 1
    22. SEGGER J-Link Commander V8.10g (Compiled Nov 14 2024 08:47:22)
    23. DLL version V8.10g, compiled Nov 14 2024 08:46:17
    24. J-Link Command File read successfully.
    25. Processing script file...
    26. J-Link>ExitOnError 1
    27. J-Link Commander will now exit on Error
    28. J-Link>r
    29. J-Link connection not established yet but required for command.
    30. Connecting to J-Link via USB...O.K.
    31. Firmware: J-Link Lite-XMC4000 Rev.1 compiled Apr 2 2015 18:25:20
    32. Hardware version: V1.00
    33. J-Link uptime (since boot): N/A (Not supported by this model)
    34. S/N: 551019312
    35. VTref=3.300V
    36. Target connection not established yet but required for command.
    37. Device "XMC4500-1024" selected.
    38. Connecting to target via SWD
    39. Performing XMC4500 connection sequence.
    40. DPv0 detected
    41. CoreSight SoC-400 or earlier
    42. Scanning AP map to find all available APs
    43. AP[1]: Stopped AP scan as end of AP map has been reached
    44. AP[0]: AHB-AP (IDR: 0x24770011, ADDR: 0x00000000)
    45. Iterating through AP map to find AHB-AP to use
    46. AP[0]: Core found
    47. AP[0]: AHB-AP ROM base: 0xE00FF000
    48. CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
    49. Found Cortex-M4 r0p1, Little endian.
    50. FPUnit: 6 code (BP) slots and 2 literal slots
    51. CoreSight components:
    52. ROMTbl[0] @ E00FF000
    53. [0][0]: E000E000 CID B105E00D PID 000BB00C SCS-M7
    54. [0][1]: E0001000 CID B105E00D PID 003BB002 DWT
    55. [0][2]: E0002000 CID B105E00D PID 002BB003 FPB
    56. [0][3]: E0000000 CID B105E00D PID 003BB001 ITM
    57. [0][4]: E0040000 CID B105900D PID 000BB9A1 TPIU
    58. [0][5]: E0041000 CID B105900D PID 000BB925 ETM
    59. Memory zones:
    60. Zone: "Default" Description: Default access mode
    61. Cortex-M4 identified.
    62. Reset delay: 0 ms
    63. Performing XMC4500 reset
    64. J-Link>LE
    65. J-Link>loadfile "zephyrproject/zephyr/build/zephyr/zephyr.bin" 0xc000000
    66. 'loadfile': Performing implicit reset & halt of MCU.
    67. Performing XMC4500 reset
    68. Downloading file [zephyrproject/zephyr/build/zephyr/zephyr.bin]...
    69. Comparing flash [100%] Done.
    70. Erasing flash [100%] Done.
    71. Programming flash [100%] Done.
    72. J-Link: Flash download: Bank 0 @ 0x0C000000: 1 range affected (65536 bytes)
    73. J-Link: Flash download: Total: 1.850s (Prepare: 0.087s, Compare: 0.047s, Erase: 1.382s, Program & Verify: 0.286s, Restore: 0.046s)
    74. J-Link: Flash download: Program & Verify speed: 224 KB/s
    75. O.K.
    76. J-Link>r
    77. Reset delay: 0 ms
    78. Performing XMC4500 reset
    79. J-Link>g
    80. Memory map 'after startup completion point' is active
    81. J-Link>writeDP 1 0
    82. Writing DP register 1 = 0x00000000 (0 write repetitions needed)
    83. J-Link>readDP 1
    84. Reading DP register 1 = 0x00000040 (0 read repetitions needed)
    85. J-Link>q
    86. Script processing completed.
    Display All
    Non working case

    If I immediately repeat the flashing, it fails (seems it cannot find the JLink):

    Source Code

    1. west -v flash
    2. -- west flash: rebuilding
    3. cmake version 3.22.1 is OK; minimum version is 3.13.1
    4. Running CMake: /usr/bin/cmake --build zephyrproject/zephyr/build
    5. ninja: no work to do.
    6. -- west flash: using runner jlink
    7. -- runners.jlink: reset after flashing requested
    8. runners.jlink: JLINKARM_GetDLLVersion()=81007
    9. -- runners.jlink: JLink version: 8.10g
    10. runners.jlink: JLink commander script:
    11. ExitOnError 1
    12. r
    13. LE
    14. loadfile "zephyrproject/zephyr/build/zephyr/zephyr.bin" 0xc000000
    15. r
    16. g
    17. writeDP 1 0
    18. readDP 1
    19. q
    20. -- runners.jlink: Flashing file: zephyrproject/zephyr/build/zephyr/zephyr.bin
    21. runners.jlink: /opt/SEGGER/JLink_V810g/JLinkExe -nogui 1 -if swd -speed auto -device XMC4500-1024 -CommanderScript /tmp/tmpuj2ufsvzjlink/runner.jlink -nogui 1
    22. SEGGER J-Link Commander V8.10g (Compiled Nov 14 2024 08:47:22)
    23. DLL version V8.10g, compiled Nov 14 2024 08:46:17
    24. J-Link Command File read successfully.
    25. Processing script file...
    26. J-Link>ExitOnError 1
    27. J-Link Commander will now exit on Error
    28. J-Link>r
    29. J-Link connection not established yet but required for command.
    30. Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
    31. Script processing completed.
    32. FATAL ERROR: command exited with status 1: /opt/SEGGER/JLink_V810g/JLinkExe -nogui 1 -if swd -speed auto -device XMC4500-1024 -CommanderScript /tmp/tmpuj2ufsvzjlink/runner.jlink -nogui 1
    Display All
    The error message `FAILED: Cannot connect to J-Link.` appears after a timeout of several seconds, however if I disconnect the USB cable it immediately fails. So it seems to try to establish a connection but that
    does not succeed.

    Thanks in advance for your help!