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

Programming nRF52 DK using nrfjprog is not working

Hi

I have the nRF52 Development kit and I can program it using SEGGER Embedded Studio IDE without problems. However, when I try to program it using nrfjprog, the Dk doesn't work!

For example, when I build and run the "blinky" example (examples\peripheral\blinky\pca10040\s132\ses) using the SES IDE, I find that the LEDs on the DK are blinking successfully. 

But, when I try to program the DK using nrfjprog with the HEX file in this directory (C:\Nordic_Semi\nRF5_SDK_15.3.0_59ac345\examples\peripheral\blinky\pca10040\s132\ses\Output\Release\Exe\blinky_pca10040_s132.hex), then the DK does nothing and the LEDs are off!!

I'm using the following commands:

>nrfjprog -e -f nrf52

>nrfjprog --program blinky_pca_10040_s132.hex -f nrf52

>nrfjprog --reset -f nrf52

This is a screenshot of the commands I'm running

Parents
  • Hi.

    The reason it is not working is because you have not programmed anything that tells the device where the Application start.

    If you take a look at this screenshot:

    The left side is what Segger Embedded Studio programmed, and the right side is what you programmed with nrfjprog.

    Segger Embedded Studio is preconfigured to program the SoftDevice, which contains the Master Boot Record (MBR).

    The SoftDevice and MBR occupies the memory range from 0x0 to 0x26000 for S132 v6.1.1, while Application starts at 0x26000 (0x1000 if you only have MBR).

    The device will always start on address 0x0 and execute that instruction, so when that memory area is empty nothing happens.

    So to fix this, you  have to program either the SoftDevice or the MBR, which are found in the folders:

    MBR folder: nRF5_SDK_15.3.0_59ac345\components\softdevice\mbr\nrf52832\hex

    SoftDevice folder: nRF5_SDK_15.3.0_59ac345\components\softdevice\s132\hex

    Depending on which you choose to use, you have to set the correct start addresses for the Application

    The picture below shows the addresses for MBR on left and SoftDevice on the right:

    There are already example projects for blinky with these settings in:

    nRF5_SDK_15.3.0_59ac345\examples\peripheral\blinky\pca10040\s132\ses (SoftDevice example)

    nRF5_SDK_15.3.0_59ac345\examples\peripheral\blinky\pca10040\mbr (MBR example)

    So just program the device with either the SoftDevice or the MBR, and make sure that the start addresses are correct.

    Best regards,

    Andreas

Reply
  • Hi.

    The reason it is not working is because you have not programmed anything that tells the device where the Application start.

    If you take a look at this screenshot:

    The left side is what Segger Embedded Studio programmed, and the right side is what you programmed with nrfjprog.

    Segger Embedded Studio is preconfigured to program the SoftDevice, which contains the Master Boot Record (MBR).

    The SoftDevice and MBR occupies the memory range from 0x0 to 0x26000 for S132 v6.1.1, while Application starts at 0x26000 (0x1000 if you only have MBR).

    The device will always start on address 0x0 and execute that instruction, so when that memory area is empty nothing happens.

    So to fix this, you  have to program either the SoftDevice or the MBR, which are found in the folders:

    MBR folder: nRF5_SDK_15.3.0_59ac345\components\softdevice\mbr\nrf52832\hex

    SoftDevice folder: nRF5_SDK_15.3.0_59ac345\components\softdevice\s132\hex

    Depending on which you choose to use, you have to set the correct start addresses for the Application

    The picture below shows the addresses for MBR on left and SoftDevice on the right:

    There are already example projects for blinky with these settings in:

    nRF5_SDK_15.3.0_59ac345\examples\peripheral\blinky\pca10040\s132\ses (SoftDevice example)

    nRF5_SDK_15.3.0_59ac345\examples\peripheral\blinky\pca10040\mbr (MBR example)

    So just program the device with either the SoftDevice or the MBR, and make sure that the start addresses are correct.

    Best regards,

    Andreas

Children
  • Thank you so much for your help.

    Yes, I applied what you suggested and now the nrf52 DK is blinking from programming it using nrfjprog. 

    But I have a question to make sure that what I did is what is supposed to be done really. 

    First I went to the directory (C:\Nordic_Semi\nRF5_SDK_15.3.0_59ac345\components\softdevice\s132\hex) from the CMD and entered the command:

    > nrfjprog -f nrf52 --chiperase --program s132_nrf52_6.1.1_softdevice.hex --reset --verify 

    Second, I went to the directory (C:\Nordic_Semi\nRF5_SDK_15.3.0_59ac345\examples\peripheral\blinky\pca10040\s132\ses\Output\Release\Exe) from the CMD and entered the command:

    > nrfjprog -f nrf52  --program blinky_pca10040_s132.hex --reset --verify 

    And after that, I found the nRF52 DK is blinking.

     

    The question is, Is what I've done is the right thing?

    Also, do I have to go the directory of the SoftDevice and flash it then I go to the directory of my Application to flash it next every time I need to flash a code to the nRF52 DK?

    is there an easier and faster way?

Related