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 Reply
  • Hi,

    Thanks for the project. The invalid state error was returned by the call to pm_register() in ble_dfu_buttonless_init->ble_dfu_buttonless_backend_init(). I overlooked this function earlier when I was trying to figure out why the service init function could be returning this error. 

    pm_register() returns this error because the peer manager module was not initialized at this point. The solution is to initialize the peer manager with peer_manager_init() before you initialize the service.

    Best regards,

    Vidar

Children
  • 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.

Related