nRF52832 buttonless DFU without bonds failed

I use nRF Connect to test  buttonless DFU without bonds failed. But nRF52832 receives BLE_GATTS_EVT_SYS_ATTR_MISSING event.

->static void ble_evt_handler(ble_evt_t const* pBleEvt, void* pContext)
->{
->    ret_code_t errCode = NRF_SUCCESS;
->   
->   switch (pBleEvt->header.evt_id)
->   {
->       case BLE_GAP_EVT_CONNECTED:
->       {
->           NRF_LOG_INFO("BLE_GAP_EVT_CONNECTED\n");
->           BLE_UART_SetState(BLE_NUS_STATE_CONNECT);
->           errCode = bsp_indication_set(BSP_INDICATE_CONNECTED);
->           if (errCode != NRF_SUCCESS) {
->               NRF_LOG_WARNING("bsp_indication_set() failed, errCode=0x%x\n", errCode);
->               return;
->           }    
->
->           m_cur_conn_handle = pBleEvt->evt.gap_evt.conn_handle;
->
->           errCode = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_cur_conn_handle);
->           if (errCode != NRF_SUCCESS) {
->               NRF_LOG_WARNING("nrf_ble_qwr_conn_handle_assign() failed, errCode=0x%x\n", errCode);
->               return;
->           }
->       }    
->       break;
->
->       case BLE_GATTS_EVT_SYS_ATTR_MISSING:
->       {
->           NRF_LOG_INFO("BLE_GATTS_EVT_SYS_ATTR_MISSING\n");
->           // No system attributes have been stored.
->           errCode = sd_ble_gatts_sys_attr_set(pBleEvt->evt.gap_evt.conn_handle, NULL, 0, 0);
->           APP_ERROR_CHECK(errCode);
->       }
->...
->}

-> Code0> <debug> nrf_ble_gatt: Requesting to update ATT MTU to 185 bytes on connection 0x0.
 0> <info> app: BLE_GAP_EVT_CONNECTED
 0>
 0> <debug> app: state=1
 0>
 0> <debug> nrf_ble_gatt: ATT MTU updated to 185 bytes on connection 0x0 (response).
 0> <info> app: BLE_GATTS_EVT_SYS_ATTR_MISSING

Parents
  • Hi, 

    What SDK version are you using?

    I use nRF Connect to test  buttonless DFU without bonds failed.

    Can you provide the log from the nRF Connect? 

    Please try to erase the kit before programming. 

    Regards,
    Amanda

  • 17:18:47.101    Using nrf-device-lib-js version: 0.4.11
    17:18:47.102    Using nrf-device-lib version: 0.11.8
    17:18:47.102    Using nrfjprog DLL version: 10.15.4
    17:18:47.102    Using JLink version: JLink_V7.66a
    17:18:47.125    Installed JLink version does not match the provided version (V7.58b)
    17:18:47.283    Updated list of uuids with data from github.com/.../v1
    17:25:24.417    Selected device with s/n F092AF29DAF8
    17:25:24.426    Device setup completed
    17:25:24.427    Connectivity firmware version: ble-connectivity 4.1.4+Mar-11-2021-08-36-04. SoftDevice API version: 5. Baud rate: 1000000.
    17:25:24.428    Opening adapter connected to COM5
    17:25:25.374    Successfully opened COM5. Baud rate: 1000000. Flow control: none. Parity: none.
    17:25:25.376    Reset performed on adapter COM5
    17:25:26.443    Adapter connected to COM5 opened
    17:25:31.554    Scan started
    17:25:33.110    Connecting to device
    17:25:38.231    Connected to device E8:20:9F:75:90:08: interval: 7.5ms, timeout: 4000ms, latency: 0
    17:25:38.258    ATT MTU updated for device E8:20:9F:75:90:08, new value is 185
    17:25:38.512    Attribute value read, handle: 0x03, value (0x): 41-4E-43-53-32
    17:25:43.285    Connection parameters updated for device E8:20:9F:75:90:08: interval 15ms, timeout 3000ms, latency: 0
    17:25:46.516    Security updated, mode:1, level:3
    17:25:46.566    Storing bond info for device E8:20:9F:75:90:08
    17:25:55.708    Attribute value changed, handle: 0x0E, value (0x): 02-00
    17:25:55.713    Attribute value written, handle: 0x0E, value (0x): 02-00
  • I can't erase the kit through nrfjprog or SEGGER Embedded Studio.

    nrfjprog --log --family nRF52 --eraseall
    WARNING: Logging is unavailable. nrfjprog.exe does not have write
    WARNING: permission for the log file
    ERROR: Unable to connect to a debugger.
    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: Semiconductor and provide the generated log.log file to them.
    NOTE: For additional output, try running again with logging enabled (--log).
    NOTE: Any generated log error messages will be displayed.

  • Hi, 

    The segger seems not to connect to your target. 

    Are you using nRF52832DK or a custom board? 

    Could you download the latest version of the Command line tool and try again?

    From the device and nRF Connect logs, I don't see any fail or error. How do you know it failed?

    -Amanda

  • Thanks for your reply! I am using custom board with jlink and connect to laptop through USB port. I will try command line tool tomorrow. Since nrf52832 device received BLE_GATTS_EVT_SYS_ATTR_MISSING event, I think it should not receive this event.

