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

cross mob
johnspeth
Level 2
Level 2
10 sign-ins 5 replies posted 5 questions asked

Can anyone tell me the execution context of the callback function passed to Cy_BLE_Start()? Is it the same execution context as Cy_BLE_ProcessEvents() or is it executing in an interrupt?

I debugged to the first line in the callback function and it shows a continuous call stack through Cy_BLE_ProcessEvents() right up to main() but I'm not 100% sure that it's accurate evidence of the same execution context.

I need to know because of my application will access data blocks in the callback function and the main loop so I need to protect the data block integrity if the execution contexts are different.

Thanks - JJS

0 Likes
1 Solution
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

The function passed to Cy_BLE_Start() will get executed only when the Cy_BLE_ProcessEvents() function is called. It will not execute on BLE interrupt.

The BLE interrupts are handled by the core automatically and the data will be stored in the buffers. Only when the user calls the Cy_BLE_ProcessEvents(), the function passed to Cy_BLE_Start() will be executed. so instead of calling it as a callback function, it is better to call it as Event Handler.

Hope this information helps!

Thanks and regards

Ganesh

 

View solution in original post

0 Likes
2 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

The function passed to Cy_BLE_Start() will get executed only when the Cy_BLE_ProcessEvents() function is called. It will not execute on BLE interrupt.

The BLE interrupts are handled by the core automatically and the data will be stored in the buffers. Only when the user calls the Cy_BLE_ProcessEvents(), the function passed to Cy_BLE_Start() will be executed. so instead of calling it as a callback function, it is better to call it as Event Handler.

Hope this information helps!

Thanks and regards

Ganesh

 

0 Likes

Thanks, Ganesh for the confirmation. It was helpful. - JJS

0 Likes