128-bit UUID support on WICED SDK 3.3.1

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi.

I wish to know a work around for this and when will it be supported?

Currently, WICED SDK 3.3.1 claims to support BLE but misses out on the most important and basic requirement of being able to advertise Vendor Specific 128-bit UUID for custom services and characteristics.

This issue was identified while trying to customize the ble_proximity_reporter application. See question posted on the forum yesterday ...Wiced SDK 3.3.1: Customizing the ble proximity reporter for Vendor Specific Services and Attributes

I am still waiting on a workaround or an answer as to how to fix it or when will the fix be available?

Thanks!

Regards,

Manish

0 Likes
38 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

I checked with the developers on the BLE side (2073X/2070X) and they confirmed that the functionality you require is definitely included.

They realize that the API is not well documented, but they believe there is an API there that can be used to create any type of advertisement packet.

Unfortunately, it does not look like we provide a sample app.

They said to check if there is wiced_bt_ble_set_advertisement_data in the documentation or in the header files.

andrew997 gangi

0 Likes
Anonymous
Not applicable

So does this mean, there is an API in the WICED SDK 3.3.1 that will allow me to advertise BLE 128-bit UUID on the BCM943341 platform?

Please provide more details ... I will search for this API.

0 Likes
Anonymous
Not applicable

I have already modified my init function to do just that ... But this does not work, am I missing something? Is there a format in which the UUIDs should be set ...in the structure field uuid128? Also, check the flags that I set using the API wiced_bt_ble_set_advertisment_data()

/* Initialize Proximity Reporter */

static void ble_proximity_reporter_init( void )

{

    wiced_bt_ble_advert_data_t adv_data;

    wiced_bt_ble_128service_t  ble_adv_128_serv_data;

   

    /* Set the advertised service with 128-bit UUID */

    ble_adv_128_serv_data.list_cmpl = WICED_TRUE;

    ble_adv_128_serv_data.uuid128[0] = 0x06;

    ble_adv_128_serv_data.uuid128[1] = 0xF1;

    ble_adv_128_serv_data.uuid128[2] = 0x98;

    ble_adv_128_serv_data.uuid128[3] = 0x1E;

    ble_adv_128_serv_data.uuid128[4] = 0x47;

    ble_adv_128_serv_data.uuid128[5] = 0x7A;

    ble_adv_128_serv_data.uuid128[6] = 0x41;

    ble_adv_128_serv_data.uuid128[7] = 0x7F;

    ble_adv_128_serv_data.uuid128[8] = 0xA7;

    ble_adv_128_serv_data.uuid128[9] = 0x61;

    ble_adv_128_serv_data.uuid128[10] = 0x15;

    ble_adv_128_serv_data.uuid128[11] = 0x24;

    ble_adv_128_serv_data.uuid128[12] = 0x54;

    ble_adv_128_serv_data.uuid128[13] = 0xC4;

    ble_adv_128_serv_data.uuid128[14] = 0x52;

    ble_adv_128_serv_data.uuid128[15] = 0xD0;

   

    adv_data.p_services_128b = &ble_adv_128_serv_data;

   

    /* Set advertising data: device name and discoverable flag */

    adv_data.flag = BTM_BLE_ADVERT_TYPE_128SRV_COMPLETE;//0x06;

    wiced_bt_ble_set_advertisement_data( BTM_BLE_ADVERT_BIT_FLAGS | BTM_BLE_ADVERT_BIT_DEV_NAME | BTM_BLE_ADVERT_BIT_SERVICE_128, &adv_data );

    /* Enable privacy */

    wiced_bt_ble_enable_privacy( TRUE );

    /* Register for gatt event notifications */

    wiced_bt_gatt_register( &ble_proximity_gatt_cback );

    /* Initialize GATT database */

    wiced_bt_gatt_db_init( (uint8_t *) gatt_db, gatt_db_size );

    /* Enable Bluetooth LE advertising and connectability */

    /* start LE advertising */

    wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL );

    WPRINT_BT_APP_INFO( ("Waiting for proximity monitor to connect...\n") );

}

0 Likes
Anonymous
Not applicable

Basically, after compiling and downloading the binaries to run on BCM943341 eval board, I will show that on light blue it shows a different 128-bit UUID.

