Bluetooth connection context

I have to make a connection  from a central_uart  to 4 periperal_uart  every 60ms Sending  30 byte .

I Have to make a polling of  all the peripheral every 60ms.

I know that a connection will take 7.5mS more or less. If I use   Bluetooth connection context  lib I don't lose 7.5ms for the connection ?

The  4 Peripherals  will be always connected with the central  ? May I save this lib in NVM  ? And than  I use the " saved data of  the connection context lib " when   I start again  the central_uart? 

I would like to take on the connection between the central_uart and the 4 peripheral_uart for 8h.

Best Regards

Novello G.

  • Hi Novello, 

    I don't see any problem using Bluetooth Connection Context here. Please be aware that Bluetooth Connection Context has nothing to do with the connection parameters (connection interval). The main purpose of Bluetooth Connection Context is to store the CCCD values on each connection so that it can restore them when the same central/peripheral reconnected. 

    You can choose to keep the connection with all of the device simultaneously or you can choose to only connect to one at a time. But at the polling rate you have which is 60ms, it's better to keep them all connected I think. 

    I know that a connection will take 7.5mS more or less

    I assume you meant "connection interval" of 7.5ms ? 

    If you want to have support for multiple peripherals and if you don't need too low connection interval (7.5ms) I would suggest to use 20ms connection interval. It will be easier for the scheduler to handle multiple connection with slightly larger connection interval (e.g 20ms) .  

  • The problem is that in 20ms I have also to send 30 byte to the first peripheral,30byte to the sencond peripheral etc. ... to 4th peripheral. Sorry for me is not clear the meaning of:

    peripheral prefered minimum connection interval  for me is 7ms (at step  of 1.25ms)  It wil be used  the minimun range is 6 

    peripheral prefered maximun  connection interval  for me 20mS (at step of 1.25ms) or it have to be 500mS the connection will be always active. 500mS/1.125ms the maximunh is 65000 .....I CAN USE THIS  to be always connected

    peripheral prefered latency in connection latency in connection interval    ==>0

    peripheral prefered supervision timeout in 10mS   for me is 100 ==> 1 sec....  Which is the best choise?  

     But at the polling rate you have which is 60ms, it's better to keep them all connected I think.!!! So this is the best solution  to have the peripheral  always connected ! 

  • Hi Novello, 

    novello said:

    peripheral prefered maximun  connection interval  for me 20mS (at step of 1.25ms) or it have to be 500mS the connection will be always active. 500mS/1.125ms the maximunh is 65000 .....I CAN USE THIS  to be always connected

    peripheral prefered latency in connection latency in connection interval    ==>0

    peripheral prefered supervision timeout in 10mS   for me is 100 ==> 1 sec....  Which is the best choise?  

    Please try to elaborate a bit more clear I don't fully understand what you are trying to describe here. 

    Note that the minimum and maximum connection interval is only for preference. There is only one actual connection interval used. 

    The unit of connection interval is in 1.25ms . So if you set minimum connection interval value to 6 it means 6x1.25 = 7.5ms 

    The unit of super vision timeout is 10ms. So if you set the timeout to value 200 , for example, then it's 200x10ms= 2 seconds. 

    Please note that the connection interval is not the same as the time it take to establish a connection. The connection interval the interval period when the central "ping" the peripheral. 

  • I'm trying to use the Bluetooth connection contex us is used in multi-nus. (for the moment). I need frome a central_uart to connect with 4 peripleral_uart and then send a mesage to the 4 peripheral every 20ms  ( I will do the complete loop in 80ms)

    If I setup:

    peripheral prefered maximun  connection interval =65000

    peripheral prefered minimun  connection interval =65000  

    Then the connection bettwen the 5 ble devices is always ON.

    And I will use the :The unit of super vision timeout is 10ms. So if you set the timeout to value 200 , for example, then it's 200x10ms= 2 seconds. To verify if a device is "dead " There  is a callback that inform the application layer that a device is not "visible"? 

     

  • Hi Novello, 


    I think you are having a misunderstanding on the Bluetooth connection. 

    The Bluetooth connection is always ON regardless of the connection interval. It only terminated if you either do a disconnection, or the devices are not in range. 

    The max and min connection interval doesn't mean it's the connection time. It's the interval. I would suggest to have a look at this video.

    For example a connection interval of 100ms meaning that every 100ms the central will ping the peripheral and the peripheral will response to the ping of the central. This way the 2 devices know that they still can communicate to each other. 

    The super vision timeout is used when the device can't communicate between each other (no ping) for a long time. If the time that they are not communicated is over the super vision timeout the connection will be terminated. 

    The minimum and maximum connection interval is only the preferable value that the peripheral gives the central, so the central can choose a connection interval inside the range between minimum and maximum connection interval.  

Related