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

Hex file flashing using cli on to the NRF52840 target board.

Hello 

I'm using the  nrf52840 DK with sdk version of 15.0.0.

My requirement is to flash my project through cli commands, so I have followed the following steps in below.

1) For my project I have used the ble_app_freertos example project.

2) Then Executed the "MAKE" command at the following location where the makefile.txt is located. "C:\nRF5_SDK_15.0.0_a53641a\examples\ble_peripheral\ble_app_hrs_freertos\pca10056\s140\armgcc"

3) After a successful build process a "_build" folder will be generated at the same location, that folder comprises of generated file like below.

   a) nrf52840_xxaa.bin

   b) nrf52840_xxaa.hex

  c)  nrf52840_xxaa.in

  d) nrf52840_xxaa.out

  e) nrf52840_xxaa.map

4) Now I will change directory to the "_build" folder, then I executed the following commands

 "nrfjprog -f NRF52 --program nrf52840_xxaa.hex --chiperase"   to dump the hex file into nrf52840 DK.

"nrfjprog -f nrf52 --reset" for resetting the device.

After this actual output is "the device has to advertise"

But I'm not getting the actual output. so can anyone explain,

1) How to flash the ble_peripheral project to the target boards using cli commands like nrjprog?

2) Is there any wrong in my procedure, if yes then what is the correct way to do this?

Parents
  • Hi

    1. I just tested this myself by opening the command line in \<SDK_FOLDER>\examples\ble_peripheral\ble_app_hrs_freertos\hex, flashed the application onto the device and reset it with the same commands you did and I can see that it successfully built and starts advertise once reset.

    C:\nordicsemi\SDK\nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_hrs_freertos\hex
    λ nrfjprog -f NRF52 --program ble_app_hrs_freertos_pca10056_s140.hex --chiperase
    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.
    
    C:\nordicsemi\SDK\nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_hrs_freertos\hex
    λ nrfjprog -f NRF52 --reset
    Applying system reset.
    Run.

    2. Seeing as you made your own .hex file, you have to merge your application .hex file with a SoftDevice. merge these by writing something like mergehex --merge <hex.file> <hex.file> [<hex.file>] (Hex files to be merged) --output <hex.file> (Hex file result of the merge). This is part of the nRF Command Line Tools, so you shouldn't have to download anything extra.

    The SoftDevice.hex files can be found in \<SDK_FOLDER>\components\softdevice.

    Best regards,

    Simon

    EDIT: I see beat me to it Slight smile

Reply
  • Hi

    1. I just tested this myself by opening the command line in \<SDK_FOLDER>\examples\ble_peripheral\ble_app_hrs_freertos\hex, flashed the application onto the device and reset it with the same commands you did and I can see that it successfully built and starts advertise once reset.

    C:\nordicsemi\SDK\nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_hrs_freertos\hex
    λ nrfjprog -f NRF52 --program ble_app_hrs_freertos_pca10056_s140.hex --chiperase
    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.
    
    C:\nordicsemi\SDK\nRF5_SDK_17.0.2_d674dde\examples\ble_peripheral\ble_app_hrs_freertos\hex
    λ nrfjprog -f NRF52 --reset
    Applying system reset.
    Run.

    2. Seeing as you made your own .hex file, you have to merge your application .hex file with a SoftDevice. merge these by writing something like mergehex --merge <hex.file> <hex.file> [<hex.file>] (Hex files to be merged) --output <hex.file> (Hex file result of the merge). This is part of the nRF Command Line Tools, so you shouldn't have to download anything extra.

    The SoftDevice.hex files can be found in \<SDK_FOLDER>\components\softdevice.

    Best regards,

    Simon

    EDIT: I see beat me to it Slight smile

Children
No Data
Related