In essence the WICED SDK3.3.1 completely ignores the user specified UUID and randomly generates a new 128-bit UUID at compile time and probably dumps this new value into the DCT. When the application runs, it reads this new value ... So the problem is that "Is it possible that the SDK i.e 3.3.1 on BCM943341 has some code in the BLE stack that uses random UUID generation for some special case and considers the BLE Proximity Application as one such example of this case?IMG_7411.PNGIMG_7412.PNGIMG_7413.PNG

0 Likes

I have asked the AE team to respond.

0 Likes
Anonymous
Not applicable

A quick and dirty sample app that is advertising 128-bit UUID will be great ... I will also post my application in a zipped format, so that folks can test it out with the Light Blue App.

Thanks!

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

1. Please find the code attached. Place this under snip/bluetooth folder.

2. Compile the code using command:

    make.exe snip.bluetooth.hifitablet_attr_handler-BCM943341WCD1

3. Download and run the code using command:

    make.exe snip.bluetooth.hifitablet_attr_handler-BCM943341WCD1 download run

4. Open the LightBlue app on the ios device and connect to the HiFiTablet service.

Please let me know, if you are not able to reproduce the issue.

Thanks!

Regards,

Manish

0 Likes
lock attach
Attachments are accessible only for community members.

I asked one of our developers to look through the code you provided and he found a couple of issues:

1. Given the dev name they’re using, they’re trying to include 33 bytes into the advertisement payload, ie:

  • ADVERT_BIT_FLAGS data = 1B Length + 1B Type + 1B Data = 3 Bytes
  • ADVERT_BIT_DEV_NAME data = 1B Length + 1B Type + 10B Data (“HiFiTablet”) = 12 Bytes
  • ADVERT_BIT_SERVICE_128 data = 1B Length + 1B Type + 16B Data = 18 Bytes
  • TOTAL = 3 + 12 +18 = 33 Bytes (too large)

2. You are also not configuring it correctly in your code.

So essentially, you need to keep in mind that that max adv data payload is 31 bytes, so the ADVERT_BIT_FLAGS data + ADVERT_BIT_DEV_NAME data + ADVERT_BIT_SERVICE_128 data needs to add up to no more than 31 bytes, or else the 128bit service data will not be included.

Below is an example of how you should be setting this up if you want all three of these advertising data elements included.

Attached is also a capture of the advertisement data with this change to ble_proximity_reporter captured OTA.

    wiced_bt_ble_128service_t my_128bit_service_uuid;
    uint8_t i;

    memset( &adv_data, 0, sizeof( wiced_bt_ble_advert_data_t ) );
    memset( &my_128bit_service_uuid, 0, sizeof( my_128bit_service_uuid ) );

    adv_data.flag = BTM_BLE_GENERAL_DISCOVERABLE_FLAG | BTM_BLE_BREDR_NOT_SUPPORTED;

    my_128bit_service_uuid.list_cmpl = TRUE;

    for ( i = 0; i < 16; i++ )
    {
        my_128bit_service_uuid.uuid128 = i;
    }

    adv_data.p_services_128b = &my_128bit_service_uuid;

    wiced_bt_ble_set_advertisement_data( BTM_BLE_ADVERT_BIT_FLAGS | BTM_BLE_ADVERT_BIT_SERVICE_128 | BTM_BLE_ADVERT_BIT_DEV_NAME, &adv_data );

andrew997 john.battin gangi vik86 seyhan j.t

0 Likes
Anonymous
Not applicable

Hi,

I tried the fix that you provided.

The service UUID seems to not change after every download and reset. However, it still misses to advertise the UUID that I have set in the GATT.

//let kUUID_TabletService                     = "06F1981E-477A-417F-A761-152454C452D0" //this is what the UUID should appear as in the iOS-App/LightBlue

#define __UUID_TABLET                                   0xd0, 0x52, 0xc4, 0x54, 0x24, 0x15, 0x61, 0xa7, 0x7f, 0x41, 0x7a, 0x47, 0x1e, 0x98, 0xf1, 0x06

#define __UUID_TABLET_BATTERY_LEVEL                     0x7b, 0x31, 0x03, 0x2f, 0x14, 0x64, 0x6c, 0x89, 0xb3, 0x4e, 0xcb, 0xbc, 0x65, 0x79, 0x74, 0x45

#define __UUID_TABLET_TABLET_NAME                       0xba, 0xdf, 0x6d, 0xcd, 0x6a, 0x40, 0xd5, 0x9f, 0x32, 0x4f, 0xd3, 0xf3, 0xa4, 0x70, 0xf9, 0xa6

