6 Replies Latest reply on Aug 9, 2018 10:00 AM by jgriswold_3357391

    BLE crashing

    jgriswold_3357391

      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

        • 1. Re: BLE crashing
          sxsi

          Hi,

           

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

           

          -Sayani.

          • 2. Re: BLE crashing
            jgriswold_3357391

            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

            • 3. Re: BLE crashing
              sxsi

              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.

              • 4. Re: BLE crashing
                jgriswold_3357391

                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

                • 5. Re: BLE crashing
                  sxsi

                  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.

                  • 6. Re: BLE crashing
                    jgriswold_3357391

                    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.