[SOLVED] JLink not connecting to NXP K20 ( DAP error reading ... )

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

  • [SOLVED] JLink not connecting to NXP K20 ( DAP error reading ... )

    I am having some trouble connecting to some new hardware with a NXP K20, Cortex-M4 core. The problem is observed both in the debugger window of Kinetis Design Studio, and in the JLink Commander window. The debugger error message says that it can't start the GDB server because it can't connect to the target due to a DAP error reading the DP-Ctrl-Stat register. The JLink Commander window output is posted below. I can use the command "erase Kinetis" and it says OK, but the result does not change.

    This is in SWD mode. It does not get as far if trying to use the Jtag mode. There it tries to connect under reset but then times out while halting CPU. The part is brand new and has never been programmed.

    What can I try next ?



    SEGGER J-Link Commander V6.40 (Compiled Oct 26 2018 15:06:29)
    DLL version V6.40, compiled Oct 26 2018 15:06:02
    Connecting to J-Link via USB...O.K.
    Firmware: J-Link Ultra V4 compiled Oct 26 2018 12:04:46
    Hardware version: V4.00
    S/N: xxxxxxxx
    License(s): RDI, FlashBP, FlashDL, JFlash, GDB
    VTref=3.339V

    Type "connect" to establish a target connection, '?' for help
    J-Link>connect
    Please specify device / core. <Default>: MK20DX256XXX7
    Type '?' for selection dialog
    Device>
    Please specify target interface:
    J) JTAG (Default)
    S) SWD
    T) cJTAG
    TIF>s
    Specify target interface speed [kHz]. <Default>: 4000 kHz
    Speed>
    Device "MK20DX256XXX7" selected.

    Connecting to target via SWD
    InitTarget()
    Connect Under Reset
    Protection bytes in flash at addr. 0x400 - 0x40F indicate that readout protection is set.
    For debugger connection the device needs to be unsecured.
    Note: Unsecuring will trigger a mass erase of the internal flash.
    Executing default behavior previously saved in the registry.
    Device will be unsecured now.
    Found SW-DP with ID 0x2BA01477
    InitTarget()
    Connect Under Reset
    Protection bytes in flash at addr. 0x400 - 0x40F indicate that readout protection is set.
    For debugger connection the device needs to be unsecured.
    Note: Unsecuring will trigger a mass erase of the internal flash.
    Executing default behavior previously saved in the registry.
    Device will be unsecured now.
    Found SW-DP with ID 0x2BA01477
    ****** Error: DAP error while reading DP-Ctrl-Stat register.
    InitTarget()
    Connect Under Reset
    Protection bytes in flash at addr. 0x400 - 0x40F indicate that readout protection is set.
    For debugger connection the device needs to be unsecured.
    Note: Unsecuring will trigger a mass erase of the internal flash.
    Executing default behavior previously saved in the registry.
    Device will be unsecured now.
    Found SW-DP with ID 0x2BA01477
    InitTarget()
    Connect Under Reset
    Protection bytes in flash at addr. 0x400 - 0x40F indicate that readout protection is set.
    For debugger connection the device needs to be unsecured.
    Note: Unsecuring will trigger a mass erase of the internal flash.
    Executing default behavior previously saved in the registry.
    Device will be unsecured now.
    Found SW-DP with ID 0x2BA01477
    Cannot connect to target.
    J-Link>

    The post was edited 1 time, last by gpontis ().

  • Hello,

    Thank you for your inquiry.
    The issue with Kinetis device series is that Freescale decided back then to put lock bits randomly in Flash at 0x400-0x40F.
    This area must be taken care of otherwise the device could be read/write protected or worst case permanently locked.
    If you now erase the target device the Flash protection field will be filled with 0xFF which will enable read protection.
    J-Link will now try to disable the protection on connect.
    However this will only work if the reset line is connected from J-Link to target interface.
    Is this the case with your hardware?
    Attached you can find a connect session with SWD and JTAG on a XTWR-K20D72M eval board and both are working.

    If you now erase the chip and try to connect after a power on reset you should be prompted by the warning in the second attached picture.
    Simply select yes. If the reset pin is connected correctly you should get a successful connect.
    If you get no pop up see here: wiki.segger.com/Kinetis_Series…s#Secured_device_detected


    Should this still not work we suggest comparing your board schematics with the connections on the eval board and see if there are any differences visible.


    Best regards,

    Nino
    Images
    • Capture.PNG

      54.42 kB, 677×978, viewed 683 times
    • warning.png

      10.88 kB, 672×202, viewed 554 times
    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.
  • Thanks so much for a prompt response and the suggestion to check the hardware connections. I found that the nRESET line was connected, but pin 9 of the 10 pin debug connector was hooked to EZP_CS_b. With that grounded it must have been putting the chip into EZ programming mode. I cut the wire to pin 9 and it works like a champ.
  • Hello,

    Great to hear that you are up and running again.
    This thread will be marked as solved now.

    Best regards,
    Nino
    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.