Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

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

cross mob
DaCh_1995281
Level 3
Level 3
First solution authored 10 sign-ins 10 questions asked

Hi,

We are trying to  solve a problem with the BLE system randomly failing while the device is connected to a peripheral and sending data. Upon failure Cy_BLE_GATT_GetBusyStatus()  returns CY_BLE_STACK_STATE_BUSY indefinitely. We have tried to reset the BLE system but it does not advertise or scan after the reset.

Solutions tested:  

  • Soft-resetting the BLE stack 
  • Called Cy_BLE_StackSoftReset(), the function returns CY_BLE_SUCCESS 
  • Checked the state of the stack by calling Cy_BLE_GetState(), the result was CY_BLE_STATE_ON 
  • The BLE did not behave as normal as it was not advertising or connecting to any other devices 

 

  • Hard resetting BLE system 
  • Called Cy_BLE_Stop() on CM4 with results being CY_BLE_SUCCESS 
  • Called Cy_BLE_Start() on CM0+ with results being CY_BLE_SUCCESS 
  • Called Cy_BLE_Start() on CM4  with results being CY_BLE_SUCCESS 
  • Checked the state of the stack by calling Cy_BLE_GetState(), the result was CY_BLE_STATE_INITIALIZING 
  • The BLE did not behave as normal as it was not advertising or connecting to any other devices 

Note: Resetting BLE was tested independently of the busy stack issue by manually triggering the soft and hard resets. 

Any clues as to why the stack is busy in the first place or why the resetting process is not working would be appreciated.

0 Likes
1 Solution

Hi @PratikshaV,

I tried running the code example on the evaluation kit and saw the same behaviour as in my project. The soft reset works but the device does not start advertising after the reset. It seems to be returning the invalid state error when Cy_BLE_GAPP_StartAdvertisement() is called after the reset.

From what I can tell, the soft reset API doesn't completely reset all BLE states as  Cy_BLE_GAPP_StopAdvertisement() needs to be called before the reset to allow the device to start advertising afterwards.

View solution in original post

6 Replies
PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @DaCh_1995281 ,

Please can you give us more information about how you are sending the data, at what point you are receiving the CY_BLE_STACK_STATE_BUSY or code snippet or if possible please attach your project so that we can understand the issue better.

 

Thanks & Regards

Pratiksha V

0 Likes

Hi Patrishka.

I am currently working with @DaCh_1995281 on the same project and debugging this specific issue. I was hoping to hotfix this issue by resetting the BLE stack rather than digging for the source of CY_BLE_STACK_STATE_BUSY. Is there any insights you can give me on why resetting the BLE stack is not working, independent of the busy-stack problem?

Edit: I have attached a screenshot of the function that is sending the data, which is where we ran into the busy stack issue.

SepehrZ_1-1653951566034.png

 

 

Thank you,
Sepehr Z

PratikshaV
Moderator
Moderator
Moderator
100 solutions authored 5 likes given 250 sign-ins

Hi @DaCh_1995281 ,

Please can you add this below piece of code in your event handler and check if the issue resolves.

case CY_BLE_EVT_SOFT_RESET_COMPLETE:
(void)memset(&cy_ble_connState, 0, sizeof(cy_ble_connState));
break;

 

Thanks & Regards

Pratiksha V

0 Likes

Hi @PratikshaV,

I tried adding that piece of code but it didn't work. The device still isn't scanning or advertising after the BLE stack is soft reset.

lock attach
Attachments are accessible only for community members.

Hi @DaCh_1995281 ,

Please can you check the attached code example where I am triggering the soft reset using button switch.

 

Thanks & Regards,

Pratiksha V 

0 Likes

Hi @PratikshaV,

I tried running the code example on the evaluation kit and saw the same behaviour as in my project. The soft reset works but the device does not start advertising after the reset. It seems to be returning the invalid state error when Cy_BLE_GAPP_StartAdvertisement() is called after the reset.

From what I can tell, the soft reset API doesn't completely reset all BLE states as  Cy_BLE_GAPP_StopAdvertisement() needs to be called before the reset to allow the device to start advertising afterwards.