BLE crashing

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

cross mob
JoGr_3357391
Level 4
Level 4
10 likes given 5 likes given First like received

I can claim absolutely no expertise in Bluetooth, but here I am, trying to write an application. Basically grabbing data from a peripheral and passing the buffer to the BLE block, but I randomly, but seemingly more often than not, find the program crashing somewhere after calling CyBle_ProcessEvents(). That the BLE block is a black box, how does one go about figuring out what code is not in place or not working correctly?
Here is a picture of the stack trace - and why is CySysFlashClockConfig() apparently at address zero (or is this a red herring?)?

StackCrash.png

Are there some generic guidelines between which I can stay out of trouble?
Thanks so much,
John

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hi John,

Please see if your sensor MAX86150 is initialized properly. If not, then the firmware will get stuck in the while loop. Moreover, when you are using the function UpdateDataCharacteristic() , make sure that the BLE device is connected and notifications are enabled from the client device. If this is not checked, then the data is continuously being sent even when the peripheral device is not connected. Also, due to the continuous flow of data , the stack is unable to process so much data at a time resulting in a connection timeout.

I am attaching your project which we have modfied to make these changes.

View solution in original post

6 Replies
SayaniS_66
Moderator
Moderator
Moderator
10 likes received First like received

Hi,

Can you please share your project so that we can look into it and identify the issue.

-Sayani.

0 Likes
lock attach
Attachments are accessible only for community members.

The archive is attached. I cannot guarantee that this is the exact same configuration I had been using. Grasping at a lot of straws lately.

When I send dummy data over BLE, no problem.


I'm currently having issues with the I2C bus Master not being ready. I am probably missing a state transition or something, so I'm working on that currently.

I tested that I'm not simply blowing the stack, which is 2048 bytes anyway.  I filled the stack with 0xDEADBEEF and I'm nowhere near filling the stack during operations.


Thanks for any insight that can be provided.

John

0 Likes

Hello,

Can you please elaborate on this "I tested that I'm not simply blowing the stack, which is 2048 bytes anyway."

Also, in your project send the notifications only when the device is connected and notifications are enabled from the client device.

-Sayani.

0 Likes

The stack comment was simply to show that I was not overflowing the stack, which can be a common problem for projects like this. I tend toward a really deep stack to avoid such things.

Regarding your comment about notifications - which notifications are these? I have been accused of being quite dense at times, so don't be afraid to offend me.

Thanks,
John

0 Likes
lock attach
Attachments are accessible only for community members.

Hi John,

Please see if your sensor MAX86150 is initialized properly. If not, then the firmware will get stuck in the while loop. Moreover, when you are using the function UpdateDataCharacteristic() , make sure that the BLE device is connected and notifications are enabled from the client device. If this is not checked, then the data is continuously being sent even when the peripheral device is not connected. Also, due to the continuous flow of data , the stack is unable to process so much data at a time resulting in a connection timeout.

I am attaching your project which we have modfied to make these changes.

Thank you. This change certainly seems to help, but I don't know that it can be claimed a fix. I suspect the debugger has potential for causing problems, so I'm a little wary.

I have managed to keep the system running for several minutes, which is several minutes longer than before the change.

I thank you for your help. I suspected I was doing something (or not doing something) but the "don't know what you don't know" syndrome took full effect.

0 Likes