[SOLVED] DAP error while reading aircr/cpuid register

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

  • [SOLVED] DAP error while reading aircr/cpuid register

    We are using J-Link Plus in SWD mode to debug the NXP MKL17Z128VLH4 controller. In order to boot the MKL17Z device from the flash we need to set the Flash Configuration area (0x00000400 - 0x0000040F) with some specific data. The IAR EWARM Ver7.6 provides an option to enable the flash config area using the argument "--enable_config_write " in the flash loader file settings. In code we have used IAR's #pragma location directive to place the configuration settings at flash config location "0x00000400". Now when I try to debug the code using J-Link Plus hardware I get following error:
    "DAP error while reading aircr/cpuid register" . But now if I de-select the flash loader file from the IAR WB debugger setup then the J-Link loads the .out file and enters the debug mode. But now since the "--enable_config_write " argument is not enabled (flash loader file is de-selected) the configuration settings are not written in the Flash. I am stuck since the device does not boot after the power cycle. Can anyone please help me understand the root cause of this issue?
  • Hi,

    do i understand you correctly that debugging in IAR using the J-Link Flashloaders works perfectly fine?

    In this case, only the mentioned Flash Configuration area needs to be set correctly.

    Option

    A) The configuration can be altered via memory mapped registers or is memory mapped. This can be done using J-Link Commander
    B) The configuration can be written to like normal the normal flash area. In this case, the Flash Configuration area (0x00000400 - 0x0000040F) can be included in the data file that is downloaded to the target device using J-Link.

    Both a) and b) can be done without using IAR EWARM, but you can also automate this by using OS-specifc script files (.bat / .sh) or J-Link command files, which then you let call by IAR EWARM.

    Best regards,
    Niklas
    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. Yes, the program can debug using the J-Link Flash loaders. I have never used the J-Link commander till date. Would it be possible for you to share the procedure to program the flash using the J-Link commander? Also please let me know how to resolve the J-Link error "DAP error while reading aircr/cpuid register" which I get when I enable the Flash loader in IAR.
  • Hi,

    J-Link commander is part of the J-Link software package, which is available free of charge here .

    • Start J-Link Commander (jlink.exe)
    • Type "connect" in order to start a debug session
    • Type in the target device name if asked (Or type "?" for a target selection Dialog)
    • Choose the correct target interface (JTAG/SWD/etc..)
    • Use a valid speed (Default: 4000kHz, try 100-500 if default does not work)
    • [JTAG only]JTAG conf can be default(most of the times)
    • You should now be successfully connected.
    If anything fails, could you post a screenshot of the complete session?

    At this point, you can access memory mapped registers using mem32 (read) and w4 (write).
    If you type a command without parameters J-Link Commander will post the Syntax.
    Also, all commands are listed in UM8001 (also in the package, in the "Doc" folder)

    Please consult the reference manual of your target device in order to find out whether (and how) the Flash Configuration area (0x00000400 - 0x0000040F) can be accessed as a memory mapped register or "Flash".

    Best regards,
    Niklas
    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.
  • Hi,


    J-Link commander can write to Flash, but only by passing a .bin/.hex/.srec etc. file to it using the loadfile command.
    Since you do own a J-Link Plus, you can use J-Flash to do this. (also part of the software package)

    Just start J-Flash (empty project), select your device in the project settings, Read back to entire chip, adjust the Flash Configuration area and download to altered data file again.
    This can also be autotomized with using J-Flash with command line parameters.

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