adding dfu service, uuid shows dfu uuid but characteristic shows base uuid..

My project is based on 'ble_app_uart' and I added dfu service..

so there's two custom 128bit uuid in my project..

But before this, I only want to test dfu service mode so I comment base uuid (for ble), and I set dfu uuid.. like this.

    ble_uuid_t m_adv_uuids[] = {{BLE_DFU_SERVICE_UUID, NUS_SERVICE_UUID_TYPE+1}};

1. The reason for increasing the type value +1 is referring to this post.
Otherwise, uuid shows 0000 value..

2. So, advertising uuid shows right value.. but when I try to connect, then service characterisitc value is base uuid value.. not dfu value.

Why this problem is happening?

(this is dfu UUID)

#define BLE_DFU_SERVICE_UUID            0xFE59

#define BLE_NORDIC_VENDOR_BASE_UUID \
{{ \
0x50, 0xEA, 0xDA, 0x30, 0x88, 0x83, 0xB8, 0x9F, \
0x60, 0x4F, 0x15, 0xF3, 0x00, 0x00, 0xC9, 0x8E \
}}

ble_uuid_t m_adv_uuids[] = {{BLE_DFU_SERVICE_UUID, NUS_SERVICE_UUID_TYPE+1}};

( and my base custom 128bit UUID is defined like this.. )

#define BLE_UUID_WIFI_CONN_RES 0x0007 //me tx
#define BLE_UUID_WIFI_CONN_REQ 0x0006 //me rx
#define BLE_UUID_WIFI_TX_CHAR 0x0005
#define BLE_UUID_WIFI_RX_CHAR 0x0004
#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0003 /**< The UUID of the TX Characteristic. */
#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0002 /**< The UUID of the RX Characteristic. */

#define BLE_NUS_MAX_RX_CHAR_LEN BLE_NUS_MAX_DATA_LEN /**< Maximum length of the RX Characteristic (in bytes). */
#define BLE_NUS_MAX_TX_CHAR_LEN BLE_NUS_MAX_DATA_LEN /**< Maximum length of the TX Characteristic (in bytes). */

#define NUS_BASE_UUID {{0x4f, 0xc2, 0x6e, 0x15, 0xbf, 0x62, 0x07, 0xbe, 0x88, 0x4d, 0x92, 0x7a, 0x00, 0x00, 0xd8, 0xf6}}

and can you recommend using two custom uuid example?

Thank you..

Parents
  • Hi,

    I am a bit confused. You write about DFU but refer to the NUS UUID. I am not sure about the link here? The DFU UUID is a registered 16 bit UUID BLE_DFU_SERVICE_UUID, and the NUS UUID is a custom UUID that is not registered, so they are different. I am having problems understanding why you are combining the DFU UUID with the NUS type? 

    1. The reason for increasing the type value +1 is referring to this post.
    Otherwise, uuid shows 0000 value..

    The type is really just a handle for the UUID base, and that is incremented each time a new base is added. So I cannot say if incrementing by 1 is correct in your case or not, as it depends on the order you add base UUIDs (if this is the problem you could just experiment though, as I assume you do not have that many different base UUIDs?).

    2. So, advertising uuid shows right value.. but when I try to connect, then service characterisitc value is base uuid value.. not dfu value.

    The array of advertised UUIDs (your m_adv_uuids) is completely independent, so if you make a mistake here or where you add your services, those will not be the same. If you needed to add 1 to the base you also , you will also need to add 1 elsewhere.

    and can you recommend using two custom uuid example?

    The NUS examples are good demonstrations of a custom service. The only thing to note if you want to use two custom services is that the type is incremented for each base you add as mentioned, so when referring to the second add +1, or better, simply refer to the type you get from the call to sd_ble_uuid_vs_add(), as the second parameter there is an output that is set to the type.

Reply
  • Hi,

    I am a bit confused. You write about DFU but refer to the NUS UUID. I am not sure about the link here? The DFU UUID is a registered 16 bit UUID BLE_DFU_SERVICE_UUID, and the NUS UUID is a custom UUID that is not registered, so they are different. I am having problems understanding why you are combining the DFU UUID with the NUS type? 

    1. The reason for increasing the type value +1 is referring to this post.
    Otherwise, uuid shows 0000 value..

    The type is really just a handle for the UUID base, and that is incremented each time a new base is added. So I cannot say if incrementing by 1 is correct in your case or not, as it depends on the order you add base UUIDs (if this is the problem you could just experiment though, as I assume you do not have that many different base UUIDs?).

    2. So, advertising uuid shows right value.. but when I try to connect, then service characterisitc value is base uuid value.. not dfu value.

    The array of advertised UUIDs (your m_adv_uuids) is completely independent, so if you make a mistake here or where you add your services, those will not be the same. If you needed to add 1 to the base you also , you will also need to add 1 elsewhere.

    and can you recommend using two custom uuid example?

    The NUS examples are good demonstrations of a custom service. The only thing to note if you want to use two custom services is that the type is incremented for each base you add as mentioned, so when referring to the second add +1, or better, simply refer to the type you get from the call to sd_ble_uuid_vs_add(), as the second parameter there is an output that is set to the type.

Children
  • Hi,

    There is a lack of complete understanding of bleuuid.
    Let me summarize and explain again.

    I am having problems understanding why you are combining the DFU UUID with the NUS type? 

    It is my mistake to define DFU uuid as custom uuid.
    I changed it to 16 bit UUID BLE_DFU_SERVICE_UUID and redefined it.

    ble_uuid_t m_adv_uuids[] = {{BLE_DFU_SERVICE_UUID, BLE_UUID_TYPE_BLE}};

    After that, I try to connect My Device using nRF Connect app first.
    It says 'DFU Service' as below

    But when I try to pair it with my device,
    The DFU Service cannot be found due to the following problems.

       

    F6D8000-... < this is my custom uuid characteristic.

    Why it find base uuid service, not dfu service? Why can't I find my DFU service?

    this is nRF Toolbox.

    I hope this explanation is delivered well.
    I'll ask you again if there's anything I don't understand.

     

    BR,

    lyrics

  • Hi Lyrics,

    There are a few things:

    1. Adding a DFU in the advertising packet adds it just there, it does not add the service etc. to your application. Have you done that?
    2. As this is your application, you probably do not want to add the DFU service UUID (0xFE59), as this is used in the bootloader which implements DFU. If you just want an application that support buttonless DFU, you have to include the DFU service by doing exactly the same as is demonstrated in the Buttonless DFU Template Application.
    3. There is normally no point in adding the DFU service UUID in the advertising packet at all. You would still see it after connecting and doing service discovery. (If you look at the buttonless application you will see that it does not include the buttonless DFU service).

    In short, there seems to be a lot of confusion so I really suggest spending time to understand the example before you continue.

Related