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

nrfjprog Not programming NRF52840 DK board

Hello everyone,

I am experiencing a weird problem; I am working on an NRF52840 DK board and writing my code in Segger Embedded Studio.

I do not have any problem when programming the board via the "Build and Run" commend in SES.

Since I wanted to write some UICR values in the memory when flashing the board, I tried programming the board using nrfjprog. 

And, to my surprise, the programming does not work! 

The command I used is the following

nrfjprog -f NRF52 --program myProgram.hex --chiperase

and the output I get from the system is the following 

Parsing hex file.
Erasing user available code and UICR flash areas.
Applying system reset.
Checking that the area to write is not protected.
Programming device.

I had the feeling that the programming was pretty fast.....and in fact, the program does not run (I have a logic analyzer connected to a GPIO which "pulses" periodically).

On the other hand, if I try to program the board from SES the program runs without any issue.

I already used the nrfjprog, though on an NRF52832, and I did not have any type of problem.

I am working under Linux Ubuntu 16.04, I updated to the latest nrfjprog (9,8,1) and to the latest JLinkARM.dll (6.44f).

I tried on two different boards, I tried a precompiled .hex example (blinky), but I still get the same behaviour.

Do you have any idea of what is going wrong here?

Alternatively, is there a way to write the UICR without using nrfjprog? 

Thanks for your help

  • nrfjprog uses JLink to target and flash nRFs

    If you use the command JLinkExe in a terminal (provided the command is callable from any directory), you can begin the manual connection to an nRF52. An example of this is shown below, I wrote .sh files like these to automate flashing our devices.

    #!/bin/bash
    JLinkExe << EOF
    connect
    NRF52832_XXAA
    S
    9600
    r
    h
    g
    qc
    EOF
    

    this should establish connection to a powered nRF52832 (try NRF52840_XXAA for the 840s). As this is for automated purposes its designed to run and exit once complete (simple device reset script), you need the manual approach.

    JLinkExe
    
    connect
    
    NRF52840_XXAA
    
    S
    
    9600

    From here you will see if connection ws established or not the Cortex. If it did connect try,

    r
    
    h
    
    erase
    
    loadfile yourhex.hex
    
    r
    
    h
    
    g

    All being well, you should have flashed your device.

Related