This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming error JLinkARM.dll CORESIGHT_WriteAPDPReg

Can someone tell me what these errors actually mean

JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -1. JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -102.

When programming a custom nRF52832 board using JLink.

I seem to intermittently get them, and no matter how many times I run nrfjprog --reset --f nRF52 it keeps giving the error

Strangely if I open in JFlash and try repeatedly to connect, after about 5 attempts the problem seems to resolve its self.

I'm wondering if this is a power supply problem ?

But knowing what the message means would be useful

Thanks

  • Hi Roger, could you run the nrfjprog command with the --log option and then attach the log to the question? Also which JLink version and nrfjprog are you using?

  • nrfjprog.exe --reset -f nrf52 --log

    nrfjprog verion 9.6.0
    --------------------------------------------------------------------------------
    FUNCTION: open_dll.
    FUNCTION: open_dll.
    FUNCTION: enum_emu_snr.
    FUNCTION: enum_emu_snr.
    FUNCTION: enum_emu_snr.
    FUNCTION: enum_emu_snr.
    FUNCTION: connect_to_emu_with_snr.
    FUNCTION: connect_to_emu_with_snr.
    FUNCTION: connect_to_emu_without_snr.
    FUNCTION: enum_emu_snr.
    Device "NRF52832_XXAA" selected.
    FUNCTION: read_device_version.
    FUNCTION: read_device_version.
    JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -1.
    JLinkARM.dll CORESIGHT_WriteAPDPReg returned error -102.
    FUNCTION: close_dll.
    FUNCTION: close_dll.
    

    JLink version is the one installed by nrftools, 6.16a

    But I tried older versions of the jlink DLL and had the same problem.

    What is the APDRP register ??

  • Update.

    I have changed the code which is running on the board, to the beacon example (Hex file for the PCA10040) to rule out something in my code, but I get the same problem.

    There seems to be some difference between what JFlash does to connect and what nrfjprog does, because I can run nrfjprog over and over again, to reset the nRF52 and it never connects

    However if I run JFlash it seems to connect after a few attempts.

    Then once JFlash has successfully connected I can run nrfjprog over and over again, and it works OK.

    But after a few minutes of not interacting with the board, nrfjprog fails to connect.

    I've checked the supply voltage and its 3.3V, so I don't think its a supply voltage issue.

    I could be a supply noise issue, but get the same problem when its running from its internal lipo cell (via a regulator), but I will look at the 3.3V with a scope to check for noise

  • I discussed this with one of our toolchain engineers and its hard to say what exactly the issue is since the -1 and -102 are generic error codes returned by the JLinkARM dll for which Segger's documentation offers no specific explanation other than that an error has occurred. Have you tried recovering the chip, i.e. nrfjprog.exe -f nrf52 --recover? In a similar case, here is the link, it turned out that there was a HW issue with the board. Do you have another custom board that you can try to program ?

  • Thanks

    I think I already tried "nrfjprog.exe -f nrf52 --recover" but it didn't work, but I will try again.

    I am now using a different SWD programmer board and it works OK, but I know the JLink works with other boards.

    So the problem is probably somewhere on the custom board.

    I will attach a logic analyser and a scope to the SWD pins and see if I can see a difference between the signals from the JLink and the other programmer.

    Thanks again

    Roger

Related