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

nrf52833 ble dfu how to start?

Hi ,

I need to start my application using sdk5 16.0 version, which should have custom ble servivnced and dfu feature.

After getting some trouble with zephyr os, i decided to test with sdk5. 

But it seems that nrf52833DK is not totally supported in all example. i wanted to start from dfu example and then integrate hrs example. Is it the good way to go ? 

Or may be the best is to start with hrs nfc paring ? but then how to integrate dfu. In the doc of how to integrate dfu, it is not for s113 ... 

I tried to migrate blinky ble from s112 10040e to s113 , i update ll the field but i finnaly get some linking .init errors with UNPLACED label.

I have the the feeling that zephyr or sdk5, nothing is really ready for nrf52833...

But i keep c9nfident, it is not like o wanted to do something ompossible, just  question of tile and good practice i guess.

thanks a lot for your help !

Parents Reply
  • So when i  debug, i get this error. That strange because .hex of project secure bootloader is well flashed as shown in memory map

    Debug Window: 

    <error> app: No bootloader was found
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at C:\nordic\nRF5SDK160098a08e2\examples\ble_peripheral\ble_app_buttonless_dfu\main.c:854
    PC at: 0x00026075
    <error> app: End of error report
    <error> app: No bootloader was found

Children
  • Hi,

    Olfox said:
    So when i  debug, i get this error. That strange because .hex of project secure bootloader is well flashed as shown in memory map

    No, this is expected. The memory map does not show a bootloader. Please refer to the memory layout in the bootloader documentation. As you can see, the bootloader is at the end of the flash (though technically you can move it down as much as you want, but would wast any space above it).

    Are you sure you flashed a bootloader? If so, can you show me exactly how you program the device including all steps (perhaps you delete it later when programming the application or similar)?

  • I thik yes, i'm following the step in the tutorial. With nrfGo, i erase all memories.

    I place hex of soft device. i flash it. then i place the hex of bootloader secure_bootloader_ble_s113_pca10100 with the key i have generated. I flash. Then place my ble_app_buttonless_dfu_pca10100_s113 . i flash.

    But may be i have also to sign with the key my application?

    Because after all this step, i see in mobile app nrfConnect, DfuTarg with dfu services. but i think it is the bootloader that runs only and not the app.

  • Hi,

    Yes, this is the bootloader running. The bootloader will only start the application if it is present, marked as valid and has a valid CRC. When you program the application directly (instead of updating via DFU), you need to write the information that indicates this, which is in the DFU setting page. You do that by generating a valid dfu settings page that you program. With that in place, the bootloader will start the application. As a side note, you would be able to see this from the RTT log if you use a debug bootloader, as in that case it would log that there is no valid application to start.

  • Woo i think  it is working !!!

    So step i did to make it work:

    Build my application in release mode.

    Flash it 

    ( still not working)

    With windows console, go into the build folder of dfu_butonless example, output folder where my application .hex is. Run this command : 

    C:\nordic\nRF5SDK160098a08e2\examples\ble_peripheral\ble_app_buttonless_dfu\pca10100\s113\ses\Output\Release\Exe>nrfutil settings generate --family NRF52 --application ble_app_buttonless_dfu_pca10100_s113.hex --application-version 3 --bootloader-version 2 --bl-settings-version 2 settings.hex

    I get this result:

    Bootloader DFU Settings:
    * File: settings.hex
    * Family: nRF52
    * Start Address: 0x0007E000
    * CRC: 0xD899FCE0
    * Settings Version: 0x00000002 (2)
    * App Version: 0x00000003 (3)
    * Bootloader Version: 0x00000002 (2)
    * Bank Layout: 0x00000000
    * Current Bank: 0x00000000
    * Application Size: 0x0000D65C (54876 bytes)
    * Application CRC: 0x8171F9F8
    * Bank0 Bank Code: 0x00000001
    * Softdevice Size: 0x00000000 (0 bytes)
    * Boot Validation CRC: 0x8C0FDA87
    * SD Boot Validation Type: 0x00000000 (0)
    * App Boot Validation Type: 0x00000001 (1)

    Suprising to see Softdevice Size to 0 ?

    Then, in nrfGo, i add HEX settings.hex freshly generated by nrfUtil command line. Flash it. And bingo, i saw the device rebooting in my port com terminal with dfu butonless application stating. now i see advertising with new name .

    1. Now i wonder if i can still run in debug mode to place breakpoint etc ?

    2. If code change, should i always follow this procedure to update setting.hex ?

    3.For production, has there is : softDist.hex, Bootloader.hex, settings.hex, and application.hex how usually customer proceed ? make a king of segger script to flash in order all this .hex?

    4. And last question, to perform dfu update, i see there is steps to follow to generate a zip folder that is sent to the device. Is it notpossible to just update the .hex?

    I would like to thank you a lot for your support to help me to find the good way, there is documentation a bit everywhere and it is sometimes difficult to have all the steps and tool in good order. ;)

  • Hi,

    Olfox said:
    1. Now i wonder if i can still run in debug mode to place breakpoint etc ?

    Yes, but every time you program the application (for instance using "build & run", the bootloader would prevent it from starting since the validation check will fail. You can either test&debug your application without the bootloader present or disable boot validation when you generate bootloader settings by using "--app-boot-validation NO_VALIDATION".

    Olfox said:
    2. If code change, should i always follow this procedure to update setting.hex ?

    Yes, unless you do as suggested above.

    Olfox said:
    3.For production, has there is : softDist.hex, Bootloader.hex, settings.hex, and application.hex how usually customer proceed ? make a king of segger script to flash in order all this .hex?

    For production it would make more sense to have a single hex file, so I suggest you use mergehex from nRF Command Line Tools when it comes to that.

    Olfox said:
    4. And last question, to perform dfu update, i see there is steps to follow to generate a zip folder that is sent to the device. Is it notpossible to just update the .hex?

    No, you cannot use just the hex. You need to build a zip file using nrfutil. This converts the hex to a bin, and adds required metadata such as version information, dependencies etc, and signed the update using your private key.

    As you asked about this I wonder if perhaps you have not noticed yet, but you need to adjust the bootloader to use your public key (in <SKD>\examples\dfu\dfu_public_key.c). See Working with keys and Validation.

Related