Understanding Softdevice Installation

Hello all,

I am developing on the nRF52840, and I am using the PCA10056/nRF52840-DK to assist in my understanding of the uploading process.

Currently, I am trying to get a grasp on the idea of a Softdevice and the process to installing the Softdevice along with custom code onto my device. I am not well versed in the general procedure of loading programs onto the target device at such a low level (I'm used to Arduino and basic Makefile, so I don't have much experience at this level of complexity). My primary project uses a Makefile so I am trying to figure out how all of this works using the Make system shown in the SDK. I am currently looking at the V15.0 Nordic SDK file <SDK_ROOT>/examples/ble_peripheral/ble_app_blinky/pca10056/s140/armgcc/Makefile and in it there are two flash target commands, one called flash and the other flash_softdevice . Here is the section of the code:

# Flash the program
flash: $(OUTPUT_DIRECTORY)/nrf52840_xxaa.hex
    @echo Flashing: $<
    nrfjprog -f nrf52 --program $< --sectorerase
    nrfjprog -f nrf52 --reset

# Flash softdevice
flash_softdevice:
    @echo Flashing: s140_nrf52_6.0.0_softdevice.hex
    nrfjprog -f nrf52 --program $(SDK_ROOT)/components/softdevice/s140/hex/s140_nrf52_6.0.0_softdevice.hex --sectorerase
    nrfjprog -f nrf52 --reset
I have a few question:

  1. For the development kit, how would I go about actually uploading the code properly? I know (or at least think I know) that the Softdevice is the Nordic BLE stack so it needs to be uploaded, but then there is the actual example program which needs to be uploaded, and these are two separate targets. What would be the proper way to upload the example program and the Softdevice to the development kit using the given tools?
  2. I want to integrate the Softdevice and my custom project together and upload both of them to my device so I can utilize the BLE functionality. How do I go about using the Make system to upload both the Softdevice and the custom project? Do I combine them into one .bin or .hex file somehow, or do I upload them separately?
  3. The nrfjprog program appears to only work with the built-in JLink on the Development Kit which our custom board does not have. Currently, we use the BOSSAC (Basic Open Source Sam-ba Application Command-Line) to upload the .bin to the nRF52840, so would I be able to use that program to upload the binaries, or would I need to use a different uploading procedure based on question 1?

I am fairly new to all of this lower level building and uploading, and I am doing the best I can to learn all of this. So any and all information related to this kind of stuff would be extremely appreciated!

Thanks!

