[SOLVED] J-Link Edu Mini failed to connect to target (Cortex-M4) from IDE using SWD

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

  • [SOLVED] J-Link Edu Mini failed to connect to target (Cortex-M4) from IDE using SWD

    Hi,
    I purchased a J-Link Edu Mini probe to be able to debug code deployed to an Acconeer XM122/XB122 board (which contains a Cortex-M4 processor - NordicSemi's nRF 52840 SoC and a JTAG/SWD header to communicate with it). I am using SEGGER's Embedded Studio as my IDE. When I debug from the IDE, it says it "Failed to connect to target".


    The Jlink commander utility however is able to correctly connect (from Windows command prompt) using this command line "C:\Program Files\SEGGER\JLink>.\JLink.exe -device Cortex-M4 -if SWD -speed 2025" (initially I tried the default speed 4000 but it lowered it to 2025). The command line has the output shown below


    C:\Program Files\SEGGER\JLink>.\JLink.exe -device Cortex-M4 -if SWD -speed 4000
    SEGGER J-Link Commander V7.92a (Compiled Aug 16 2023 15:35:45)
    DLL version V7.92a, compiled Aug 16 2023 15:34:08


    Connecting to J-Link via USB...O.K.
    Firmware: J-Link EDU Mini V1 compiled Jul 31 2023 12:03:29
    Hardware version: V1.00
    J-Link uptime (since boot): 0d 00h 00m 24s
    S/N: 801047634
    License(s): FlashBP, GDB
    USB speed mode: Full speed (12 MBit/s)
    VTref=1.797V



    Type "connect" to establish a target connection, '?' for help
    J-Link>connect
    Device "CORTEX-M4" selected.



    Connecting to target via SWD
    Failed to attach to CPU. Trying connect under reset.
    Found SW-DP with ID 0x2BA01477
    SWD speed too high. Reduced from 4000 kHz to 2025 kHz for stability
    DPIDR: 0x2BA01477
    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]: JTAG-AP (IDR: 0x02880000)
    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
    Memory zones:
    Zone: "Default" Description: Default access mode

    Cortex-M4 identified.


    How do I go about making the IDE also use whatever options the Jlink Commander Utilty used to make it correctly communicate with the Cortex-M4 processor?


    Thanks,

    Neal
  • [Solved] J-Link Edu Mini failed to connect to target (Cortex-M4) from IDE using SWD

    Answering my own question: "How do I go about making the IDE also use whatever options the Jlink Commander Utilty used to make it correctly communicate with the Cortex-M4 processor?"

    In Segger Embedded Studio, I simply went to Project Options -> Debug -> J-Link and in there I set speed to 2025 (essentially what the commander utility had told me to do). And then the connection works fine :)