Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

programing softdevice and firmware with nrfjprog

Hi, 

I just started working with Nordic chips so I apologize if I am missing something obvious here

I am using a custom board that I designed containing a nrf52832 module. I am uploading programs to it through the command line using a jlink (program hex files). It is getting programmed just fine when it comes to programs that don't require softdevice such as simple blink programs, it blinks as expected. When it comes to anything requiring softdevice, I program softdevice (I tried s132 and s112) and then when I try to program my firmware (I tried the nRF5 SDK examples) I receive the error: 

"ERROR: The area to write is not erased" 

When I erase the chip I am able to program it, but I believe that means that I erased the softdevice as I am not able to detect any Bluetooth signal. I tried erasing using "--sectorerase", "-chiperase" and "--sectoranduicrerase" with the same outcome. 

Am I missing something here? I there a special way to get both the softdevice and my firmware on the chip using nrfjprog? 

Operating system: Windows

Programmer: Jlink EDU

Board: Custom with a MDBT42Q - nRF52832 based BLE module

Parents
  • Hello, 

    Have you tried using --eraseall?

    Kind regards,
    Oeyvind

  • Hi 

    The sequence I've been using so far has been: 

    First, erase everything:

    <nrfjprog --eraseall>

    Then program the softdevice:

    <nrfjprog --family NRF52 --program softdevice.hex --chiperase --verify>

    Then the firmware:

    <nrfjprog --family NRF52 --program ble_app.hex --verify > (does not work, The area to write is not erased)

    I tried <nrfjprog --family NRF52 --program ble_app.hex --verify --eraseall>  (does not work, ERROR: Two arguments were provided that cannot be combined.)

    What does work is <nrfjprog --family NRF52 --program ble_app.hex --verify --chiperase> , no Bluetooth signal detected through 

    Then: 

    <nrfjprog --family NRF52 --reset> 

    Is there a special way to use --eraseall to program the firmware? 

Reply
  • Hi 

    The sequence I've been using so far has been: 

    First, erase everything:

    <nrfjprog --eraseall>

    Then program the softdevice:

    <nrfjprog --family NRF52 --program softdevice.hex --chiperase --verify>

    Then the firmware:

    <nrfjprog --family NRF52 --program ble_app.hex --verify > (does not work, The area to write is not erased)

    I tried <nrfjprog --family NRF52 --program ble_app.hex --verify --eraseall>  (does not work, ERROR: Two arguments were provided that cannot be combined.)

    What does work is <nrfjprog --family NRF52 --program ble_app.hex --verify --chiperase> , no Bluetooth signal detected through 

    Then: 

    <nrfjprog --family NRF52 --reset> 

    Is there a special way to use --eraseall to program the firmware? 

Children
  • Duaa said:
    What does work is <nrfjprog --family NRF52 --program ble_app.hex --verify --chiperase> , no Bluetooth signal detected through 

    Have you verified that the module does work?

    Duaa said:
    Is there a special way to use --eraseall to program the firmware? 

    Nope, this is correct from what you describe.  

    Can you please try the following:

    1. nrfjprog --eraseall
    2. Program <..\[YOUR SDK]\components\softdevice\s132\hex\s132_nrf52_X.X.X_softdevice.hex>
    3. Build and Program <..\[YOUR SDK]\examples\ble_peripheral\ble_app_uart\pca10040\s132\[YOUR COMPILER]\*.hex

      Using one of the examples from the SDK should work out of the box. What version of the SoftDevice are you using? 

  • Thank you for your help. I was trying with the SDK examples which did not work for me at first. Upon looking further, turns out I had the wrong value of LF crystal capacitors so my LF crystal was not working at all. I switched the softdevice clock source to the internal oscillator and changed the calibration settings accordingly. Everything works fine after that. 

    Thanks for pointing out that the SDK examples should work out of the box. Otherwise, I would have spent way longer than I should have looking into the software without questioning my hardware. 

Related