[SOLVED] Cannot connect to board after erase!

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

  • [SOLVED] Cannot connect to board after erase!

    Hi, I'm trying to connect to a NXP MK64FN1M0VLQ12 after issuing it a erase command. The response from the board is as follows -


    Device "MK64FN1M0XXX12" selected.


    Connecting to target via JTAG
    InitTarget()
    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 was not unsecured. No action performed.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
    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: 0x001C0000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
    AP[1]: Skipped. Not an AHB-AP
    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: 0x001C0000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
    AP[1]: Skipped. Not an AHB-AP
    InitTarget()
    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 was not unsecured. No action performed.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP

    ****** Error: Could not find core in Coresight setup
    InitTarget()
    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 was not unsecured. No action performed.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
    InitTarget()
    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 was not unsecured. No action performed.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
    Cannot connect to target.




    I know that the board can be reprogrammed since it work with another programmer but I'm unsure of what command I need to issue to bypass this readout protection that seems to be stopping me. I am using a Jlink base with the segger j-link 19-pin cortex-m adapter.
  • Hello,

    Thank you for your inquiry.
    The Flash protection bytes will be set if you erase the Flash to all 0xFF (quite an inconvenient default by NXP).
    To unlock your device you can use J-Link commander and type "unlock kinetis". However for this to work the reset pin of the target device must be connected to J-Link.
    When working with Kinetis devices J-Link will offer you two different device names for each Kinetis device. One with "allow security" and one without. For debugging purposes we recommend using the ones without so no accidental locking of the target device can happen.

    EDIT: Additionally it seems that the unlock prompt has at some point have been disabled by you. How to show it again is explained here:
    wiki.segger.com/Kinetis_Series…s#Secured_device_detected

    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.
  • I figured that I would need to use the Unlock command somehow to achieve what I wanted but I didn't realized i had disabled that prompt I will try enabling it and see if that helps.

    I am using the Segger J-Link 19-pin Cortex-M Adapter though and I just realized on the product page its states : By default, TRST is not connected, but the Cortex-M Adapter comes with a solder bridge (NR1) which allows TRST to be connected to pin 9 of the Cortex-M adapter.

    Is this why the unlock command is not currently working? If so how can i locate this solder bridge to make the necessary connections?

    Thank You.

    Edit: After changing the settings to show unlock prompt I selected to unlock the device and was met with the following response :

    Device "MK64FN1M0XXX12" selected.


    Connecting to target via JTAG
    InitTarget()
    Device will be unsecured now.
    Timeout while halting CPU.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
    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: 0x001C0000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
    AP[1]: Skipped. Not an AHB-AP
    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: 0x001C0000)
    Iterating through AP map to find AHB-AP to use
    AP[0]: Skipped. Invalid implementer code read from CPUIDVal[31:24] = 0x00
    AP[1]: Skipped. Not an AHB-AP
    InitTarget()
    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.
    Timeout while halting CPU.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP

    ****** Error: Could not find core in Coresight setup
    InitTarget()
    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.
    Timeout while halting CPU.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
    InitTarget()
    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.
    Timeout while halting CPU.
    TotalIRLen = 4, IRPrint = 0x01
    JTAG chain detection found 1 devices:
    #0 Id: 0x4BA00477, IRLen: 04, CoreSight JTAG-DP
    Cannot connect to target.


    It seems jlink is still encountering a problem unlocking the device, is it possible this is because the TRST is not connected on the adapter I am using?

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

  • Hello,

    We received your inquiry per ticket system as well.
    Could you try to keep information together in one communication channel for future inquires to make sure no information gets lost?

    To answer the solder bride question for all that stumble upon this thread:
    There is only one solder bridge on the adapter. Simply close that.

    We tried to reproduce the issue with a FRDM-K64F eval board and indeed unlock is not working when selecting JTAG as interface.
    With SWD everything was working as expected (see attached image).
    We will investigate this further and see if unlock can be enabled for JTAG as well. For now we suggest using SWD instead.

    Could you verify that it works when using SWD?


    EDIT:
    It is working with JTAG as well. The issue was related to the JTAG interface design of the FRDM-K64F board.
    We retested it with a TWR-K64F120M eval board and there both interfaces were able to unlock the target device. See attached image.
    Closing the solder bridge on the adapter board will not make a difference as nRESET is used for resetting not TRST:
    segger.com/products/debug-prob…gy/interface-description/

    Should unlocking still not work we recommend comparing your board design with the TWR-K64F120M eval board and see if you see any differences between their JTAG board design and yours.


    Best regards,
    Nino
    Images
    • Capture.PNG

      65.18 kB, 677×1,242, viewed 729 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.
  • After checking my Jtag connection it seems to be the same as the TWR-K64F120M eval board and i am able to unlock the board using another programmer from this safe state and then program with the jtag programmer. Is there any other command i may be over looking that could address this issue?
    why is it that after issuing a erase command and resetting my board I am receiving an - Error: Could not find core in Coresight setup

    Thank you for your help is seems that the pinout on my board was different as the nRESET that is located on my board is not pin 10 as it is on the standard eval boards. In order to get the system to reconnect and unlock the board I simply had to hold down the physical reset button on the board while issuing the Connect command in J-Link commander.

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

  • Hello,

    Great to hear that you are up and running again.
    This thread will be closed 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.