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

  • Hi Vidar, 

    thank you very much issue is resolved. but when I do OTA, without pairing and bonding OTA is happening properly. when it comes to pairing and bonding, 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 controller using segger j_flash and device restarted and started advertising. i tried to connect and bonding with device, the device is bonded and disconnected after 3 seconds. i tried to connect again but it is not connecting but device is bonded. i have tried by deleting the bonding information on nrf connect app and  again initiated the connection and bonding same issue is arising.

    could you please help me with this? I appreciate quick response because I in a phase of project dead line

    Best Regards,

    Srinivasa

  • Hi Vidhar,

    while debuging I got following error.

    <info> app: Setting vector table to bootloader: 0x00078000
    <info> app: Setting vector table to main app: 0x00026000
    <info> app_timer: RTC: initialized.
    <info> app: Heart Rate Sensor example started.
    <info> app: Fast advertising.
    <info> app: Connected.
    <info> app: BLE_GAP_EVT_LESC_DHKEY_REQUEST
    <info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
    <error> peer_manager_pds: Could not write data to flash. fds_record_{write|update}() returned 0x8601. peer_id: 0
    <error> peer_manager_pdb: pds_peer_data_store() returned NRF_ERROR_INTERNAL. peer_id: 0
    <error> peer_manager_smd: Could not store bond. pdb_write_buf_store() returned NRF_ERROR_INTERNAL. conn_handle: 0, peer_id: 0
    <error> peer_manager_handler: Unexpected fatal error occurred: error: NRF_ERROR_INTERNAL
    <error> peer_manager_handler: Asserting.
    <error> app: ERROR 3 [NRF_ERROR_INTERNAL] at C:\nRF_SDK\nRF5_SDK_17.1.0_ddde560\nRF5_SDK_17.1.0_ddde560\components\ble\peer_manager\peer_manager_handler.c:295
    PC at: 0x0002CA29
    <error> app: End of error report

    can you guide me how to resolve this

    Best Regards,

    Srinivasa M

  • Hi Srinivasa,

    The Flash Data Storage (FDS) failed to be initialized. This can happen if the flash area is already occupied with other data. Please do a full chip erase before you program the application and see if you get the same error.

  • yes, I followed the same still error persists. could you please help me out on this

  • Please provide the current version of your project, along with the steps to reproduce this error on my end.

Reply Children
  • Hi,

    current version is nRF5_SDK_17.1.0_ddde560 and segger embedded studio for ARMV5.68. 

    Regards,

    Srinivasa m

  • 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

Related