Also, in the sample code recommended in the earlier post, I don't understand why do you set the uuid to 0..15

for ( i = 0; i < 16; i++ )

    {

        my_128bit_service_uuid.uuid128 = i;

    }

0 Likes
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

"Also, in the sample code recommended in the earlier post, I don't understand why do you set the uuid to 0..15", this was just an example of how to set the service uuid in the advertisement data. You can look at the .png file that mwf_mmfae attached which is an OTA capture showing the updated advertisment data. You'll see the Complete List of 128-bit UUID with UUID = 0...15. The for loop should be replaced by you with whatever service uuid you want to include in your adv data.

Please keep in mind you will not be able to include 3 128-bit service uuids in the adv data because it's too big.

For the #defines you're updating, it looks like you're actually including 3 128-bit services in the GATT database, and not the adv data, right? A GATT client will not see these service uuids until Service Discovery is performed.

0 Likes
Anonymous
Not applicable

Actually, I did change the uuid[16] bit array to include my service UUID,

See code below ... I have tried both endian-ness and I don't see the service UUID in light blue ..

/* Initialize Proximity Reporter */

static void ble_proximity_reporter_init( void )

{

  wiced_bt_ble_advert_data_t adv_data;

   

    wiced_bt_ble_128service_t my_128bit_service_uuid;

    uint8_t i;

    memset( &adv_data, 0, sizeof( wiced_bt_ble_advert_data_t ) );

    memset( &my_128bit_service_uuid, 0, sizeof( my_128bit_service_uuid ) );

    adv_data.flag = BTM_BLE_GENERAL_DISCOVERABLE_FLAG | BTM_BLE_BREDR_NOT_SUPPORTED;

    my_128bit_service_uuid.list_cmpl = TRUE;

    my_128bit_service_uuid.uuid128[15] = 0x06;

    my_128bit_service_uuid.uuid128[14] = 0xF1;

    my_128bit_service_uuid.uuid128[13] = 0x98;

    my_128bit_service_uuid.uuid128[12] = 0x1E;

    my_128bit_service_uuid.uuid128[11] = 0x47;

    my_128bit_service_uuid.uuid128[10] = 0x7A;

    my_128bit_service_uuid.uuid128[9] = 0x41;

    my_128bit_service_uuid.uuid128[8] = 0x7F;

    my_128bit_service_uuid.uuid128[7] = 0xA7;

    my_128bit_service_uuid.uuid128[6] = 0x61;

    my_128bit_service_uuid.uuid128[5] = 0x15;

    my_128bit_service_uuid.uuid128[4] = 0x24;

    my_128bit_service_uuid.uuid128[3] = 0x54;

    my_128bit_service_uuid.uuid128[2] = 0xC4;

    my_128bit_service_uuid.uuid128[1] = 0x52;

    my_128bit_service_uuid.uuid128[0] = 0xD0;

  

#if 0  

    for ( i = 0; i < 16; i++ )

    {

        my_128bit_service_uuid.uuid128 = i;

    }

#endif

    adv_data.p_services_128b = &my_128bit_service_uuid;

    wiced_bt_ble_set_advertisement_data( BTM_BLE_ADVERT_BIT_FLAGS | BTM_BLE_ADVERT_BIT_SERVICE_128 | BTM_BLE_ADVERT_BIT_DEV_NAME, &adv_data );

    /* Enable privacy */

    wiced_bt_ble_enable_privacy( TRUE );

    /* Register for gatt event notifications */

    wiced_bt_gatt_register( &ble_proximity_gatt_cback );

    /* Initialize GATT database */

    wiced_bt_gatt_db_init( (uint8_t *) gatt_db, gatt_db_size );

    /* Enable Bluetooth LE advertising and connectability */

    /* start LE advertising */

    wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL );

    WPRINT_BT_APP_INFO( ("Waiting for proximity monitor to connect...\n") );

}

0 Likes
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

Are you able to get an OTA capture? Also, did you shorten your device name? HiFiTablet” is too long if you're trying to include this + the 128-bit service uuid.

0 Likes
Anonymous
Not applicable

I don't have an OTA capture. But I will shorten the name and try again.

0 Likes
Anonymous
Not applicable

Which tool or sniffer do you use for an OTA capture?

andrew997

0 Likes
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

I typically use the Frontline BPA 600. Others in our group also use the Ellisys OTA capture tool.

0 Likes
Anonymous
Not applicable

