Programming nRF9160 with DAPLink programmer

I am attempting to program/debug an nRF9160 with a CMSIS-DAP programming adapter (not a Segger JLink adapter). Debugging seems to be fully functional. However, any attempts at programming the device are unsuccessful and the tools I use are ARM Cortex M33/ARMv8 aware. I've tried using Keil's Mbed (uVision) and pyOCD. Both debug with full functionality. In terms of programming the device, neither tool works. I have been able to erase the chip by manually manipulating the correct registers. I've also been on the pyOCD forum and I'm told that the algorithm used by Nordic to erase/program the nRF9160 may be the problem. 

I've attempted these activities on three boards: nRF9160DK, Thingy:91, my own board.

Please advise.

Thanks,

Johnas

Parents
  • Fyi, pyocd v0.35 was just released that includes several fixes and improvements by Nordic (thanks!) that solve the nRF9160 programming issues. I'm able to successfully program flash with both sector and chip erases.

    https://github.com/pyocd/pyOCD/releases/tag/v0.35.0

  • Hi, I'm trying to find a way to flash nrf9160 (app and net cores) without JLink probe. Can you suggest some CMSIS-DAP programmer?

    I wonder if I will be able to use e.g. STLink V2/V3, BlackMagicProbe or RPi Picoprobe to flash nrf91? If so, will I have to upload special firmware to the such probe?  

    Do you know if pyOCD is integrated with ZephyrRtos west-tool?

  • Definitely cannot use STLink—the firmware enforces use only with STM devices.

    BlackMagicProbe might work, not sure. It requires support on the probe for targets, and I'm not sure if nRF91 is supported. Check their list of supported targets

    RPi Picoprobe should work since it's just a generic CMSIS-DAP based debug probe. However, it doesn't have HS USB, and has a nonstandard SWD debug connector.

    My personal favourite is the NXP MCU-Link (US$15 Mouser US). It's also a generic CMSIS-DAP based probe, but with HS USB and standard Cortex 10 pin SWD header (as found on most nRF dev boards). Can run the open source DAPLink firmware (disclosure: I ported DAPLink to this board, and know the folks at NXP that created the board). Better than slightly cheaper probes that have FS USB and lack things like voltage translation.

    West does support pyocd. It requires some small amount of configuration in your CMakeLists.txt for boards that aren't already set up for it, but I haven't done this myself since I just run pyocd directly.

    Based the nrf52dk_nrf52832 board, something like this:

    board_runner_args(pyocd "--target=nrf9160_xxaa" "--frequency=4000000")
    include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
    (This is untried!) You'll need to install the nRF CMSIS-Pack: pyocd pack install nrf91
  • Thanks a lot, I will definitely try this!

    I just want to ask: will I be able to program the chip without DAPlink firmware, i.e. on the standard firmware, e.g. the probe from NXP that you recommended? Is it necessary to update the firmware for the programmer in each such solution?

Reply Children
  • Yes, you can use the standard MCU-Link firmware. It's just a non-open-source CMSIS-DAP implementation. The only downside is that I think it still uses CMSIS-DAPv1 (HID class), which has slightly higher latency than CMSIS-DAPv2 that uses bulk endpoints. But it works fine.

    Oh, and the standard MCU-Link firmware uses a proprietary interface for reading SWO that isn't compatible with CMSIS-DAP. (Or at least it still did last I looked.)

Related