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

cross mob
PascalS
Level 4
Level 4
25 replies posted 10 replies posted 10 questions asked

Hi,

how can I set the advertisement data "Manufacturer Specific Data" programmatically? I tried the API function CyBle_GapUpdateAdvData() but I can't find the according definition to update the manufacturer data.

I'm using PSoC Creator 4.2 and the CYBLE-212006-01 module.

Thanks!

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
1000 replies posted 5 likes given First comment on blog

Hello,

1. Can you please explain, how to update more than just 1 byte in the manufacturer data?

Ans:- We have to increase the data size in the BLE component as shown in attached image. Please make sure that the maximum length of the advertisement packet that we can send is limited to 31 bytes.

2. Am I right, that the defined "MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX  (28u)" refers to the marked index number in the picture?

Ans: Yes.

Thanks,

P Yugandhar.

View solution in original post

4 Replies
Yugandhar
Moderator
Moderator
Moderator
1000 replies posted 5 likes given First comment on blog

Hello,

Please refer the Day009_Dynamic_Broadcaster example project in the GitHub. In this example, manufacturer specific data is continuously updated in the firmware to demonstrate dynamic advertisement payload update feature.

Thanks,

P Yugandhar.

0 Likes

Hello,

I extracted this part of code:

extern CYBLE_GAPP_DISC_MODE_INFO_T cyBle_discoveryModeInfo;

#define advPayload                                  (cyBle_discoveryModeInfo.advData->advData)

#define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX    (28u) /* index of the dynamic data in the ADV packet */

#define LOOP_DELAY                                  (1u)  /* How often would you like to update the ADV payload */

#define MIN_PAYLOAD_VALUE                           (0u)

#define MAX_PAYLOAD_VALUE                           (200u)

   

void DynamicADVPayloadUpdate(void)

{

    if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE)

    {

        count++; /* Loop counter */

       

        /* Once the system enters Sleep/Deepsleep mode during advertisement, the source of wake-up is the next 

         * advertisement interval which has a wakeup interval of 1 advertisement (ADV) interval (100ms).

         * LOOP_DELAY * ADV interval is the interval after which ADV data is updated in this firmware.*/

       

        if(count >= LOOP_DELAY)

        {

            /* Dynamic payload will be continuously updated */

            advPayload[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX] = dynamicPayload++;

           

            if(dynamicPayload == MAX_PAYLOAD_VALUE)

            {

                dynamicPayload = MIN_PAYLOAD_VALUE;

            }

           

            count = 0;

           

            CyBle_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, cyBle_discoveryModeInfo.scanRspData);

        }

    }

}

Can you please explain, how to update more than just 1 byte in the manufacturer data?

Am I right, that the defined "MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX   (28u)" refers to the marked index number in the picture?

1.PNG

So I just have to extend the Data size in my BLE module and define some more number like this:

#define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_1    (29u)

#define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_2    (30u)

...

advPayload[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_1] = dynamicPayload++;

advPayload[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX_2] = dynamicPayload++;

My main aim is to broadcast the manufacturer device address to get a never changing and unique device identifier.

Is this aim covered by doing so?

Thanks!

0 Likes
lock attach
Attachments are accessible only for community members.
Yugandhar
Moderator
Moderator
Moderator
1000 replies posted 5 likes given First comment on blog

Hello,

1. Can you please explain, how to update more than just 1 byte in the manufacturer data?

Ans:- We have to increase the data size in the BLE component as shown in attached image. Please make sure that the maximum length of the advertisement packet that we can send is limited to 31 bytes.

2. Am I right, that the defined "MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX  (28u)" refers to the marked index number in the picture?

Ans: Yes.

Thanks,

P Yugandhar.

Hi Yugandhar,

could you please also see my post here?

Where to call CyBle_GetDeviceAddress() function?

Thanks!

0 Likes