Besides the instrument or the equipment, wireshark on the PC should be able to parse the packets or you use some special software ... does the wiced include anything

0 Likes
Anonymous
Not applicable

You may want to try this tool:

Bluetooth Trace Tool

It works on a Windows laptop with a BCM20702-based USB dongle.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi.

I am having a problem seeing my characteristics ... Right now, I am at the point where my service is being advertised properly with 128 bit UUIDs but only one characteristics (also 128-bit UUIDs) out of 3 are being discovered as part of this service by the iPhone client ... and that is always the first characteristic that appears immediately after my primary service.

With other SDK, say from nordic, once you register a primary service with a UUID with the BLE stack, the lower layer returns a handle that you use with characteristics to associate with your primary service.

Seems like that WICED SDK 3.3.1 with BCM943341WCD1, I am not able to figure out a similar functionality. Attaching and example code to try this out ... You an #if 0 ... #endif in wiced_gatt_db.{h, c} to see how a single characteristic shows up on light blue, but if you include another, it does not show up.

Thanks!

Regards,

Manish

0 Likes
lock attach
Attachments are accessible only for community members.
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

Regarding your gatt db definition, I'm not sure why you were including additional bytes after the characteristic macro definition. If you were trying to set the default characteristic value, please look at the ble_proximity_reporter sample app and you'll see that the characteristic value is manage by the app using a global variable. I'm attaching you're gatt db that I modified and also verified that I'm able to discover all 4 of your characteristics using my phone app.

For the WICED SDK when defining your gatt database, we use macros, as you can see in the sample apps, where the app defines the handles for the service, characteristic declaration, characteristic value, etc, and you register them with our stack. Then in the gatt callback, we use the appropriate handle for the given gatt operation.

Regards,

Jay

0 Likes
Anonymous
Not applicable

Jay,

Hi.

Those extra bytes were generated by the WICED Sense BLE designer ... I just used them as is. Now come to think of it, I should have kept it consistent with the way the BLE Proximity Reporter app has done.

Anyways, with those changes I am able to see 4 characteristics (identified by unique 128-bit UUID) being advertised as part of my 128-bit service UUID.

Thanks.

(this resolves the question posted in this thread).

Regards,

Manish

0 Likes

One thing to note here is that the SmartReady SDK will include a version of the SmartDesigner as well, however, within the SmartReady SDK you will have the option to save the generated code as Smart (20736/20737) or Smart
Ready (20706/WICED).

The SmartReady version of the code would have worked here, but of course the SmartReady SDK has yet to be released to the public.

I learned this from the developers and thought I'd add it to the thread just in case someone comes across the same issue in the future.

0 Likes
Anonymous
Not applicable

I am not able to send update notifications for a characteristic that has been subscribed by my iPhone app ...

The characteristic is added correctly as a both Notify and Indicate.

/* Characteristic 'status' */

    //<Name>status</Name>

    //<Uuid>D7 C9 C1 95 B2 2B 45 10 82 73 D2 49 48 3A 97 7E</Uuid>

    CHARACTERISTIC_UUID128 (HDLC_TABLET_STATUS,

            HDLC_TABLET_STATUS_VALUE,

            __UUID_TABLET_STATUS,

            LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY | LEGATTDB_CHAR_PROP_INDICATE,

            LEGATTDB_PERM_READABLE),

           

Why don't I get the subscription or read request for this characteristic ... I have the appropriate handle for it in the read request call back? Have I missed anything.

0 Likes
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

When a GATT client subscribes for Notifications/Indications, it should write to the Client Characteristic Configuration Descriptor for the Characteristic of interest. This will need to be managed by your app.

Independent of this, I believe you should still be able to send a Notification to your iPhone using the wiced_bt_gatt_send_notification() API. Are you using this with the proper connection ID?

You won't see a Read Request unless you try to specifically read the characteristic value. Notification and Reads are independent of each other.

0 Likes
Anonymous
Not applicable

Jay,

Hi.

Is there an example that I can checkout ... doesn't matter whether its wiced smart or smart ready?

let me know ...

Thanks!

Regards,

Manish

0 Likes
lock attach
Attachments are accessible only for community members.
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

Hi Manish,

The attached is from the SmartReady SDK. If it's not in the release you currently have, it will be in the next release coming shortly.

Check out the hci_control_le_data_xfer_ccc variable which holds the value for the Client Characteristic Configuration Descriptor for the Data Xfer characteristic. If the client is registered to receive Notification or Indications, we send the notification/indication with the data.


