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

Buttonless DFU Service characteristics values

Hi,

Here is my issue, I don't enter in bootloader by using the buttonless DFU characteristic. Here below I expose my action and what it happens.
Thank you in advance for your help.

Set-up : nRF5_SDK_13.0.0_04a0bfd, Eclipse 2019 03 IDE, NRF52832_xxAA, s132_nrf52_4.0.2_softdevice, windows 64 bits, NRFConnect 4.22.3, JLINK RTT Viewer

From NRFConnect I go in Secure DFU Service and in Buttonless DFU I click on the button so that indication enabled is sent, then the log display:

-> Data written to 00002902-0000-1000-8000-00805f9b34fb value : (0x) 02-00 "Indication enabled" sent.

I put some NRF_LOG_INFO and SEGGER_RTT_Write in different functions of the ble_dfu.c :

In the switch of void ble_dfu_on_ble_evt(ble_dfu_t * p_dfu, ble_evt_t * p_ble_evt),

in each case function : on_rw_authorize_req(p_dfu, p_ble_evt) , on_write(p_dfu, p_ble_evt); on_hvc(p_dfu, b p_ble_evt)

in function static void on_ctrlpt_write(ble_dfu_t * p_dfu, ble_gatts_evt_write_t const * p_evt_write)

I can notice in JRTT Viewer that the program enters into the function static void on_write(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt) and goes into : if (p_evt_write->handle != p_dfu->control_point_char.cccd_handle), I got a return so they are different... (17 and 23)

:INFO:Enter on_write function ' DFU'
:INFO:p_evt_write->handle 17, p_dfu->control_point_char.cccd_handle 23

From that constat, I have different questions :
Why do I get different values of cccd?
What does represent this value of cccd and where is it set initially ?

When I click on the button of Buttonless DFU to send Request, the program enters in the function static void on_rw_authorize_req(ble_dfu_t * p_dfu, ble_evt_t const * p_ble_evt)
I got log :

INFO:on_rw_authorize_req' DFU'

but it doesn't pass the IF condition :
if (
(p_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_WRITE)
&&
(p_auth_req->request.write.handle == p_dfu->control_point_char.value_handle)
&&
(p_auth_req->request.write.op != BLE_GATTS_OP_PREP_WRITE_REQ)
&&
(p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)
&&
(p_auth_req->request.write.op != BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL)
)
{
on_ctrlpt_write(p_dfu, &p_auth_req->request.write);
}

I got with my SEGGER_RTT :
0> p_auth_req->request.write.handle 16, p_dfu->control_point_char.value_handle 22

Same questions :
Why do I get different values of cccd?
What does represent this value of cccd and where is it set initially ?

As in consequence, it doesn't execute the function on_ctrlpt_write which call the function enter_bootloader...

Parents
  • Can you explain a bit what the issue is and what you do that causes the application to enter the on_write() callback?

    The CCCD characteristic is the one that controls whether notifications are on (0x01) or off (0x00) (or indication = 0x02, but that is not used in the bootloader). 

    What are you connecting with? nRF Connect? Desktop or Mobile?

    Does the log from the other device tell you anything?

    Best regards,

    Edvin

  • Hi Edvin,

    I'm connectinf with nRF Connect Mobile (Android). 

    I think I have found the reason of my issue. 

    In the file ble_dfu.c, I had done a copy-past of the function buttonless_char_pt_add in order to add two more function add characteristics "DFU Control Point" and "DFU Packet". I wrongly thought they were missing firstly.

    I removed them and it works fine, I can now enter in bootloader DFU mode with nRF Connect phone and the Buttonless DFU Service. 

    I think there was a conflict with the control point cccd handle.

    With my SDK 13.0.0, the application (ble_dfu.c) waits for indication enabled and not notification as I could read for other SDK version. So it's right to send the value 0x02.

    Thank you.

    Best regards,

    Alan

Reply
  • Hi Edvin,

    I'm connectinf with nRF Connect Mobile (Android). 

    I think I have found the reason of my issue. 

    In the file ble_dfu.c, I had done a copy-past of the function buttonless_char_pt_add in order to add two more function add characteristics "DFU Control Point" and "DFU Packet". I wrongly thought they were missing firstly.

    I removed them and it works fine, I can now enter in bootloader DFU mode with nRF Connect phone and the Buttonless DFU Service. 

    I think there was a conflict with the control point cccd handle.

    With my SDK 13.0.0, the application (ble_dfu.c) waits for indication enabled and not notification as I could read for other SDK version. So it's right to send the value 0x02.

    Thank you.

    Best regards,

    Alan

Children
No Data
Related