Issue flashing firmware

Hello.

I have been successfully flashing the nrf52840 dongle using the nrfjprog comand. I have been successfully able to reset and erase as well. Recently however, none of my boards have been able to flash, erase or reset. Here is the error that it presents:

[error] [ Client] - Encountered error -5: Command read_device_info executed for 6 milliseconds with result -5

[error] [ Worker] - Encountered unexpected debug port ID 0, expected 2

[error] [ Client] - Encountered error -11: Command read_memory_descriptors executed for 2150 milliseconds with result -11

Failed to read device memories.

[error] [  nRF52] - Device memory generation failed.

[error] [ Worker] - Could not connect to CPU core. This may indicate that AP protection is enabled.

An unknown error.

ERROR: Cannot connect to any nRF device. Please make sure a device is

ERROR: connected to the debugger and supplied.

NOTE: For additional output, try running again with logging enabled (--log).

NOTE: Any generated log error messages will be displayed.

Any help will be appreciated.

Thanks.

  • Hi,

    I wonder if there is a problem with powering the nRF? Or that the regulator is back in 1.8 V which is the default? If so, please see the Using an external debugger in the nRF52840 Dongle Programming Tutorial, and particularily the last part, Recover after an accidental UICR erase.

  • Hello, thanks for getting back to me. I was using a J-Link EDU Mini to flash the boards. This had been working fine until it just stopped working with the dongles for some reason. I also have custom boards with the nRF52840 chipset which the EDU mini can still flash so it is very weird. I have managed to flash the boards however, I ended up using a J-Link Base Compact and was able to flash the boards successfully.

    Thanks for the assistance.

  • Hi Colby!

    It sounds like you’ve run into a common issue when working with the nRF52840 dongle. The error you’re seeing (unexpected debug port ID 0, expected 2 and Could not connect to CPU core) typically points to one of two main causes:

     1. Access Port (AP) protection enabled
    This happens when the device has had AP (Access Port) protection set, preventing further debug access. To fix this, you might need to use Recover mode instead of Erase.
    Try this command:

    css
    nrfjprog --recover -f nrf52 dummynation

    This will attempt to reset the device to a state where you can re-flash it.

     2. Hardware or connection issue
    Double-check:

    • Are your USB cables and connections reliable?

    • If using a debugger (like J-Link), is it firmly attached?

    • Try re-plugging the dongle or using a different USB port.

    • Consider updating your nrfjprog tool and SEGGER J-Link drivers.

    If the above doesn’t work, enable detailed logging for further insight:

    css
    nrfjprog --recover -f nrf52 --log

    This might show you more specific clues about what’s failing.

Related