8 Replies Latest reply on Aug 10, 2016 1:03 AM by suresh.joshi

    Transfer Large Arrays through BLE via Notification Method

    d.k..willardson

      Trying to transfer two large arrays via Notification from a peripheral to a central. I used the following thread and project in this forum as a starting point and pared it down for my purposes.

         

      http://www.cypress.com/forum/psoc-4-ble/write-characteristic-values

         

      I was trying to transfer each member of the first array, then do the second one. The first one is going through somewhat reliably but not the second array.

         

      Any help on this is greatly appreciated - Project is attached.

        • 1. Re: Transfer Large Arrays through BLE via Notification Method
          d.k..willardson

          Hi -

             

          So I have made some progress but I could really use some help on this. Since there wasn't a lot of response to the question, I'm assuming maybe because I left it a bit broad - so my apologies. I have pared the project even further to a custom service and two characteristics (project attached) and removed everything else. The characteristics - integers in two arrays are both coming through now; however, for some reason I'm only getting half of each 20 member array. I call "SendChar1Notification" which includes CyBle_GattsNotification which should push the data from the peripheral to the client via Notification Method. It seems like it might be an MTU issue but I'm calling the SendChar1Notification to send each uint8 separately.     

             

          I would very much appreciate any thoughts on this.

             

          Thanks!

             

          D.K.

          • 2. Re: Transfer Large Arrays through BLE via Notification Method
            rohit.kumar

            D.K.,

               

             

               

            I didn't see your complete project but going through your problem statement, I would check for following items:

               

            1) MTU size: The MTU size is negotiated between the Central and Peripheral device during connection. If you have not made changes to the tool or project, the MTU size set is normally 23 bytes. You can re-negotiate the MTU size by calling the appropriate API after connection is made

               

            2) Are you updating the GattsNotification at every connection interval? or Multiple calls between two connection event? The BLE stack consists of a queue and pushing too much data to it before it goes means that the GattsNotification will stop updating the queue. Check the API return of the GattsNotification API to see the status of each call.

               

             

               

            One of us can give a look at the project later and give you specific details, if any. But if you want quick technical support on this, I would advise you to raise a Technical support case at http://www.cypress.com/support .

               

            Hope this helps.

            • 3. Re: Transfer Large Arrays through BLE via Notification Method
              d.k..willardson

              Roit -

                 

              Thanks for the reply. I'm updating the GattsNotification after each send. I will check the "complete" button on the project next time - sorry about that. I'm going to try a few more things and if no luck, will submit a case. Thanks again for taking a look - much appreciated!

              • 4. Re: Transfer Large Arrays through BLE via Notification Method
                d.k..willardson

                I submitted a case and all is resolved. The issue was that it was trying to push data onto a full stack. Resolution was adding  CYBLE_EVT_STACK_BUSY_STATUS. So monitoring stack and waiting for a "free status"  - added this line of code.

                   

                while (BLEStackStatus != CYBLE_STACK_STATE_FREE) { CyBle_ProcessEvents(); }

                   

                Just wanted to post the project for others who may come along w/ same issue..... 

                • 5. Re: Transfer Large Arrays through BLE via Notification Method
                  patrick_1588811

                  thanks for posting your solution! For some reason, it is not working for me. I am monitoring the state and it is stuck on CYBLE_EVT_STACK_BUSY_STATUS with a status of CYBLE_STACK_STATE_FREE. Did you run into that at all? Is there some reason it'd get stuck in the while loop, maybe?

                  • 6. Re: Transfer Large Arrays through BLE via Notification Method
                    cjoachim_1597296

                    dkwill, did that increase/improve your throughput? The documentation says that CyBle_GattsNotification() shall handle that case:

                       

                     

                       

                    CYBLE_ERROR_INVALID_OPERATION: This operation is not permitted as BLE Stack is busy processing previous requests. The Error code is returned if the stack queue is full or for other reasons, the stack cannot process the operation. If stack busy event 'CYBLE_EVT_STACK_BUSY_STATUS' is triggered with status busy, calling this API will trigger this error code. For details refer 'CYBLE_EVT_STACK_BUSY_STATUS' event.

                       

                     

                       

                    I recently got Hard Fault when doing notifications (hangs in IntDefaultHandler()), but was told by Cypress to increase the stack and heap sizes (in .cydwr). I hope that works.

                    • 7. Re: Transfer Large Arrays through BLE via Notification Method
                      d.k..willardson

                      Sorry for the delay.

                         

                      Patrick - Not sure what is going on. Doesn't sound like data is getting pushed onto stack. I didn't have that issue. You might go back to the Lab 4 example and see where the code differs. 

                         

                      Speedycat - Yes, it definitely solved my problem and allows my large arrays to be transferred. Line of code was definitely needed though - credit to Cypress for solving. 

                         

                      Sorry I'm not much more help on this.

                      • 8. Re: Transfer Large Arrays through BLE via Notification Method
                        suresh.joshi

                        SpeedyCat, were you able to solve your hard fault? I'm running into that right now anytime I try to do more than 1 notification within 15ms (which is very strange).