Parents
  • Hello,

    For the development kit, how would I go about actually uploading the code properly? I know (or at least think I know) that the Softdevice is the Nordic BLE stack so it needs to be uploaded, but then there is the actual example program which needs to be uploaded, and these are two separate targets. What would be the proper way to upload the example program and the Softdevice to the development kit using the given tools?

    You can use the makefile targets you mentioned for this. 

    e.g.

    $ make flash && make flash_softdevice // build and program application along with the Softdevice

    I want to integrate the Softdevice and my custom project together and upload both of them to my device so I can utilize the BLE functionality. How do I go about using the Make system to upload both the Softdevice and the custom project? Do I combine them into one .bin or .hex file somehow, or do I upload them separately?

    The hex files are usually loaded separately. Though you can use our merghex tool if you want to turn them into a single hex file, see Merging files with mergehex. This is commonly done when preparing a hex file for production.

    The nrfjprog program appears to only work with the built-in JLink on the Development Kit which our custom board does not have. Currently, we use the BOSSAC (Basic Open Source Sam-ba Application Command-Line) to upload the .bin to the nRF52840, so would I be able to use that program to upload the binaries, or would I need to use a different uploading procedure based on question 1?

    I don't have much experience with BOSSAC, to be honest. I thought it only worked with Atmel chips. Another alternative, which I would recommend, is to use your DK to program your other board. You can refer  "Debug output" section of the user guide to see where the programming pins are located.

    Best regards,

    Vidar

    Edit: Forgot to add that, when developing custom applications, it is much easier to start with an existing BLE example such as ble_app_blinky than trying to set up a new project entirely from scratch. The ble_app_blinky has everything configured to work correctly with the Softdevice (dependencies, memory layout, etc).

  • Thank you for getting back to me Vidar!

    You can use the makefile targets you mentioned for this. 

    e.g.

    $ make flash && make flash_softdevice // build and program application along with the Softdevice

    So just for my own education, I thought about doing this but was concerned about doing it this way because of the --sectorerase flag in the flash targets. It made it seem whichever was programmed first would be erased once the second flash began, so do you mind explaining what --sectorerase does?

    The hex files are usually loaded separately.

    Thanks for the clarification! Wasn't sure what the standard procedure was.

    Another alternative, which I would recommend, is to use your DK to program your other board. You can refer  "Debug output" section of the user guide to see where the programming pins are located.

    We are actually able to use the BOSSAC program to program our board via USB. This is desired for ease of programming for the End User so we'd like to keep the USB programming functionality. Is there a recommended program and/or procedure for uploading programs via USB? Not sure if this questions should be responded to in a different thread, so if so, let me know.

    Thanks again for your help!

  • No problem! The --sectorerase option will only erase the flash sections targeted by the hex file you're uploading. So it will work fine as long as the memory ranges for your FW images do not overlap in flash.

    As illustrated below, the application is placed on top of Softdevice in flash.

    jspear said:
    We are actually able to use the BOSSAC program to program our board via USB. This is desired for ease of programming for the End User so we'd like to keep the USB programming functionality. Is there a recommended program and/or procedure for uploading programs via USB? Not sure if this questions should be responded to in a different thread, so if so, let me know.

    Does the nRF52840 on your board comes pre-programmed with a bootloader compatible with the BOSSAC utility? The nRF52 ICs are shipped blank (empty flash) from our factory, which means there is no code to handle programming over the USB interface. Blank chips can only be programmed through the debug interface.

    We support programming over USB and BLE through our nRF5 SDK bootloader as well, see DFU bootloader examples. But the bootloader must be programmed first with a J-link debugger or similar.

  • The --sectorerase option will only erase the flash sections targeted by the hex file you're uploading.

    Awesome, thanks for the clarification!

    Does the nRF52840 on your board comes pre-programmed with a bootloader compatible with the BOSSAC utility? The nRF52 ICs are shipped blank (empty flash) from our factory, which means there is no code to handle programming over the USB interface. Blank chips can only be programmed through the debug interface.

    To clarify our process, we have been using the Arduino IDE to burn their Bootloader (I believe it is a SAMD Bootloader) using a 10-pin SWD header on our PCB. Once this is done, the USB FW Upload functionality is then available using BOSSAC.

    This brings up another question, and this is sort of related to another case that I opened PCA10056 Bootloader on nRF52840 . Ultimately, we are trying to move away from using the Arduino Burn Bootloader functionality, and we would like to use what Nordic recommends. I haven't had a chance to look through the DFU bootloader examples yet, so this question may be answered in there, but is there a recommended bootloader from Nordic and a recommended program to use for the installation of the bootloader? 

    But the bootloader must be programmed first with a J-link debugger or similar.

    We are planning to use the SWD interface as opposed to the JTAG interface, so would that fit into the "similar" category?

    Sorry for any naive questions I may be asking, and thank you again for your help!

Reply
  • The --sectorerase option will only erase the flash sections targeted by the hex file you're uploading.

    Awesome, thanks for the clarification!

    Does the nRF52840 on your board comes pre-programmed with a bootloader compatible with the BOSSAC utility? The nRF52 ICs are shipped blank (empty flash) from our factory, which means there is no code to handle programming over the USB interface. Blank chips can only be programmed through the debug interface.

    To clarify our process, we have been using the Arduino IDE to burn their Bootloader (I believe it is a SAMD Bootloader) using a 10-pin SWD header on our PCB. Once this is done, the USB FW Upload functionality is then available using BOSSAC.

    This brings up another question, and this is sort of related to another case that I opened PCA10056 Bootloader on nRF52840 . Ultimately, we are trying to move away from using the Arduino Burn Bootloader functionality, and we would like to use what Nordic recommends. I haven't had a chance to look through the DFU bootloader examples yet, so this question may be answered in there, but is there a recommended bootloader from Nordic and a recommended program to use for the installation of the bootloader? 

    But the bootloader must be programmed first with a J-link debugger or similar.

    We are planning to use the SWD interface as opposed to the JTAG interface, so would that fit into the "similar" category?

    Sorry for any naive questions I may be asking, and thank you again for your help!

Children
Related