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

ble_app_hrs + Buttonless DFU on NRF52DK(52832) + OTA update

Hi,

I want to verify

1. Program  ble_app_hrs with buttonless dfu integrated + secure bootloader + bootloader setting to nRF52DK. 

2. Boot up nRF52DK, then use buttonless dfu goto bootloader mode

3. Update app_dfu_package.zip (nrfutil pkg generate --hw-version 52 --application-version 0 --application ble_ap nrfutil pkg generate --hw-version 52 --application-version 0 --application ble_app_hrs_pca10040_s132.hex --sd-req 0xCB --key-file private.key app_dfu_package.zip
Zip created at app_dfu_package.zip)

====

Below are my steps:

Step1 Generate bootloader setting page

Step2  merge secure bootloader(\dfu\secure_bootloader\pca10040_s132_ble\) + bootloader settings

Step3 Program secure bootloader (examples\dfu\secure_bootloader\pca10040_s132_ble)+ bl setting

Step4 Program softdevice (s132_nrf52_7.0.1)

Step5 Program app(ble_app_hrs_pca10040_s132 which is integrate with buttonless_duf already)

Step 6 When nRF52DK bootup, error logs are below:

Are my steps correct?

How can I make it right?

Thanks.

Vick

Parents
  • Hi Sudharsan,

    I have followed the blog, and try below steps:

    1. 

     In sdk_config.h in the bootloader:

    • Change NRF_DFU_BLE_REQUIRES_BONDS to 1
    • Change NRF_SDH_BLE_SERVICE_CHANGED to 1

    - In sdk_config.h in ble_app_buttonless_dfu + ble_app_hrs

    • Change NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS to 1
    • Check if NRF_SDH_BLE_SERVICE_CHANGED is not 1 then set it to 1

    Compile the two projects. 

    2. Generate bl setting

    3.

    mergehex -m bootloader.hex setting.hex -o bootloader_and_setting.hex

    4.

    mergehex -m nrf52832_xxaa.hex bootloader_and_setting.hex -o app_bootloader_and_setting.hex

    5. flash softdevice

    6.  flash the app_bootloader_and_setting.hex

    7. After bootup, error logs show below:

    Could you give me a hand?

    By the way, I have tested sec_bootloader + ble_app_hrs(without buttonless_dfu), the result is following.

    When nRF52DK boots up, it will enter bootloader mode directly.  Is that normal?

    (This verification just make sure the bootloader is available.)

    Thanks you!

  • Hi Vick, 
    Could you please run the application in debug and add a breakpoint in side the function ble_dfu_buttonless_init() and step into the code of the function to find which exact function inside that returned INVALID_STATE ? 

    I suspect it has something to do with that you integrated the buttonless feature into hrs example. (I assume you increased the NRF_SDH_BLE_VS_UUID_COUNT ? )

    Could you try testing again with the unmodified ble_app_buttonless_dfu ? 

  • Hi Hung,

    1. Please see below:

    "ble_dfu_buttonless_backend_init"

    2. Yes, from 1 to 2.  I followed UBX-19050198 page19-24.

    3. Could you try testing again with the unmodified ble_app_buttonless_dfu ? 

    => I'm not sure about "unmodified ble_app_buttonless_dfu". What's the condition?

    Thanks!

  • Hi Vick 

    It seems that you got the error because the peer manager was not initialized before the buttonless service init (ble_dfu_buttonless_init() ). 
    If you have a look at the ble_app_buttonless example you can find that we call peer_manager_init() before we call service_init() (which call ble_dfu_buttonless_init() ) when in ble_app_hrs it's not the case.

    Please try to change that and let us know if you still have the issue.

  • Hi Hung

    It works, the device goes to advertising now!

    After that, I'm trying to do DFU, but meet some problem.

    Please see below.

    1. Generate zip first

    nrfutil pkg generate --application ble_app_hrs_pca10040_s132.hex --application-version-string "1.0.0" --hw-version 52 --sd-req 0xCB --key-file private.key app_v1.zip

    2. Use Android phone nRFconnect 

    3. Scan and bond first

    4. Connect 

    5. Click DFU

    6. Select file zip

    7. Starting DFU

    8. Timeout

    9. Device is disconnected.

    9. LED1 of nRF52DK is lit. DFU process is not successfull.

    Is there anything wrong ?

    ===========

    So I tried DFU by other nRF52DK, there is an error msg below:

    Is there any configuration I should modify?

    Thanks.

  • Hi Vick,

    Please check the log in nRF Connect on Android (swipe right on the screen to see the log). 

    I think what you can try to test is to manually switch the buttonless application to the bootloader (enable indication, then write 0x0104 to the application , or click switch to DFU if the app support that feature)

    Then you can check if the bootloader is advertising with DFU_Targ. 

    I also attached here the project, files I used to test here. It's with SDK v16.0 , nRF52832. 



    2063.DFU_Bond.zip

    If you want to test with nRF Connect on PC, you need to bond with the device before testing. 