Cheers,

Jay

0 Likes
Anonymous
Not applicable

Jay,

Hi.

The send notification functions does not result in notifications being sent out whenever the status is updated...

I call this send notification function like this:

wiced_bt_gatt_send_notification (ble_client_conn_id, HDLC_TABLET_STATUS_VALUE, sizeof(tablet_device_status), (uint8_t*)&tablet_device_status);

The device status is typedef'ed (in a header file) as follows:

typedef struct

{

    uint8_t                         current_tablet_ownership;    

   uint8_t                         current_device_battery_level; /

} tablet_device_status_result_t;

In the C file that handles all the read/write callbacks from GATT, I also call the wiced_bt_send_notification, whenever the device status changes ...

/* This structure is populated with status information about the Tablet. Currently it indicates about battery and ownership */

static tablet_device_status_result_t  tablet_device_status;

What I want  to know is that for this API:

wiced_bt_gatt_status_t wiced_bt_gatt_send_notification (uint16_t conn_id, uint16_t attr_handle, uint16_t val_len, uint8_t *p_val );

(1) the handle is the HDLC handle of the status characteristic value. That should work?

(2) what about p_val? I currently pass an address of the variable declared statically in my C file.

0 Likes
Anonymous
Not applicable

The return status from the wiced_bt_gatt_send_notification() is 0, which is SUCCESS?

But I don't even get the initial value of 100 that I have initialized the battery value to.

0 Likes
Anonymous
Not applicable

Getting WICED_BT_GATT_INTERNAL_ERROR whenever I call wiced_bt_gatt_send_notification()

0 Likes

Manish,

Jay would like to review your full source.

Since I'm guessing you will not be comfortable posting it here on the forum, when you have a chance could you put it together in a zip file and send it to us at communities-list@broadcom.com.

This is the admin reflector I maintain for the community.  Once the source comes in, I will forward internally to Jay for review.

0 Likes
Anonymous
Not applicable

I have send the code out to the email.

Please let me know if you run into any issues.

Thanks!


Regards,

Manish

0 Likes

Confirming receipt and that the code was forwarded.  Please allow 1-2 days for the review and follow on comments from jguillor

0 Likes

Manish,

We should have working code for you today.  However, I do not want to attach here to the discussion.

Since our Dedicated WICED Distribution partner FAEs are large contributors to our success with these products, I would like to provide the code to the Distribution FAE that you have been working with locally so that he can send to you and continue to support you through this process.

jguillor andrew997 john.battin gangi

0 Likes

The updated/verified code has been passed on to the local FAE to deliver per the previous instructions.

0 Likes
Anonymous
Not applicable

Hi.

I am still getting the following errors just when I receive the client configuration that enables the notification ...

Status client configuration changed to 1

00006049 GKI_exception(): Task State Table

00006049 GKI_exception(): Task State Table

00006053 GKI_exception 65524 getbuf: out of buffers

00006057 GKI_exception 65524 getbuf: out of buffers

@@@@@@@@@@@@@@@@@@@ Send notification status = 128 => WICED_BT_GATT_NO_RESOURCES.

Please help.

Thanks!

Regards,

Manish

0 Likes
JayG_26
Employee
Employee
50 sign-ins 5 replies posted 10 questions asked

Hi Manish,

Did you get the files from the disty FAE yet? If so, you shouldn't see this assuming you're testing it as is. I verified everything with the iPhone.

Regards,

Jay

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Jay,

Hi.

I got the fix through the FAE distributor.

I tried the fix. Registered for notification through light blue. And waited for values to show up, but it did not. The initial value showed was 0x5F which is 95% in terms of battery percentage.

Waited for more values to get updated (basically decremented). They do, whenever you try to read another attribute or characteristic.

Did not see these updates getting notified. So stopped the notifications and then the client disconnected.

I have attached the logs. I still see 0x129 as the return status, which implies WICED_BT_GATT_INTERNAL_ERROR. Also, I run out of buffers as well.

Please let me know, how can I resolve this. The code is as is and has not been changed.

attaching logs.

thanks!

Regards,

Manish

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Another log, this time, I could get new values notified, but still disconnects and runs out of buffers.

0 Likes
Anonymous
Not applicable

My bad, I did not do a make clean ... Just did a "make download run". Assumed that that would take care of everything.

Thanks Jay.

0 Likes