J-Flash connection error. Failed to initialized DAP.

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

    • J-Flash connection error. Failed to initialized DAP.

      Hello everyone. I ran into a problem when using J-Link to program GD32H7 controllers.
      The fact is that I cannot connect to the controller using J-Flash until I connect using IAR, which also uses J-Link.
      I have fixed the J-Flash and IAR logs and I see that they have a slightly different connection process, but I do not know how to get J-Flash to use IAR logic.
      I will attach the recorded logs below. This happens with the GD32H759I-EVAL developer board, and also with the device that I made myself based on GD32H757ZMT6.

      J-Flash log before connecting using IAR
      Display Spoiler

      ...
      7637:028.864 Hardware: V9.60
      7637:028.864 S/N:
      7637:028.864 OEM: SEGGER
      7637:028.864 Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
      7637:036.032 Bootloader: (Could not read)
      7637:038.080 TELNET listener socket opened on port 19021
      7637:038.080 WEBSRV WEBSRV_Init(): Starting webserver thread(s)
      7637:038.080 WEBSRV Webserver running on local port 19080
      7637:038.592 Looking for J-Link GUI Server exe at: C:\SE_DevTools\SEGGER\JLink_V798c\JLinkGUIServer.exe
      7637:038.592 Forking J-Link GUI Server: C:\SE_DevTools\SEGGER\JLink_V798c\JLinkGUIServer.exe
      7637:064.704 J-Link GUI Server info: "J-Link GUI server V7.98c "
      7637:066.752 - 50.330ms returns "O.K."
      7637:066.752 JLINK_GetFirmwareString(...)
      7637:066.752 - 0.022ms
      7637:066.752 JLINK_GetSN()
      7637:066.752 - 0.021ms returns
      7637:067.264 JLINK_TIF_Select(JLINKARM_TIF_SWD)
      7637:068.288 - 1.229ms returns 0x00
      7637:068.288 JLINK_EMU_GetProductId()
      7637:068.800 - 0.025ms
      7637:068.800 JLINK_CORE_Select(0xE0100FF == Cortex-M7)
      7637:068.800 - 0.024ms
      7637:068.800 JLINK_ExecCommand("Device = GD32H759IMK6", ...).
      7637:072.384 Flash bank @ 0x08000000: SFL: Parsing sectorization info from ELF file
      7637:072.384 FlashDevice.SectorInfo[0]: .SectorSize = 0x00001000, .SectorStartAddr = 0x00000000
      7637:072.384 FlashBank @0x08000000: Sectorization info from SFL ELF file ignored because sectorization override from DLL / XML file is active.
      7637:072.384 Device "GD32H759IMK6" selected.
      7637:074.944 - 5.734ms returns 0x00
      7637:074.944 JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).
      7637:074.944 - 0.001ms returns 0x00
      7637:074.944 JLINK_ExecCommand("SetEnableMemCache 0", ...).
      7637:074.944 - 0.001ms returns 0x01
      7637:074.944 JLINK_ExecCommand("SetAllowFlashCache 0", ...).
      7637:074.944 - 0.000ms returns 0x01
      7637:074.944 JLINK_GetAvailableLicense()
      7637:075.456 - 1.205ms returns 0x05
      7637:076.480 JLINK_SetEndian(ARM_ENDIAN_LITTLE)
      7637:076.480 - 0.023ms returns 0
      7637:076.480 JLINK_SetSpeed(4000)
      7637:076.480 - 0.291ms
      7637:076.480 JLINK_GetSpeed()
      7637:076.480 - 0.020ms returns 4000
      7637:076.480 JLINK_GetHWStatus(...)
      7637:076.480 - 0.300ms returns 0
      7637:076.480 JLINK_Connect()
      7637:076.992 ConfigTargetSettings() start
      7637:076.992 J-Link Script File: Executing ConfigTargetSettings()
      7637:076.992 ConfigTargetSettings() end - Took 26us
      7637:076.992 InitTarget() start
      7637:076.992 J-Link Script File: Executing InitTarget()
      7637:182.976 Error: Failed to initialized DAP.
      7637:182.976 InitTarget() end - Took 105ms
      7637:256.704 ConfigTargetSettings() start
      7637:256.704 J-Link Script File: Executing ConfigTargetSettings()
      7637:256.704 ConfigTargetSettings() end - Took 26us
      7637:256.704 InitTarget() start
      7637:256.704 J-Link Script File: Executing InitTarget()
      7637:259.264 Error: Failed to initialized DAP.
      7637:259.264 InitTarget() end - Took 2.73ms
      7637:259.776 - 182.756ms returns 0xFFFFFFFF
      7637:268.992 JLINK_Close()
      7637:274.624 - 5.493ms
      7637:274.624
      7637:274.624 Closed


      IAR log
      Display Spoiler

      6000:293.247 Hardware: V9.60
      6000:293.289 S/N:
      6000:293.319 OEM: SEGGER
      6000:293.347 Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
      6000:294.644 Bootloader: (Could not read)
      6000:296.051 TELNET listener socket opened on port 19021
      6000:296.320 WEBSRV WEBSRV_Init(): Starting webserver thread(s)
      6000:296.451 WEBSRV Webserver running on local port 19080
      6000:296.666 Looking for J-Link GUI Server exe at: C:\SE_DevTools\IAR Systems\Embedded Workbench 8.2\arm\bin\JLinkGUIServer.exe
      6000:297.117 Looking for J-Link GUI Server exe at: \JLinkGUIServer.exe
      6000:597.481 Failed to connect to J-Link GUI Server.
      6000:603.858 - 318.769ms returns "O.K."
      6000:607.798 JLINK_ExecCommand("ProjectFile = C:\SE_DevTools\Demo&Lib\GD32H7xx_Demo_Suites_V1.1.0\GD32H759I_EVAL_Demo_Suites\Projects\01_GPIO_Running_LED\EWARM\settings\GD32H759I_EVAL_GD32H7xx.jlink", ...).
      6000:636.732 Ref file found at: C:\SE_DevTools\IAR Systems\Embedded Workbench 8.2\arm\bin\JLinkDevices.ref
      6000:637.154 XML referenced by ref file: C:\SE_DevTools\SEGGER\JLink\JLinkDevices.xml
      6000:638.508 C:\SE_DevTools\SEGGER\JLink\JLinkDevices.xml evaluated successfully.
      ...
      6001:077.592 - 469.961ms returns 0x00
      6001:077.996 JLINK_ExecCommand("device = GD32H759xM", ...).
      6001:085.366 - 7.324ms returns 0xFFFFFFFF
      6001:085.470 JLINK_GetDLLVersion()
      6001:085.584 - 0.112ms returns 79203
      6001:085.638 JLINK_GetCompileDateTime()
      6001:085.679 - 0.040ms
      6001:085.745 JLINK_GetFirmwareString(...)
      6001:085.795 - 0.050ms
      6001:085.907 JLINK_TIF_Select(JLINKARM_TIF_SWD)
      6001:087.225 - 1.318ms returns 0x00
      6001:087.290 JLINK_SelectDeviceFamily(14)
      6001:087.675 - 0.384ms
      6001:087.751 JLINK_SetSpeed(1000)
      6001:087.953 - 0.201ms
      6001:087.996 JLINK_SetResetType(JLINKARM_RESET_TYPE_NORMAL)
      6001:088.075 - 0.079ms returns JLINKARM_RESET_TYPE_NORMAL
      6001:088.120 JLINK_ExecCommand("SetResetPulseLen = 200", ...).
      6001:088.157 - 0.001ms returns 0x14
      6001:088.191 JLINK_SetResetDelay(0)
      6001:088.218 - 0.026ms
      6001:088.245 JLINK_ResetPullsRESET(ON)
      6001:088.325 - 0.080ms
      6001:088.367 JLINK_Reset()
      6001:090.564 Found SW-DP with ID 0x0BD12477
      6001:095.577 DPIDR: 0x0BD12477
      6001:095.637 CoreSight SoC-400 or earlier
      6001:095.749 Scanning AP map to find all available APs
      6001:097.009 AP[1]: Stopped AP scan as end of AP map has been reached
      6001:097.085 AP[0]: AHB-AP (IDR: 0x04770041)
      6001:097.332 Iterating through AP map to find AHB-AP to use
      6001:098.909 AP[0]: Core found
      6001:098.963 AP[0]: AHB-AP ROM base: 0xE00FD000
      6001:099.913 CPUID register: 0x411FC272. Implementer code: 0x41 (ARM)
      6001:100.794 Cache: L1 I/D-cache present
      6001:101.019 Found Cortex-M7 r1p2, Little endian.
      6001:101.774 -- Max. mem block: 0x00010C40
      ...


      J-Flash log after connecting using IAR
      Display Spoiler

      ...
      7769:901.568 Hardware: V9.60
      7769:901.568 S/N:
      7769:901.568 OEM: SEGGER
      7769:901.568 Feature(s): RDI, GDB, FlashDL, FlashBP, JFlash
      7769:907.200 Bootloader: (Could not read)
      7769:908.736 TELNET listener socket opened on port 19021
      7769:908.736 WEBSRV WEBSRV_Init(): Starting webserver thread(s)
      7769:908.736 WEBSRV Webserver running on local port 19080
      7769:909.760 Looking for J-Link GUI Server exe at: C:\SE_DevTools\SEGGER\JLink_V798c\JLinkGUIServer.exe
      7769:909.760 Forking J-Link GUI Server: C:\SE_DevTools\SEGGER\JLink_V798c\JLinkGUIServer.exe
      7769:935.872 J-Link GUI Server info: "J-Link GUI server V7.98c "
      7769:938.944 - 50.088ms returns "O.K."
      7769:938.944 JLINK_GetFirmwareString(...)
      7769:938.944 - 0.044ms
      7769:938.944 JLINK_GetSN()
      7769:938.944 - 0.043ms returns
      7769:939.968 JLINK_TIF_Select(JLINKARM_TIF_SWD)
      7769:940.992 - 1.256ms returns 0x00
      7769:940.992 JLINK_EMU_GetProductId()
      7769:940.992 - 0.023ms
      7769:941.504 JLINK_CORE_Select(0xE0100FF == Cortex-M7)
      7769:941.504 - 0.024ms
      7769:941.504 JLINK_ExecCommand("Device = GD32H759IMK6", ...).
      7769:944.064 Flash bank @ 0x08000000: SFL: Parsing sectorization info from ELF file
      7769:945.088 FlashDevice.SectorInfo[0]: .SectorSize = 0x00001000, .SectorStartAddr = 0x00000000
      7769:945.088 FlashBank @0x08000000: Sectorization info from SFL ELF file ignored because sectorization override from DLL / XML file is active.
      7769:945.088 Device "GD32H759IMK6" selected.
      7769:947.136 - 5.910ms returns 0x00
      7769:947.136 JLINK_ExecCommand("ExcludeFlashCacheRange 0x0-0xFFFFFFFF", ...).
      7769:947.136 - 0.001ms returns 0x00
      7769:947.136 JLINK_ExecCommand("SetEnableMemCache 0", ...).
      7769:947.136 - 0.000ms returns 0x01
      7769:947.136 JLINK_ExecCommand("SetAllowFlashCache 0", ...).
      7769:947.136 - 0.000ms returns 0x01
      7769:947.136 JLINK_GetAvailableLicense()
      7769:948.160 - 1.199ms returns 0x05
      7769:949.184 JLINK_SetEndian(ARM_ENDIAN_LITTLE)
      7769:949.184 - 0.022ms returns 0
      7769:949.184 JLINK_SetSpeed(4000)
      7769:949.184 - 0.305ms
      7769:949.184 JLINK_GetSpeed()
      7769:949.184 - 0.038ms returns 4000
      7769:949.184 JLINK_GetHWStatus(...)
      7769:949.696 - 0.380ms returns 0
      7769:949.696 JLINK_Connect()
      7769:950.720 ConfigTargetSettings() start
      7769:950.720 J-Link Script File: Executing ConfigTargetSettings()
      7769:950.720 ConfigTargetSettings() end - Took 23us
      7769:950.720 InitTarget() start
      7769:950.720 J-Link Script File: Executing InitTarget()
      7769:953.792 DAP initialized successfully.
      7769:954.816 No Protection is set.
      7769:954.816 InitTarget() end - Took 3.93ms
      7769:955.328 Found SW-DP with ID 0x0BD12477
      7769:959.424 DPIDR: 0x0BD12477
      7769:959.424 CoreSight SoC-400 or earlier
      7769:959.424 Scanning AP map to find all available APs
      7769:960.448 AP[1]: Stopped AP scan as end of AP map has been reached
      7769:960.448 AP[0]: AHB-AP (IDR: 0x04770041)
      7769:960.448 Iterating through AP map to find AHB-AP to use
      7769:961.984 AP[0]: Core found
      7769:961.984 AP[0]: AHB-AP ROM base: 0xE00FD000
      7769:963.008 CPUID register: 0x411FC272. Implementer code: 0x41 (ARM)
      7769:963.520 Cache: L1 I/D-cache present
      7769:963.520 Found Cortex-M7 r1p2, Little endian.
      7769:963.520 -- Max. mem block: 0x00010C40
      ...


      The controller remains available for J-Flash until the power is turned off, then IAR must be used again
    • I discovered an additional detail. I noticed that in .jlink file that uses IAR has the string Device="ARM7". I used J-Link Commander and tried to connect to my controllers as to ARM7, but I was offered the JTAG interface, which did not suit me, then I tried to connect to the Cortex-M7 and it worked! After that, J-Flash was also able to connect normally. This causes both joy and doubt, because I still don't understand how I can solve this problem.