adding buttonless dfu service to heart rate service example application

Hello Everyone,

   I used the HRS application example for LESC secure communication and added the OTA to the HRS application. After adding that, the device restarts. I debugged, and the following error is arising.

<error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at C:\nRF_SDK\nRF5_SDK_17.1.0_ddde560\nRF5_SDK_17.1.0_ddde560\examples\ble_peripheral\ble_app_hrs_LESC_BEACON_V2\main.c:598
PC at: 0x0002CDA3
<error> app: End of error report

this error is arising when this function is called in the service_init() function.

 err_code = ble_dfu_buttonless_init(&dfus_init);
APP_ERROR_CHECK(err_code); 

kindly help me on this issue. I have used nrf_sdk_17.1.0 and Segger embedded studio v5.68. I followed the tutorials https://novelbits.io/nrf52-ota-dfu-ble-part-4/ and nordic official tutorial.

Best Regards,

Srinivasa

Parents
  • Hello Srinivasa,

    I don't see anything inside ble_dfu_buttonless_init() that may cause the function to return with NRF_ERROR_INVALID_STATE. Could you upload your project so I can try to debug it here?

    Best regards,

    Vidar

  • Hi Vidar,

    Thanks for your response, I have attached the project file. kindly review the code and waiting for the quick replay. 

    Best regards,

    Srinivasable_app_hrs_LESC_BEACON_V2.zip

  • I need to reproduce the issue on my end to identify the problem, and for that, I will need your current project along with step-by-step instructions on how to reproduce it.

  • No, because I don't know what code changes you've made since uploading the original version. Also, in your comments above, you mentioned that you were able to bond initially, but then it stopped working. I need to know the steps to reproduce that. 

  • yes,

    1. first, I used examples of HRS and flashed the device. from my nRF connect app I can connect and get bonded with the device. 

    2. second thing is I added the buttonless dfu characteristics to the HRS example. and I did the following procedure

    I have enabled the NRF_DFU_BLE_BUTTONLESS_SUPPORT_BONDS is enable in application and NRF_DFU_BLE_REQUIRES_BONDS enabled in secure bootloader and remaining I followed as per procedure as mentioned in nordic infocenter. 

    first I generate bl_settings.hex using following command

    .\nrfutil.exe settings generate --family NRF52 --application ble_app_hrs_pca10040_s132.hex --application-version 1 --bootloader-version 1 --bl-settings-version 2 bl_settings.hex

    next command I used below for generating bl_sd_settings_app.hex

    PS C:\nRF_SDK> mergehex --merge bl_settings.hex secure_bootloader_ble_s132_pca10040.hex s132_nrf52_7.2.0_softdevice.hex ble_app_hrs_pca10040_s132.hex --output bl_sd_settings_app.hex

    for generating package I used following command

    PS C:\nRF_SDK> .\nrfutil pkg generate --hw-version 52 --application-version 2 --application ble_app_hrs_pca10040_s132.hex --sd-req 0x101 --sd-id 0x101 --key-file private.key BEACON_DFU_SEC_TEST.zip

    I flashed the  bl_sd_settings_app.hex to the controller using segger j_flash and the device restarted and started advertising. I tried to connect and bond with the device, but the device was bonded and disconnected after 3 seconds. I tried to connect again but it is not connecting but the device is bonded. I have tried deleting the bonding information on the nRF connect app and again initiated the connection and bonding same issue is arising. 



    regards,

    Srinivasa

  • srinivasa m said:
    I tried to connect again but it is not connecting but the device is bonded. I have tried deleting the bonding information on the nRF connect app and again initiated the connection and bonding same issue is arising. 

    To support this scenario, you need to set the .allow_repairing flag as shown in this post:  RE: SDK15 paring problem . But it is still not clear when you get the NRF_ERROR_INTERNAL errors shown in the log you posted earlier.

Reply Children
  • could you please try OTA with the existing example? 

  • Hi Vidhar,

    Is there any update on this, your response is significant for completing the project.

    Regards,

    Srinivasa

  • Hi,

    Please respond to my suggestions and comments. Did you set the allow_repairing flag as I suggested? Doing so will allow you to pair again when the bonding information has been deleted on the phone but not on the device.

    The other error with the FDS initialization error will prevent bonding altogether. However, it's not clear what you did to trigger this error. I can test DFU and the HRS example, but I won't be able to reproduce this specific error. Are you always getting this error now?

  • Hi Vidar,

    I have been working with the HRS (Heart Rate Service) example without making any modifications. Initially, after flashing the example, everything worked fine. I was able to pair and bond the device successfully. However, after erasing the bond information from the phone and attempting to pair and bond again, it didn’t work. Once I enabled re-pairing, it worked as expected.

    Next, I added the buttonless DFU service to the HRS example and performed an OTA update. The file was transferred successfully from the mobile device to the nRF device, and the device restarted, began advertising, and allowed connection and bonding. However, after 2 seconds, the device disconnected.

    I deleted the bond information from the mobile device and tried reconnecting. The device connected and bonded successfully but disconnected again after 2 seconds. I then attempted to debug the issue, I got the above error. kindly let me know the solution.

    Regards,

    Srinivasa

  • Hi Srinivasa,

    It does not make sense that the error arises after the connection has been established. Please upload your current application project, along with the bootloader project you are using, so I can review the configuration. You can zip and upload the entire SDK if that is easier.

    Regards,

    Vidar

Related