Count the number of BLE Advertisement packets sent

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

cross mob
FNRo_3768601
Level 1
Level 1
First like given

Is there a way to count the number of BLE Advertisement packets sent out from a broadcaster (PSoC 4 BLE or PSoC 6 BLE) in a given period of time, say before advertisement timeout?

I want to compare this number with the number of packets received by a BLE observer, over a varying range of distance.

0 Likes
1 Solution

Hi Rohit,

     You can keep track of number of Advertisement events ( Ex : If you are using all the 3 ADV channels , then every ADV event ,3 ADV packets will be sent over the air).

To do this, you need to register the bless interrupt callback function.

1) For PSoC 4 BLE :- CyBle_RegisterBlessInterruptCallback()

2) For PSOC 6 BLE :- Cy_BLE_RegisterInterruptCallback()

Please let me know if it helps for you.

-Gyan

View solution in original post

0 Likes
4 Replies
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

You can use CyBle_GappSetNumOfAdvPkts() API for sending a fixed number of adv packets.

-Gyan

0 Likes

Thanks Gyan, this API may be useful for my case.

Two followup questions though:

1) For a given dynamic environment, it maybe hard for me to know before hand the number of packets that I have to send, say when the user presses a button to stop the advertising. In that case, I still need to count the packets on fly. Is there a Stack handler event that I can use to trackf each packet sent?

2) Is the CyBle_GappSetNumOfAdvPkts() API valid for PSoC 6 BLE? I tried variations like Cy_BLE_GAPP_SetNumOfAdvPkts() but could not find the API in my PSoC 6 BLE project. The BLE component is set in 'Broadcaster' role.

-Rohit

0 Likes

Hi Rohit,

     You can keep track of number of Advertisement events ( Ex : If you are using all the 3 ADV channels , then every ADV event ,3 ADV packets will be sent over the air).

To do this, you need to register the bless interrupt callback function.

1) For PSoC 4 BLE :- CyBle_RegisterBlessInterruptCallback()

2) For PSOC 6 BLE :- Cy_BLE_RegisterInterruptCallback()

Please let me know if it helps for you.

-Gyan

0 Likes

Hi Gyan,

I tried Cy_BLE_RegisterInterruptCallback() to record the number of advertisement packets sent from a broadcaster, based on number of BLESS interrupts I receive after starting the advertisement. Unfortunately, the numbers reported are way too less than I see on the BLE sniffer. I have accounted for counting three times for sending packets to channel 37,38 and 39 as well as other BLESS interrupts.

I have raised a Technical support case and hopefully will get this sorted out and shared here. Let me know if you have any ideas on what else I maybe missing.

Going back to my other question on 'CyBle_GappSetNumOfAdvPkts()', can you provide the correct API name that is used in PSoC 6 BLE and its respective event name?

-Rohit

0 Likes