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

Buttonless bootloader on custom board

Hi Nordic tech support team,

I am currently testing DFU in my custom board (DWM1001) with secure bootloader and buttonless DFU. I was able to completely test the secure bootloader example present in C:\nRF_SDK\examples\dfu\secure_bootloader\pca10040_s132_ble\ses\ and I had expected results. So the requirement now is to completely make this procedure wireless i.e) waking up the bootloader with DFU service using the example C:\nRF_SDK\examples\ble_peripheral\ble_app_buttonless_dfu\pca10040\s132\ses.

So to initially test this buttonless DFU exampe, I followed the testing procedure https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Fble_sdk_app_buttonless_dfu.html. I took the hex file C:\nRF_SDK\examples\dfu\secure_dfu_test_images\ble\nrf52832\sd_s132_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex. I connected the board to the PC and I used below two commands in nRFUtil to program this hex file.

PS C:\Users\rahul> nrfjprog --family nRF52 --eraseall
Erasing user available code and UICR flash areas.
Applying system reset.
PS C:\Users\rahul>

PS C:\Users\rahul> nrfjprog --family nRF52 --program C:\nRF_SDK\examples\dfu_Test\secure_dfu_test_images\ble\nrf52832\sd_s132_bootloader_buttonless_with_setting_page_dfu_secure_ble_debug_without_bonds.hex --verify
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.
Verifying programming.
Verified OK.

After this I could see that my device is advertising as "Nordic_Buttonless" and I could see the same in nRF Connect in my mobile, but I could not see LED adverting because pin configuration and header file has to be changed.  

Now, I would like to do the same with the buttonless dfu example present in the nRF5 SDK 16.0  C:\nRF_SDK\examples\ble_peripheral\ble_app_buttonless_dfu\pca10040\s132\ses

I followed the below steps.

Step 1:

I compiled the buttonless dfu example in segger studio (latest version) and generated the hex file.

Step 2:

Generated the settings page for a simple blinky application to blink leds using below command.

PS C:\Users\rahul> nrfutil settings generate --family NRF52 --application C:\nRF_SDK\examples\My_Projects\3_Boards_tutorial\pca10040\s132\ses\Output\Release\Exe\blinky_pca10040_s132.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 settings.hex

Please find the settings.hex file for your reference.8132.settings.hex

Step 3:

Now I followed the steps given by Mr. Edvin the issue https://devzone.nordicsemi.com/f/nordic-q-a/65920/generating-bootloader-settings/269638#269638

I connected the device to my laptop and executed below commands in nRFUtil in windows power shell.

a) Erased the total memory.

PS C:\Users\rahul> nrfjprog --family nRF52 --eraseall
Erasing user available code and UICR flash areas.
Applying system reset.

b) Programmed the buttonless dfu bootloader

PS C:\Users\rahul> nrfjprog --program C:\nRF_SDK\examples\My_Projects\ble_app_buttonless_dfu\pca10040\s132\ses\Output\Debug\Exe\ble_app_buttonless_dfu_pca10040_s132.hex --verify
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.
Verifying programming.
Verified OK.

c) Programmed the softdevice

PS C:\Users\rahul> nrfjprog --program C:\nRF_SDK\examples\dfu_Test\secure_dfu_test_images\ble\nrf52832\softdevice_s132.hex --verify
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.
Verifying programming.
Verified OK.

d) Program the application (Application is working fine when flashed directly to device using segger studio)

PS C:\Users\rahul> nrfjprog --program C:\nRF_SDK\examples\My_Projects\3_Boards_tutorial\pca10040\s132\ses\Output\Release\Exe\blinky_pca10040_s132.hex --verify
Parsing hex file.
Reading flash area to program to guarantee it is erased.
ERROR: The area to write is not erased.

So at this stage I am facing this issue. If this is successfull then the one more step is to flash bootloader settings. So I request you to analyze the issue and help to proceed further on the issue. Please let me know If you need any files.

Looking forward to receiving quick reply.

Regards

Rahul Chowdary

  • Hi Rahul, 

    Please be aware that when you testing buttonless application, you still need to flash the normal bootloader. There is no such thing as " buttonless dfu bootloader". The buttonless example provided in the SDK is an example of how to implement buttonlessDFU service into your application. 
    So what you need to do is to implement the buttonless service into your blinky (i assume it's a BLE application) application. And you still need to flash the normal bootloader. 
    You can choose to make the bootloader setting or not (if you don't make the bootloader setting you will need to flash the application via DFU process instead of flashing it directly via the programmer).

    I have a tutorial here that may have some extra information about that.  

  • Hi Mr. Bui,

    Thanks for the information. Now, I got full clarity on how it is working and I could be able to successfully test the buttonless DFU example. I want to implement the same functionality into a template application. So here are my doubts.

    When I connect to the Nordic_Buttonless in nRF connect for android, I could see the "Secure DFU service" as shown in image 1 with characteristic "Buttonless DFU".

       

    When I click on the characteristic "Buttonless DFU" it is giving the option to launch the bootloader and just launching the bootloader when yes is given. On the other hand when I click the DFU symbol present on top right corner it is asking to select the firmware zip package and when selected the zip package, it is automatically launching the booltoader and connecting to the bootloader and updating the application. Now, I want to know below things.

    1) Which file is responsible for adding the DFU service and Buttonless dfu characteristic to it (I believe it is nrf_dfu_ble.c) ?

    2) When we send the characteristic to lanuch into bootloader mode, we will write the magic value to the retention register (GPREGRET) and do the soft reset. So, in which file we are doing this process ?

    3) How can I just add the buttonless DFU characteristic without the DFU symbol on top right corner ?

    Thanks in advance for your help.

    Regards

    Rahul Chowdary

  • Hi Rahul, 

    1. Please have a look inside ble_app_buttonless project. The service is declared in ble_dfu.c (ble_dfu_buttonless_init()) , depends on if you do DFU with or without bond you would need ble_dfu_bonded.c or ble_dfu_unbonded.c

    2. It's inside ble_dfu_buttonless_bootloader_start_finalize() we don't reset immediately but gracefully disconnect before we reset. 

    3. Its the nRF Connect feature to support DFU buttonless. Are you planning to build your own app/DFU app? You can refer to the DFU profile inside nRF Toolbox. The nRF Connect is not really you should send to the end customer. It's a debug tool.

  • I am trying to achieve something similar on my custom board. I have worked around many of the hiccups I am stuck due to a build error.

    When compiling the file 'nrf_bootloader.c' the build fails with this error:
        nRF5_SDK/16.0.0/components/libraries/bootloader/nrf_bootloader.c:231:30: error: 'BUTTON_PULL' undeclared (first use in this function)
      231 |                              BUTTON_PULL,

    I have a custom board and my plan is to do DFU over BLE.

    My question is: Why do I have to worry about defining the BUTTON_PULL to begin with since I have no intention of using any GPIO to trigger entry into DFU. Do I even need to compile this specific file for my build?

    RMV

  • Hi RMV, 
    Please create a new case when you have a question. Posting it on someone's case may end up no reply. 

    BUTTON_PULL is defined in the board. h file, for example if you are using pca10040 board, it's defined in pca10040.h 

    #define BUTTON_PULL    NRF_GPIO_PIN_PULLUP

Related