This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Size of the notification

Other Parts Discussed in Thread: CC2540

Hello All,

Does anyone know, whats the maximum number of bytes I can transmit over BLE as a notification? I read in some function that its (ATT_MTU-3 ) which means 514 in case of simpleBLEPeripheral project. Am I correct or have I misunderstood the concept?

Thanks and best regards,

Nagaraj Hegde

  • Hi Nagaraj,

    you should really try to concentrate your doubts, since they are very similar, in a single thread instead of opening so many threads around the forum. Or at least verify some answers in order to help keeping the forum clean.

    Regarding your answer, perhaps this post is going to be useful to you. I've found it by searching "ble max" on the search box.

    http://e2e.ti.com/support/low_power_rf/f/538/p/108807/384844.aspx

  • Hello Kazola,

    Thanks for the suggestions., I will take care of this in future., However, the post you pointed out doesn't solve my question., That talks about 

    Max packet size allowed for BLE communication but what I am interested is specially in notifications and as I posted before, somewhere I found it ATT_MTU - 3 which means 514 in case of simpleBLEPeripheral project. Am I correct or have I misunderstood the concept?

    And can any one point me to the document which explain these BLE communication related documents/specifications?

    Best regards,

    Nagaraj Hegde

  • Hello All,

    I have got one more question in the same line., 

    If I am sending data packets over BLE from the server to client, is it that the Btool captures all the data or it misses some ? (I am interested to know, whats the effect of the baudrate 57600 of the dongle with respect to capturing data packets by Btool)?

    Kindly let me know.,

    Thanks and best regards,

    Nagaraj Hegde

  • The baud rate is slower than the maximum speed that BLE packets can be received. In addition, the UART buffer is a fixed size, so if you are receiving notifications very quickly, the UART buffer will fill up and not all of the notification events will be sent to BTool.

  • Hello Willis,

    I am expecting to get the notification at every 40ms and the data packet is 20 bytes size., However I observe that Btool is capturing data at ~10Hz (every 100 ms).., Any thought ?  Baudrate is 57600 but where can I get info on UART buffer size?

    Let me know please.,

    Thanks and best regards,

    Nagaraj Hegde 

  • Hi Nagaraj,

     

    You can read more about the UART in the CC2540 Userguide: http://www.ti.com/lit/swru191

     

    BR

  • Hello Nick L,

    Thanks for the pointer but my first question unanswered :

    I am expecting to get the notification at every 40ms and the data packet is 20 bytes size., However I observe that Btool is capturing data at ~10Hz (every 100 ms).., Any thought ? Is this because of UART or am I doing something seriously wrong? Is there a way to understand whether there was a transmission or not whenever I expect the notification? 

    Thanks so much for all the suggestions.,

    Regards,

    Nagaraj Hegde

  • Hi Nagaraj,

    20 bytes every 40ms is 0.5kB/s which should be no problem for UART to handle. Do you have an CC2540 Dongle or other HW to run our sniffer application on? (http://www.ti.com/tool/packet-sniffer).

    This way you can figure out if your packets are actually sent every 40ms. 

  • Hello Nick L,

    Thanks for the pointer.,

    I am using the USB dongle and I tried making use of the packet sniffer you pointed out., But I am not able to run that tool as it tells that "Not able to start the sniffer, try to upgrade USB firmware"., But if I see in the flash programming tool, there is no update revision mentioned there for the "Program evaluation board"., I am wondering what should I do now.,

    Thanks and best regards,

    Nagaraj Hegde

  • Nagaraj,

    which color has the LED in your USB dongle? It should be green. You have to previously flash the sniffer firmware by using the RF Flash programmer. The hex is somewhere the installation directory.

    After the firmware is flashed, try to start the sniffer application again. Remember the 15.1 version had an insolvable issue. Nowadays is 15.2. If you can't do it, perhaps tomorrow morning I'll be able to post a screenshot.

    Good luck.

  • Hello Kazola,

    Thanks so much for the pointer.,

    I could find the hex file in the installation and burn that to USB dongle., But big question now : I will be using the same dongle with the BLE to establish the connection with the server and to receive notifications., For that I need to burn the flash of the dongle with another hex file which erases the hex file of packet sniffer! Am I moving in wrong direction? How to understand this?

    Best regards,

    Nagaraj Hegde

  • Hello Kazola and Nick,

    While I am still wondering about my Previous question I found a way to debug the issue I have with the Btool., So I am sending different packets of data every time as notifications but I am not able to conclude anything with these experiments., 

    To give you more info on what I am trying to achieve, I am modifying the Simple BLEPeripheral Project and have set notification for Character 5., I have made Character5 to be 15 byte value and have set SBP_PERIODIC_EVT_PERIOD to be 40ms in which I call SetParameter function for Character5 to send notification, so that I get 25 Hz frequency., I am testing with DEFAULT_DESIRED_MIN_CONN_INTERVAL    32 and DEFAULT_DESIRED_MAX_CONN_INTERVAL     32 and 0 slave latency as Nick had suggested earlier.,

    With these settings, I am seeing that the notifications are sent in the correct order as I send them from server but they are ~100 ms spaced with each other while I expected 40 ms space., 

    Any thought on these is highly appreciated.,

    Thanks and best regards,

    Nagaraj Hegde

     

  • In order to use the DEFAULT_DESIRED_MIN_CONN_INTERVAL and DEFAULT_DESIRED_MAX_CONN_INTERVAL you will need to set  DEFAULT_ENABLE_UPDATE_REQUEST to TRUE. This enables an automatic connection parameter update request to be sent from the slave to master immediately after the connection has been established.

    If you did not change this value, then the connection interval specified by the master during connection establishment will be used. The default interval is 100ms. This is probably why you see ~100ms spacing between packets.

  • Hello Willis, 

    Thanks for the thought., However, I had placed the same values for intervals in both client and server (all 40 ms) and now I tried the change you asked to perform but the result is same :-(

    Thanks and best regards,

    Nagaraj Hegde

     

  • nagaraj hegde said:

    I could find the hex file in the installation and burn that to USB dongle., But big question now : I will be using the same dongle with the BLE to establish the connection with the server and to receive notifications., For that I need to burn the flash of the dongle with another hex file which erases the hex file of packet sniffer! Am I moving in wrong direction? How to understand this?

    You would need two USB dongles to do this. One with the sniffer FW and one with your central device FW.

  • Hello Nick L,

    Yes., This makes a lot of sense., Fine., So I have a bluradios USB dongle with CC2540., Can I use it for packet sniffer application? And I am still struggling with the 10Hz problem., It seems that all the packets are getting received (I am sending 5 different packets cyclically in an order and the same order appears in Btool without any loss)., I am confused., Let me know your thoughts please., 

    Thanks and best regards,

    Nagaraj Hegde

  • Hi Nagaraj,

    I dont know about the BlueRadio Dongle, try :) 

    What happens if you change the connection parameters to other intervals, do you get a linear behaviour? I mean, if you increase the connection interval, is the result different?

    BR

  • Hello Nick,

    I conducted experiments to understand the behavior based on connection interval., The behavior doesn't seem to be dependent on connection interval at all., and I conducted long investigation on the characteristic 5's length in data byte., I can get notifications once in ~100 ms if I am sending <=20 bytes and Btool doesn't receive any notification after I increase the number of bytes from 20 to anything greater than 20., If the number of bytes is 5 or 10 I am seeing that the notification are spaced ~80-85 ms. 

    I don't know how to reason these stuff., 

    Kindly let me know your thoughts.,

    Thanks so much,

    With best regards,

    Nagaraj Hegde

  •  

    nagaraj hegde said:
    The behavior doesn't seem to be dependent on connection interval at all

    The reason why you have an effective connection interval of 100ms (Which you are having) is highly depended on the connection parameters, so you should focus on making sure that you have set up your connection correctly. Have you tried using  GAPCentralRole_UpdateLink( uint16 connHandle, uint16 connIntervalMin, uint16 connIntervalMax, uint16 connLatency, uint16 connTimeout ) to update the connection parameters.

     

    BR

     

  • Hello Nick L,

    Thanks for the info., First I tried locating this above function in the SimpleBLEPeripheral project (by doing Ctrl+Shift+F) and found that its not invoked anywhere in this project., Then I searched in the "C:\Texas Instruments\BLE-CC2540-1.1a\Projects\ble" and found that "Central.C" in the "C:\Texas Instruments\BLE-CC2540-1.1a\Projects\ble\Profiles\Roles" directory uses that function.,

    I am not understanding the first parameter of the function you referred., So, what should be the 'connHandle' if I want to use this function in SimpleBLEPeripheral project? 

    And I found that below routine changes the new connection interval from default which is in peripheral.c 

    case GAPROLE_MIN_CONN_INTERVAL:

          {

            uint16 newInterval = *((uint16*)pValue);

            if (   len == sizeof ( uint16 )           &&

                 ( newInterval >= MIN_CONN_INTERVAL ) && 

                 ( newInterval <= MAX_CONN_INTERVAL ) )

            {

              gapRole_MinConnInterval = newInterval;

            }

    And I found that 'gapRole_MinConnInterval' is actually getting updated from the newInterval but I am not able to figure it out how is the gapRole_MinConnInterval used to set the connection parameters., 

    Kindly Let me know your thoughts on both these.,

    Thanks and best regards,

    Nagaraj Hegde

     

     

  • nagaraj hegde said:

     First I tried locating this above function in the SimpleBLEPeripheral project (by doing Ctrl+Shift+F) and found that its not invoked anywhere in this project., Then I searched in the "C:\Texas Instruments\BLE-CC2540-1.1a\Projects\ble" and found that "Central.C" in the "C:\Texas Instruments\BLE-CC2540-1.1a\Projects\ble\Profiles\Roles" directory uses that function.,

    The GAPCentralRole_UpdateLink is called in the central device (simpleBLECentral). So the central device will send a request OTA to change the connection parameters in the peripheral device. In simpleBLECentral:

        // Connection update

        if ( simpleBLEState == BLE_STATE_CONNECTED )

        {

          GAPCentralRole_UpdateLink( simpleBLEConnHandle,

                                     DEFAULT_UPDATE_MIN_CONN_INTERVAL,

                                     DEFAULT_UPDATE_MAX_CONN_INTERVAL,

                                     DEFAULT_UPDATE_SLAVE_LATENCY,

                                     DEFAULT_UPDATE_CONN_TIMEOUT );

        }

  • Hello Nick L,

    I apologize if I didn't clearly convey what I wanted., I had found that function call, but my question is: if I want to use that in SimpleBLEPeripheral, what should the 'simpleBLEConnHandle' point to? ., 

    And 2 nd question was, in SimpleBLEPeripheral project, how is the connection parameter getting set as I can't find this particular function call there.,

    Thanks and best regards,.

    Nagaraj Hegde

  • Hi,

    nagaraj hegde said:
    if I want to use that in SimpleBLEPeripheral

    This is a central device specific command so you wont use this in the peripheral device, you call it from the central device. The peripheral device will handle the request and update the connection parameter if they are legal and the GAPROLE_PARAM_UPDATE_ENABLE is true in the peripheral device.  

    If you want to change the connection parameters from the peripheral device itself you can use gapRole_SendUpdateParam( uint16 connInterval, uint16 connLatency ). See  peripheral.c for more info on the peripheral device.

    I hope this clarifies some.

    BR

  • Sorry, I missed this one before;

    nagaraj hegde said:
    Btool doesn't receive any notification after I increase the number of bytes from 20 to anything greater than 20

    20 Bytes is the maximum data length for a notification packet.

  • Thanks so much Nick., 

    Atleast one burden is off the shoulder now :-)

    With best regards,

    Nagaraj Hegde

  • Hello All,

    I could get the Sniffer running and below are the snaps from Sniffer and Btool., I am having hard time decoding the " Time (ms)" field but I believe, its giving me relative timings of each packet., And since my notification interval is 40ms, I am assuming that +39 (or sometimes +40) in the " Time (ms)"  corresponds to this., However, if you see the same value captured in the Btool, which captures as per the computer's time, the spacing between 2 notifications is ~100 ms.,

    Can any one comment on this please? (Also kindly let me know if my understanding is correct about the " Time (ms)"  of sniffer.,)

    Thanks and best regards,

    Nagaraj Hegde

  • Also, I don't know how the sniffer worked that time, capturing the data packets., I am unable to capture the data packets it by any amount of efforts now., It just captures the advertizing packets and then it stops., Should I do something else?

    Kindly tell me the way I can use this tool., I am starting it for BLE, selecting the USB dongle, running it and then scanning for the BLE devices from another dongle., When I start advertizing from the the Peripheral device, the sniffer captures those packets but not the data packets, which I send as notifications from the Server., I am amazed, how did it work the first time and not anymore !!!

    Thanks and best regards,

    Nagaraj Hegde

  • Hi Nagaraj,

    This is good, now we have something to analyze. First of all, you can see that the connection interval is right, because of the 40ms shown in the sniffer log. What is not shown are the actual notifications. What we see in that sniffer log is only the empty event packets which are sent to maintain the connection, these are not shown in BTool. Could you save the entire log and post that instead so we might look at the actual notifications, because it is those that are interesting.

    The notification is usually triggered when a change is made in the characteristic value, is this something you have control over?

    Regarding that the sniffer sometimes miss the connection is because it only listens on one advertisement channel (of three possible), so if the connection is established on another channel than the sniffed one, it will miss the frequency hopping scheme hence miss the connection establishment. It is a 33 % chance, have patience or use three sniffers on three channels.

    We are getting closer.

    BR

  • Hello Nick,

    Thanks for the response again.,

    Two run 3 sniffers, one needs 3 dongles I believe and this is something not possible :-(

    And it also doesn't seem that its fair 33% probability as I am not able to get the packets from any amount of effort., 

    Regards to notification, yes, I have full control on it as in where should I set it., The sniffer log I had posted was for 40 ms interval., I have changed it to 80 ms interval now to observe the change in sniffer but I could never get that thing working again.,

    Thanks again,

    With best regards,

    Nagaraj Hegde

  • Hello Nick,

    So finally, I am able to capture the data again., Attached the entire log from sniffer., Since I had made the connection interval 100 ms, I am seeing +99 ms in sniffer log., So I believe I am not missing anything., Let me know your comments.,

    Thanks and best regards,

    Nagaraj Hegde7127.100 ms connection interval.psd 

  • And here is the log for 40 ms interval., I am much relieved now., Thanks so much NICK !!!! 

    With best regards,

    Nagaraj Hegde5758.40 ms connection interval.psd