10 Replies Latest reply on Aug 17, 2015 11:00 AM by kwang

    GATT callback & fine timer callback

    lemancai

      Hi BCMs,

       

           When I test BCM20736 bleprofile_sendNotification() function, find out that:

       

      1. BCM20736 Txbuffer default is 16, APP layer call bleprofile_sendNotification() to copy tx data to buffer, and Txbuffer -1. After stack send it out, Txbuffer +1.

         If I call bleprofile_sendNotification() over 16 times or even more, the Txbuffer would be a negative number(print out). what would happen to BCM20736 BT stack in this case??

       

      2. Could we modify the size of Txbuffer ? and how to modify it if it's possible.

       

      3. There is one callback function register to GATT, and also there is one callback function of fine timer. What's the proirity of this two callback function? Would the fine timer callback function interrupt GATT callback function ??


          tks

        • 2. Re: GATT callback & fine timer callback
          lemancai

          Hi Boont,

           

               Thanks for your info. I had read this thread. And I also put one question to Mkim who creat this discussion.

               My problem is one of my 20736 works in slave, and call bleprofile_sendNotification() to send data to its master, sometimes, the master could not get data from this slave 20736 any more, and we check the tx buffer always keeps 0, which seems that, the bleprofile_sendNotification() is blocking some where in the stack.

               It's realy confusing me, and have no any idea about this issue.

               BTW., the 20736 would do the non_connectable ADV when do bleprofile_sendNotification(). We are not sure if my issue is related to the ADV data.

           

               We also study the source code of BCM20734, and there is one function named cfa_hci_AllocateBLEACL(), which would allocate buffer for data transmition. If this is the same as BCM20736, it might be fail here we guess. but unfortunately, there is no source code could be study in BCM20736.

           

           

               Now we do one test as below: To check the TX buffer size before call bleprofile_sendNotification(), and once it's 0, we stop doing notification. With this solution, it could good improve the system stanbility, but still fail once in whole half day non-stop test.

           

               Could U pls help us to check more ??

           

               Many many many tks....

          • 3. Re: GATT callback & fine timer callback
            lemancai

            maxsong

            Question: There is one callback function register to GATT, and also there is one callback function of fine timer. What's the proirity of this two callback function? Would the fine timer callback function interrupt GATT callback function ??

                 Sincerely...

                 tks

            • 4. Re: GATT callback & fine timer callback
              maxsong

              You may also check following thread:

              Maximum BLE throughput for reliable data transfer

               

              by esmith:

              Thanks for suggestion, KT. The speed test example tests for the tx buffer count being non-zero, which does mean that it can (temporarily) tie up the last buffer. Yesterday I added a #define to my code to set a threshold, currently with a value of 2, and if I don't send notifications unless the available buffer count is >= 2, I don't see any of the lel2cap error messages in the trace output. I think this confirms that something else in the stack needed a buffer and I was starving it.  Perhaps in a future SDK release Broadcom might wish to make this change to the speed_test application to avoid other developers encountering the same issue.

              • 5. Re: GATT callback & fine timer callback
                maxsong

                You may also refer to following thread:

                fine timer priority

                "...finetimer callback happens in the application thread...".


                All the callback functions exposed in application layer should belong to the application thread.  So the answer is NO.

                • 6. Re: GATT callback & fine timer callback
                  BoonT_56

                  lemancai

                   

                  Did you have a chance to walk through these materials?

                  • 7. Re: GATT callback & fine timer callback
                    lemancai

                    Dear Boont,

                     

                         Yes, we study all the materials in the past weeks.

                         Here, I must say thanks to U, Max and other BCM who helped us.

                     

                         We now developping a cluster tree type network with BCM20736, and everything goes well now.

                     

                         In the past 7 days, we build the network with 30 pcs BCM20736 and at the same time, there are 3 mobile phones sending and sync data in the same net

                    # the data loss in transmition --> we add the condition of (tx buffer > 2), seems workable

                    # the max connection is 4. (4 peripherals or 1 central & 3 peripherals) --> We still fail to create connection up to 7, but it doesn't matter for our solution

                    # Advertising stopped during test --> it's solved

                    # 0x08 error; 0x3e error; 0x16 error --> in long time non-stop tesst, we found out that, most of the 30 pcs BCM20736 feedback the error message, and the error code is 0x08, 0x3e, 0x16. we are debuging now.

                    By the way, our interval setting is min_interval = 20(25ms), max_interval = 28(35ms). timer out is 1s.

                     

                        tks

                    • 8. Re: GATT callback & fine timer callback
                      BoonT_56

                      The 0x3e error occurs when the central failed to receive a response packet from the peripheral it is communicating after a period of time. You may want to increase the connection interval and see whether the situation improves.

                      • 9. Re: GATT callback & fine timer callback
                        kwang

                        As for the max slaves, please check Re: How many connect several Max about 20737s?

                         

                        -Kevin

                        • 10. Re: GATT callback & fine timer callback
                          kwang

                          lemancai

                          is this still an issue?