• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Bluetooth® Applications » About L2CAP TX queue flow control
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

About L2CAP TX queue flow control

This question is answered
Misa Kurihara
Posted by Misa Kurihara
on Apr 28 2011 23:00 PM
Prodigy80 points

Hello,

I am using the EtherMind version Beta 1.0 June 18, 2010 on the MSP-EXP430BT5190 + PAN1315ETU,
and modifing the accelerometer sample application.

Now, spp data sending is stopped on the way,using BT_spp_send() on 30 byte data at 40msec interval period,
or 280 byte data at 100msec interval period.

On investigation, appl_l2cap_tx_buf_state != L2CAP_TX_QUEUE_FLOW_ON occured.

Is this situation L2CAP's TX buffer full?

How many this system upper limit?(data size and interval period).

I want to continue data sending. Please tell me the recovery method.

Regards,

Misa

bluetooth MSP-EXP430F5438
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Gustavo L
    Posted by Gustavo L
    on Apr 29 2011 12:40 PM
    Genius9990 points

    Misa,

    I would highly recommend for you to use the newer GA version available from TI. It has many fixes and updates and should overall help you with getting your application going.

    The payload can be up to 110 bytes, however the stack splits the data to the relevant size. The flow control that you're seeing is normal and takes care of messages that might not have arrived from one layer to another. Are you missing data? It's not clear whether you really have any issues.

     

    Gustavo

     

     

    ---------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Misa Kurihara
    Posted by Misa Kurihara
    on Apr 30 2011 03:33 AM
    Prodigy80 points

    Hi,Gustavo

    Thank you very much for your help.

    If I have more the develop time, I want to try the newer GA.

     

    Please tell me again.

    After CPU reset, execute the program,  It's no problem , SPP connect ok, SPP's data are exact value on the master PC .

    But a few seconds later, It has executed the below code (1) -> (2).

    appl_spp_l2cap_tx_queue_flow_cb()
    {

        /* Flow Off - Don't send data */

        else {
           /* Set data can't be sent */                ----- (1)
        }

    }

    appl_spp_notify_cb()
    {

        case SPP_SEND_CNF:


                } else {
                    SDK_SPP_CHANGE_DATA_STATE(rem_bt_dev_index, TRUE);  ----------- (2)
                }

    }

    What's happen ?

    Regards,

    Misa

     

    Blue Tooth CC2560 MSP-EXP430F5438
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Balaji Jeyaraman
    Posted by Balaji Jeyaraman
    on May 02 2011 07:10 AM
    Intellectual440 points

    These are call back functions that are registered with the Bluetooth library.

    The appl_spp_notify_cb() is called for any SPP notifications like SPP connection confirmation, SPP connection indication, SPP disconnection etc. The appl_spp_l2cap_tx_queue_flow_cb() is called to check for the flow control status.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Misa Kurihara
    Posted by Misa Kurihara
    on May 03 2011 00:10 AM
    Prodigy80 points

    Hi, Balaji

    I want to know whether L2CAP's TX buffer has changed from not full(i.e., it can receive the data) to full (i.e., it can't receive the data).

     

    First, In PC(BD master) has received normally the BT_spp_send()'s data from the board(BD slave) ,

    It is executed avobe code 's line (1) part (actually, add dummy code for breakpoint ,e.g. i++;)  -> line (2) part sequentially,and

    PC hasn't receive the data from the board,but BT_spp_send() is continue on the board.

     

    Is this mean that L2CAP's TX buffer has changed from not full to full?

    Regards,

    Misa

     

    pan1315 MSP-EXP430F5438
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Miguel
    Posted by Miguel
    on May 27 2011 19:50 PM
    Verified Answer
    Verified by Misa Kurihara
    Genius11565 points

    Misa,

             Yes, it means that the L2CAP cannot receive more data from the SPP due to buffers being fulled. When buffers become available again, the appl_spp_l2cap_tx_queue_flow_cb() will be invoked internally by the BT stack with appl_l2cap_tx_buf_state = L2CAP_TX_QUEUE_FLOW_ON so the application can resume sending SPP data.

             I hope it is clear now.

    Regards,

    ~Miguel

    L2CAP Flow Control
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Adam Zehavi
    Posted by Adam Zehavi
    on Apr 09 2012 14:37 PM
    Intellectual875 points

    Miguel,

    Following on this thread, I also have similar issue with the BT_spp_send function.

    I'm trying to send dynamic packet over the BT, which may range from 50b - 2kb, so does that mean I have to break the packet up into pieces in order to send it via the appl_spp_l2cap_tx_queue_flow_cb()?

    Details:

    While sending a 900b packet, the SDK errors, and a SDK_BT_MEM_ALLOC_FAIL, so I've been looking also into this thread, and I still not quite understand the flow here.

    If one would want to transfer a large packet, how would that be accomplished?

    Adam.

     

    Thanks,
    Adam Zehavi.

    Java Developer & Architect
    Nu-Art Software

    -----
    LinkedIn
    Twitter
    -----

    To be a good student, you must first be a good teacher.

     

    SDK_BT_MEM_ALLOC_FAIL appl_spp_l2cap_tx_queue_flow_cb BT_spp_send
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • srisenthilkumar chandrasekaran
    Posted by srisenthilkumar chandrasekaran
    on Apr 09 2012 22:38 PM
    Verified Answer
    Verified by Miguel
    Intellectual425 points

    Hi Adam Zehavi,

       Yes, you are right . you need to break the packet up into pieces and send for current configuration.

    currently we have pools/buffers with following memory sizes (8,16,32,128,260)bytes, those blocks are defines heap_bt.c

    so maximum is 260 bytes.BT_alloc_mem() function in BT_os.c verifies the memory pools , if memory required is more than 260 bytes then it throws an error.

     

     if (NULL == buf) {
            /* No. Allocation Failed. */
            /*
             * BT_debug_error(bt_debug_fd, "Buffer Allocation Failed. Insufficient
             * pool memory - %d\r\n", size); */
            sdk_error_code = SDK_BT_MEM_ALLOC_FAIL;
            sdk_error_handler();
            return NULL;
        }

     

    if your MCU has more data memory then you can define your own buffers and increase the configTOTAL_HEAP_SIZE value in FreeRTOSConfig.h. and send.

     

    Thanks

     

       

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Adam Zehavi
    Posted by Adam Zehavi
    on Apr 10 2012 02:35 AM
    Intellectual875 points

    Srisenthilkumar,

    Thank you for your quick response, that is one mystery uncovered.

    I have developed a bridge between Android device and the PAN1315, and true, while sending packets which are less than ~250b the operation works, but once the packet is bigger, I receive the error as I've described earlier.

    Now that I understand how to aggregate the packet chunks, and call onto the BT_spp_send function, with the packet chunk from the appl_spp_l2cap_tx_queue_flow_cb(), the question remains, when does the peer actually gets notified of the packet?

    I've debugged the flow and noticed, that although I get the SPP_SEND_CNF on the spp call back function, and although the l2cap has aggregated the packet, the peer is not notified of the packet, until sometime after the call. Why is that?

    Does the buffer gets empty only after it has been sent to peer?

    Thanks,

    Adam. 

     

    Thanks,
    Adam Zehavi.

    Java Developer & Architect
    Nu-Art Software

    -----
    LinkedIn
    Twitter
    -----

    To be a good student, you must first be a good teacher.

     

    appl_spp_l2cap_tx_queue_flow_cb SPP_SEND_CNF
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Miguel
    Posted by Miguel
    on Apr 10 2012 23:01 PM
    Genius11565 points

    Hello Adam,

    There is no flow control between SPP profiles. You would have to implement it on top of the SPP profile as part of your application. What exactly do you want to achieve?

    Regards,

    Miguel

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • srisenthilkumar chandrasekaran
    Posted by srisenthilkumar chandrasekaran
    on Apr 10 2012 23:30 PM
    Intellectual425 points

    Hi Adam Zehavi,

        We could dump packets with available l2cap buffers. lets take currently configured 260bytes buffer is 2, even you can increase the no.of buffers also from 2 to some N based on your MCU memory.

       From Transmitter side, once l2cap put packet into link layer & physical layer using hci then you will get a SPP_SEND_CNF,and next chunk of bytes you could dump here.

      From Receiver side, once you received packet from peer device you will get a nofication  case SPP_RECVD_DATA_IND: in appl_spp.c

     

    apppl_spp_l2cap_tx_queue_flow_cb -  L2CAP calls this callback when the number of  buffers occupied in the ACL Transmission Queue goes above or below a set limits.

     

    Regards

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Adam Zehavi
    Posted by Adam Zehavi
    on Apr 13 2012 11:23 AM
    Intellectual875 points

    Guys,

    It took my a lot of debugging, and your constructive help, to complete the packet protocol, finally I understand the l2cap flow and how to use it.

    I had a very serious problem with debugging the embedded program, with the debug messages delay intervals which effected the behavior of the program (connection specifically), and even worst problem understanding what went wrong, while the kit was not connected to the debugger. Since I'm trying to construct a bridge between the Android mobile and the kit, I've decided to send the kit debug logs to the Android phone, and integrate the logs as packets, this was not a pleasant task.

    I've completed the protocol, only to find out that I did not take packet losses under consideration while designing it. I'm working up a solution, and have posted this question.

    Thanks again for your help.

    Adam.

     

    Thanks,
    Adam Zehavi.

    Java Developer & Architect
    Nu-Art Software

    -----
    LinkedIn
    Twitter
    -----

    To be a good student, you must first be a good teacher.

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use