• 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 » Low Power RF Bluetooth® Low Energy & ANT Forum » BLE transfer bottleneck?
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

BLE transfer bottleneck?

BLE transfer bottleneck?

This question is answered
Gergo Zsiak
Posted by Gergo Zsiak
on Mar 06 2012 11:05 AM
Intellectual855 points

Hi All,

I send larger amount of data through BLE (I know that it wasn't desinged for this purpose, but know I have to do this). Currently the connection parameters are:

- min. connection interval: 6 (7.25 msec)

- max connection itnerval: 6 (7.25 msec)

- slave latency: 0

Therefore the effective connection interval is 7.25 msec. I transfer data by using SimpleProfile_SetParameter, and the appropriate characteristic value is 16 bytes long. These suggest me that the transfer rate should be ~2 kB/s. However, I measured 70 B/s. There is some overhead caused by another operations, but it wouldn't cause this. My questions are:

- Are indications and notifications sent in the same connection event in which the actual data is transferred?

- Are confirmations sent back in the same connection event.

- The most important: what other bottlenecks can be there?

Thanks,

Gergo

ble cc2540 discovery done master usb dongle
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Eng351
    Posted by Eng351
    on Mar 06 2012 13:28 PM
    Verified Answer
    Verified by Gergo Zsiak
    Expert2980 points

    Hi Gergo,

    Do you have a USB sniffer? The first thing to check is that you are really getting 7.25msec connect interval. By default the connection starts at 100ms and you have to issue a connection update from the central device to change the connect interval e.g. 

    GAPCentralRole_UpdateLink(BLEConnHandle,5,5,0,1000);

    You also need to ensure that the minimum connect interval on the peripheral side is less than equal to 5. I think this is  the limit so you may want to try higher values to start.

    In practice you might find a connect interval of 5 does not work or is hard to achieve if your system has other processing overhead (reading / writing flash etc). I found the link could be unreliable if the interval was too low.

    As far as I know notifications can occur up to 4 times per interval, but confirmations for indications happen in the following timeslot - someone may be able to correct me here.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Gergo Zsiak
    Posted by Gergo Zsiak
    on Mar 07 2012 08:55 AM
    Intellectual855 points

    Hi Michael,

    Thanks for your suggestion, the lack of GAPCentralRole_UpdateLink(...) was the (first) problem. I set the parameters on the GAP peripheral side and thought that it would take effect. Now the transfer rate is about 700 Bytes/s, which is ten times faster than previously, but still slower than 2,1 kBytes/s. Do you think that it can be obtained, or is this just a theoretical upper limit for the speed?

    Now I am planning to change the GATT profile, too, and hope that it will multiply the speed by 4.

    Best regards,

    Gergo

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Sasha Kalmanovich
    Posted by Sasha Kalmanovich
    on Mar 13 2012 05:04 AM
    Intellectual815 points

    The theoretical speed for this settings ~10 Kbytes/sec, because in each connection event, up to 4 packets can be sent in each direction.

    However, some messages, such as gatt write charachteristic are sequential, meaning only one message is sent in each connection event, afte a confirmation is recieved.

    You can use GATT_WriteNoRsp API function to transfer data faster.

    You can check with the sniffer how many messages are transferred on each connection event.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Gergo Zsiak
    Posted by Gergo Zsiak
    on Mar 24 2012 04:31 AM
    Intellectual855 points

    Hi Sasha,

    As far as I know the GATT_WriteNoRsp is tipically used on the client side. However, usually I send larger amount of data in the opposite direction using SimpleProfile_SetParameter(...).

    Do you think that the speed can be also improved in this case?

    Thanks, 

    Gergo

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Eng351
    Posted by Eng351
    on Mar 25 2012 13:21 PM
    Expert2980 points

    Hi Gergo,

    There are two ways to send data from the Peripheral (server) to the Central (Client). These are the client initiated "Read" and the sever initiated "Notify" (or "Indicate"). Which method are you using?

    The SimpleProfile_SetParameter uses notifications (Notify) to send data back to the Central (client) side. I found that there was some additional work required to get notifications working on the client side.

    Notifications do not require confirmation from the client so they should be as fast as GATT_WriteNoRsp in the opposite direction. I think reads are slower as they require a read request to be sent and the corresponding response to be returned.

    Mike

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Gergo Zsiak
    Posted by Gergo Zsiak
    on Mar 26 2012 03:23 AM
    Intellectual855 points

    Hi Mike,

    I use both indications and notifications, but for separate characteristic values. Indications are used at a charvalue which is for transmitting larger amount of data. The mechanism is the following:

    1. Server sets charv to the next packet, and sends indication.
    2. Client receives indication, and handles incoming data.
    3. Server receives confirmation for indication, GOTO 1.
    The confirmation is needed because the server has to know when to send the next packet. I am not sure if it's the most appropriate way of doing this, but don't have any better ideas.
    What do you think, is there any way in this case to improve the speed?
    Thanks,
    Gergo
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Eng351
    Posted by Eng351
    on Mar 26 2012 15:44 PM
    Expert2980 points

    Hi Gergo,

    I havent used Indications before, but when I was using Write I was getting similar speeds to you. I moved to just using WriteNoRsp and Notify to send data each way. My application only sends data one way at a time & the application layer handles error checking and retries. I can move data at about 2KB/s but I may look at trying to optimize this further when I get the time

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joakim Lindh
    Posted by Joakim Lindh
    on Mar 27 2012 04:56 AM
    Genius13370 points

    Hi All,

    Have a look at our wiki on some throughput tests we've done: http://processors.wiki.ti.com/index.php/CC2540_Data_Throughput

    Br

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Eng351
    Posted by Eng351
    on Mar 27 2012 16:44 PM
    Expert2980 points

    Thanks Nick,

    In the link there is a comment: "When sending the notifications, a check is made to see if a buffer is available"

    Can you please explain this a little further? Does this use the return code from the GATT_Notification call?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joakim Lindh
    Posted by Joakim Lindh
    on Mar 28 2012 01:04 AM
    Genius13370 points

    Hi,

    So every 7ms, the function below is called 4 times,

    static void sendData(void )
    {
      
        static uint16 counter=0;
        uint8 burstData[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
        burstData[0] = (counter & 0xFF00)>>8;
        burstData[1] = (counter & 0xFF);  
        attHandleValueNoti_t nData;
        nData.len = 20;
        nData.handle = 20;  
        //skKeyPressed = *((uint8*)pValue);
        osal_memcpy( &nData.value, &burstData, 20 );
        // Send the Notification
        if (GATT_Notification( 0, &nData, FALSE )==SUCCESS)
        {
          counter++;
        }    
        if(counter >1000) 
        {
          osal_stop_timerEx(simpleBLEPeripheral_TaskID,SBP_BURST_EVT);
          counter = 0;
        }
    }

    So regardless of the connection interval, we are always trying to keep the buffer full, which is as you say checked by using the return command of the GATT_Notification().

    Br

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Gergo Zsiak
    Posted by Gergo Zsiak
    on Mar 28 2012 01:41 AM
    Intellectual855 points

    Hi Nick,

    This speed sounds promising, I am trying this solution.

    I noticed that you call GATT_Notification() with 0 connHandle, could you explain this? I didn't find anything in the documentation regarding to this, and neither can imagine what a 0 connection handle means.

    One more question: you use one characteristic value (with the handle 20) to send data 4 times in every 7 ms. I thought that it wasn't possible, can you explain this thing, too?

    Thanks,

    Gergo

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joakim Lindh
    Posted by Joakim Lindh
    on Mar 28 2012 03:11 AM
    Genius13370 points

    Hi,

    If you have several peripherals connected to a central device you would have internal pointers to each connection, called connection handles. The first connection is always enumerated as handle 0x0000, second connection 0x0001 and so on.

    7ms is just a OSAL timer which is suppose to be less than the connection interval, so we always keep the output buffer full and thereby maximizing the throughput. since the minimum connection we usually recommend is 10ms you could just as well test 9ms OSAL timer. But if you'd like to test minimum possible connection interval of 7.5ms, you'd like to push as many packets (maximum allowed is currently 4) you can between every connection event, so they might be sent during the actual connection interval.

    Again, the OSAL timer is just used to put packets in the output buffer, and the buffer is emptied upon the connection event.

    BR

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Gergo Zsiak
    Posted by Gergo Zsiak
    on Mar 28 2012 03:34 AM
    Intellectual855 points

    Hi Nick,

    Thank you very much for your quick response, I've understood the concept, and I am changing my sources to work in this way.

    Just one note: I see that you call the function int the following way: osal_memcpy( &nData.value, &burstData, 20 );. However, nData.value and burstData are both arrays, and therefore the operator '&' isn't needed for getting their adresses (which are expected as actual parameters for memcopy). Or did I miss something?

    Best regards,

    Gergo

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Senthil kumar103423
    Posted by Senthil kumar103423
    on May 07 2012 09:00 AM
    Prodigy250 points
    Hi Nick ,
    I want to transmit 40Kb of data from Slave(GATT Server ) to Master ( GATT Client ) , So which is the best method ? GATT_notification or GATT_WriteNoRSp or GATT_WriteChar Value ??
    If i want to transmit 40Kb of data , i want that data to be local in the function where i am sending the data ,but IAR workbench says some warning "XDATA is greater than 0x280 and threshold is set to 90 % "
    i.e
    uint8 data_to_send[4000]; 
    uint16 i;
    for (i =0 ;i < 4000;i++ )
     data_to_send [i]=0x00; // Am initializing all the data to be zero.
    From this buffer am planning to transmit 20 bytes at a time using GATT_notification or GATT_writeNoRsp or GATT_writecharval .
    Then i have reduced the array size to 524 ( 90 % of 0x280 ) from 4000, after that i does not throw any error but my code will struck and notifications are not working .
    Finally I found that it is working when i have my data_to_send buffer size as 490 (which is 76.5625 % of 0x280 ) ??? why this is happening ? 
    One more question is the xdata limit can be set in IAR Options-> General Options -> Stack /heap . Shall i increase the limit , will it affect my performance some where ?
    How this limit (0x280) is calculated ? am having 256KB flash but this xdata limit seems to be much lower ?
    Kindly help me to understand this ,
    Thanks in advance ,
    Senthi
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Joakim Lindh
    Posted by Joakim Lindh
    on May 07 2012 16:11 PM
    Genius13370 points

    Senthi,

    XDATA uses RAM (Not Flash), which the CC2540 and CC2541 has 8KB of. To get more info on this, have a look at section 4.2.4 in the Software Developers Guide (found here). 

    Br

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
123
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