Reply Children
  • D:\Nordic>nrfjprog --log --family nRF52 --eraseall
    [error]: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".

    [error]: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".

    [error]: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".

    [error]: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".

    ERROR: Unable to connect to a debugger.
    [error]: [SeggerBackend] - JLinkARM.dll reported "-1", "An unknown error.".

    ERROR: JLinkARM DLL reported an error. Try again. If error condition
    ERROR: persists, run the same command again with argument --log, contact Nordic
    ERROR: Semiconductor and provide the generated log.log file to them.

    D:\Nordic>nrfjprog --version
    nrfjprog version: 10.17.0 external
    JLinkARM.dll version: 7.66a

  • Hi, 

    You will receive BLE_GATTS_EVT_SYS_ATTR_MISSING if the peer tries to read a CCCD that hasn't been set. When the BLE_GATTS_EVT_SYS_ATTR_MISSING event is received the application should do a sd_ble_gatts_sys_attr_set() function call, potentially giving back a set of previously set values. However, when not being bonded, it is expected to just pass NULL for the pointer, to reset the values.

    Take a look at this and this post from Devzone, it might be helpful.

    The erasse issue is handled by  https://devzone.nordicsemi.com/f/nordic-q-a/90510/nrfjprog-failed-to-erase-nrf52832-device  

    -Amanda

  • Thanks for your reply! I will add BLE_GATTS_EVT_SYS_ATTR_MISSING event handler on next monday.

  • I use nRF5_SDK_16.0.0\examples\dfu\secure_bootloader\pca10040_s132_ble_debug. But it enter DFU mode since "Boot validation failed. No valid app to boot". But since I would like nRF connect to trigger nRF52832 enter DFU. What should I change in secure_bootloader for supporting buttonless DFU OTA? 

    0> <info> app: Inside main
     0> <debug> app: In nrf_bootloader_init
     0> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
     0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
     0> <debug> nrf_dfu_settings: Using settings page.
     0> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
     0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
     0> <info> nrf_dfu_settings: Backing up settings page to address 0x7E000.
     0> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
     0> <debug> app: Enter nrf_bootloader_fw_activate
     0> <info> app: No firmware to activate.
     0> <info> app: Boot validation failed. No valid app to boot.
     0> <debug> app: DFU mode because app is not valid.
     0> <info> nrf_bootloader_wdt: WDT is not enabled
     0> <debug> app: in weak nrf_dfu_init_user
     0> <debug> app: timer_stop (0x20005980)
     0> <debug> app: timer_activate (0x20005980)
     0> <info> app: Entering DFU mode.
     0> <debug> app: Initializing transports (found: 1)
     0> <debug> nrf_dfu_ble: Initializing BLE DFU transport
     0> <debug> nrf_dfu_ble: Setting up vector table: 0x00072000
     0> <debug> nrf_dfu_ble: Enabling SoftDevice.
     0> <debug> nrf_dfu_ble: Configuring BLE stack.
     0> <debug> nrf_dfu_ble: Enabling the BLE stack.
     0> <debug> nrf_dfu_ble: No advertising name found
     0> <debug> nrf_dfu_ble: Using default advertising name
     0> <debug> nrf_dfu_ble: Advertising...
     0> <debug> nrf_dfu_ble: BLE DFU transport initialized.
     0> <debug> nrf_dfu_flash: Initializing nrf_fstorage_sd backend.
     0> <debug> app: Enter main loop

  • Hi, 

    The secure_bootloader supports buttonless DFU without other modifications. When the device enters DFU mode, DFU mode is indicated by LED 3 being lit. From the log, the secure_bootloader seems to go into the buttonless DFU. It should advertise "DfuTarg" as the name. You can check with the nRFConnect mobile app. 

    -Amanda

Related