psoc 4 ble discovery problem

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

cross mob
tach_2256911
Level 1
Level 1

when CYBLE_EVT_GAP_DEVICE_CONNECTED comes, I use CyBle_GattcStartDiscovery() to discover services of slave device.  Then the code in the main loop can not run, such as the LED blink. It seems like that the interrupt of BLE is always work. When CYBLE_EVT_GATTC_DISCOVERY_COMPLETE comes, the code in the main loop can run again. What is the reason, and how can i solve this problem.

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

Hi,

I guess you are calling the CyBLE_ProcessEvents() API in the main for loop. The execution of all the events which are in queue happens after calling the CyBLE_ProcessEvents() API. Please note that this is recommended practice to give importance to BLE events. Else the application may not work properly.

Some tips:

Please note that it is recommended to call the CyBLE_ProcessEvents() API atleast once in every connection interval. So you can configure a special timer and call the API inside that timer ISR.

You can also configure another timer and call all your LED specific events in that timer ISR. You can give priority of this ISR more than than that of ISR above (which calls CyBLE_ProcessEvents() API).

Please note that in any case the BLESS interrupt should have highest priority.

Thanks

Ganesh

View solution in original post

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

Hi,

I guess you are calling the CyBLE_ProcessEvents() API in the main for loop. The execution of all the events which are in queue happens after calling the CyBLE_ProcessEvents() API. Please note that this is recommended practice to give importance to BLE events. Else the application may not work properly.

Some tips:

Please note that it is recommended to call the CyBLE_ProcessEvents() API atleast once in every connection interval. So you can configure a special timer and call the API inside that timer ISR.

You can also configure another timer and call all your LED specific events in that timer ISR. You can give priority of this ISR more than than that of ISR above (which calls CyBLE_ProcessEvents() API).

Please note that in any case the BLESS interrupt should have highest priority.

Thanks

Ganesh

0 Likes