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

Advertising 128 bit UUID wrong parameter

Hi,

I already used the sd_ble_uuid_vs_add for adding my base UUID in the internal table and it return a valid uuid_type (in my specific case it's 0x06). I need to add my UUID service into the advertising packet. The UUIDs array is defined as follow :

ble_uuid_t m_adv_uuids[] = {{BLE_UUID_COM_SERVICE,m_com.uuid_type}};

but I receive the err_code = 7 (NRF_ERROR_INVALID_PARAMETER) from the ble_advdata_set function. I'm sure that m_com.uuid_type has the right value because I print it on the console (its value is 0x06).

Why ?

Thanks, Paolo.

Parents
  • I see following .... The ble_advdata_set is calling twice, the first time from ble_advertising_init and the second one from ble_advertising_start. The ble_advertising_init is called inside the function I create the m_adv_uuids array and set it to the ble_advdata_t (in the uuid_complete.p_uuids). Inside, the function ble_advertising_init saves this pointer with following code :

    m_advdata.uuids_complete       = p_advdata->uuids_complete;
    

    Of course this pointer is valid at first call (it's on the stack) but not valid in the second one.

    It means that my m_adv_uuids[] must be defined static and filled when I have the right value for m_com.uuid_type. Now it works. Is it the right way ?

    I didn't find any good documentation about it.

    Thanks, Paolo.

Reply
  • I see following .... The ble_advdata_set is calling twice, the first time from ble_advertising_init and the second one from ble_advertising_start. The ble_advertising_init is called inside the function I create the m_adv_uuids array and set it to the ble_advdata_t (in the uuid_complete.p_uuids). Inside, the function ble_advertising_init saves this pointer with following code :

    m_advdata.uuids_complete       = p_advdata->uuids_complete;
    

    Of course this pointer is valid at first call (it's on the stack) but not valid in the second one.

    It means that my m_adv_uuids[] must be defined static and filled when I have the right value for m_com.uuid_type. Now it works. Is it the right way ?

    I didn't find any good documentation about it.

    Thanks, Paolo.

Children
Related