Unable to flash custom nRF5340 board with nRF5340DK

Hello,

I am developing firmware for a custom board using the nRF5340. I have found that I am unable to flash the custom board when using the nRF5340DK as the JTAG device. I am able to flash successfully if I use a SEGGER JLink.

Some pertinent specs are:

  • Windows 11 PC
  • nRF Connect for Desktop v4.1.2
  • Programmer v3.0.9
  • nRF Command Line Tools 10.22.0
  • SEGGER JLink v7.88i

Here is a copy/paste of the log in the Programmer application when I try to flash using the nRF5340DK.

2023-06-27T17:13:40.567Z DEBUG Application data folder: C:\Users\USER\AppData\Roaming\nrfconnect\pc-nrfconnect-programmer
2023-06-27T17:13:40.661Z DEBUG App pc-nrfconnect-programmer v3.0.9 local
2023-06-27T17:13:40.661Z DEBUG App path: C:\Users\USER\.nrfconnect-apps\node_modules\pc-nrfconnect-programmer
2023-06-27T17:13:40.661Z DEBUG nRFConnect 4.1.2, required by the app is (>=4.0.0)
2023-06-27T17:13:40.661Z DEBUG nRFConnect path: C:\Users\USER\AppData\Local\Programs\nrfconnect\resources\app.asar
2023-06-27T17:13:40.662Z DEBUG HomeDir: C:\Users\USER
2023-06-27T17:13:40.662Z DEBUG TmpDir: C:\Users\USER\AppData\Local\Temp
2023-06-27T17:13:41.237Z INFO Installed JLink version does not match the provided version (V7.80c)
2023-06-27T17:13:41.324Z INFO Using nrf-device-lib-js version: 0.6.12
2023-06-27T17:13:41.325Z INFO Using nrf-device-lib version: 0.15.3
2023-06-27T17:13:41.325Z INFO Using nrfjprog DLL version: 10.19.1
2023-06-27T17:13:41.325Z INFO Using JLink version: JLink_V7.88i
2023-06-27T17:13:41.552Z INFO Getting serialport options from persistent store 001050039906.pc-nrfconnect-programmer
2023-06-27T17:13:45.706Z INFO Using @nordicsemiconductor/nrf-device-lib-js to communicate with target via JLink
2023-06-27T17:13:45.706Z INFO JLink OB firmware version J-Link OB-nRF5340-NordicSemi compiled Nov  7 2022 16:22:01
2023-06-27T17:13:45.707Z INFO Device family
2023-06-27T17:13:45.707Z INFO Device version
2023-06-27T17:13:45.707Z INFO Board version PCA10095
2023-06-27T17:13:45.707Z INFO Loading readback protection status for Application core
2023-06-27T17:13:46.041Z ERROR Failed to load readback protection status: async task failure for id: 1162544486 msg: [jlink] UNKNOWN_DEVICE (Origin: "Error when running  operation: protection-get")
2023-06-27T17:13:46.522Z DEBUG Google Analytics for category pc-nrfconnect-programmer has initialized

I then try to recover the device from the command line using nrfjprog and get this output:

C:\Users\USER>nrfjprog -f NRF53 --recover
Recovering device. This operation might take 30s.
[error] [SeggerBackend] - Encountered unexpected debug port ID 4, expected 6
[error] [  nRF53] - Failed while checking eraseprotect status.
ERROR: Recover failed. Please make sure that the correct device family is given
ERROR: and try again.
NOTE: For additional output, try running again with logging enabled (--log).
NOTE: Any generated log error messages will be displayed.

This error happens immediately. There are no additional messages if I add the --log option. I also get the same output if I run it with the --coprocessor CP_NETWORK option.

I found the following link and tried its suggestions for installing the 32-bit SEGGER drivers alongside the 64-bit drivers, but this did not solve my problem.

 RE: nRF Programmer cannot recognize nRF5340-DK (SEGGER JLink driver is newer than nRF Connect for Desktop version) 

I have tried separately installing and using both the 32-bit and 64-bit versions of the nRF Command Line Tools, but the results are the same.

Since I have seen other forum posts mention this, I should also mention that VDD for our board is 1.8V.

Would anybody be able to help look into this particular error? I would be happy to supply any other required information.

Thanks

  • Hi, 

    The problem is that the custom PCB is running 1.8V while the DK is running 3,3V. 

    What you can try to do is the following: 

    • Connect a usb to both J2 and NRF_USB
    • Switch from "VDD POWER" to "USB SOURCE" on SW9
    • Power up the DK
    • Enjoy 1.8V debugging

    If not I would put a level shifter between the DK and the custom PCB

    Regards

    Runar

  • Hi Runar,

    Thank you for your response. We tried the steps you outlined, but were still unsuccessful. We will be trying a level translator next.

  • Hi Runar,

    We revisited the steps you outlined and were successful with flashing our board. I am unsure where we went wrong previously, but the following specific sequence of steps works for us every time:

    • Start with the nRF5340DK board unpowered and unconnected to anything.
    • Set the nRF POWER SOURCE switch on the DK board to USB.
    • Connect our custom board to the Debug Out connection.
    • Power on our custom board.
    • Plug a USB cable into nRF USB connection and set the DK's POWER switch to ON.
    • Plug a USB cable into the J2 USB connector.

    From there the DK board was recognized as a JTAG device, and we were able to erase and flash our board as normal.

    Thanks for your help!

Related