Event for 'Just sent Advertising Packet'

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

cross mob
Anonymous
Not applicable

Is there any way to trigger an event on the client when the client sends an advertising packet?  My application is sending out packets every 50ms for multiple peripherals to synchronize to, but I want the client to also synchronize to this 50ms signal.

   

I've tried starting timer for 50ms when the ADVERTISEMENT_START_STOP event triggers, but it ends up being out of sync.

   

Any ideas?

0 Likes
1 Solution
Anonymous
Not applicable

Look up the documentation for the function CyBle_GetBleSsState(), one of the response values is CYBLE_BLESS_STATE_EVENT_CLOSE which indicates that the Tx/Rx from the radio has finished sending; If you poll this and look for a change from EVENT_CLOSE to an active state (not EVENT_CLOSE), then you can use it to find a synchronized advertisement packet edge for "clocking". 

   

I'm not entirely sure about the exact implementation, but I believe this contains the information/events that you are looking for 🙂

View solution in original post

0 Likes
5 Replies
Anonymous
Not applicable

Look up the documentation for the function CyBle_GetBleSsState(), one of the response values is CYBLE_BLESS_STATE_EVENT_CLOSE which indicates that the Tx/Rx from the radio has finished sending; If you poll this and look for a change from EVENT_CLOSE to an active state (not EVENT_CLOSE), then you can use it to find a synchronized advertisement packet edge for "clocking". 

   

I'm not entirely sure about the exact implementation, but I believe this contains the information/events that you are looking for 🙂

0 Likes
Anonymous
Not applicable

Awesome thank you!

0 Likes
Anonymous
Not applicable

Yes, you can poll the Bless State and determine if the state is EVENT_CLOSE. A better approach to determine close of an advertisement event would be to check for the CYBLE_ISR_BLESS_ADV_CLOSE event. This event is available in v3.30 of the BLE component. You will have to initially use the CyBle_RegisterBlessInterruptCallback() API to register this event and a callback for this. This is more like an interrupt-based approach.

0 Likes
Anonymous
Not applicable

This looks like a much cleaner approach! I'm curious why this event isn't piggybacked into the events being passed from the CyBle_Start(); callback handler? It would simplify code I would expect.

0 Likes
Anonymous
Not applicable

The CYBLE_ISR_BLESS_ADV_CLOSE event is triggered in sync with the actual BLESS states. Unlike the generic event handler, wherein the callback is called upon the CyBle_ProcessEvents() API call, this callback is called automatically. That is why it is not included in the main callback.

0 Likes