Reply
  • Hi Vick,

    Please check the log in nRF Connect on Android (swipe right on the screen to see the log). 

    I think what you can try to test is to manually switch the buttonless application to the bootloader (enable indication, then write 0x0104 to the application , or click switch to DFU if the app support that feature)

    Then you can check if the bootloader is advertising with DFU_Targ. 

    I also attached here the project, files I used to test here. It's with SDK v16.0 , nRF52832. 



    2063.DFU_Bond.zip

    If you want to test with nRF Connect on PC, you need to bond with the device before testing. 

Children
  • Hi Hung,

    1. I don't know where to enable indication and write 0x0104

    I have noticed that there is locked icon.Is that normal?

    But I found there are two options request and command in write icon of Secure Buttonless DFU.

     

    When I send request, logs are below:

    When I send command, logs are below. And no response.

    =============

    2. I will try your buttonless dfu application first and compare it.

    [Update 12/2] 

    The difference between app_new.hex and app_original.hex is NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS flag?

    [Update 12/3]

    Test A 

    A.1 Execute flash.bat using app_original.hex

    A.2 Bond device from Android app

    A.3 Connect device 

    A.4 Start DFU, and select package1.zip

    A.5 nRF52DK goes to bootloader succesfully but process is failed, not finished.

    Logs are below:

    TestB 

    B.1 Execute flash.bat using app_new.hex

    ...

    ...

    B.5 Got same result as Test A.

    Are those result is expected?

     =======

    3. I can't not find where to bond in nRFConnect on PC.

    Thanks for help !!

  • Please get familiar with GATT client, GATT server. You need to enable indication in the GATT server. 

    The difference between app_new.hex and app_original.hex is that I changed the name of the advertiser. The app_original.hex is used to flash the application , bootloader, softdevice, bootloader setting.hex files. The app_new.hex is used to generate the .zip file. 

    If you get write not permit please try to erase all bond information both on the phone and reset the phone. Most likely the phone cached the att table and didn't update it. 
    Please try Test A again after the phone reset. Made sure you have the bootloader flashed. If the issue remains, please try to test on another phone. 

  • You need to enable indication in the GATT server.

    Sorry, I still don't know how to enable it in server(nRF52) by UI operation on phone. And how to verify it on Android?

    PS:I have tried enable CCCD in the setting, got same error "GATT WRITE NOT PERMIT" after DFU.

     .

    =====

    And I tried forget pair information in phone then reset phone, and do Test A again.

    I still Got "GATT WRITE NOT PERMIT"

  • Hi Hung,

    Based on same steps, after I use other Android phone(os: Android9), and it works.

    It seems there is some issue related with Android 10.

    ================

    Then I tried back to my app integrated with hrs+buttonless_dfu.

    Below are result on two Android phones(Android version9/10):

    It doesn't go to bootloader mode by observing LED.

    Could you help ?

    Thanks.

  • Hi Vick, 
    Please try to test again with the Android 10 that you erase bond , turn off Bluetooth then restart the phone. I suspect that it cached the attribute table. 
    If the issue remains, please capture a sniffer trace  when you test.

    Made sure that you have service changed characteristics added (NRF_SDH_BLE_SERVICE_CHANGED=1)

Related