You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2017/05/11 13:42:15 UTC

[3/5] incubator-mynewt-core git commit: nimble/ll: Add option to schedule connection with non-zero WindowOffset

nimble/ll: Add option to schedule connection with non-zero WindowOffset

Devices based on TI CC254x with older stack version have bug where
connection parameters are not updated properly on slave device if
transmitWindowOffset in CONNECT_IND was set to 0 (and apparently this
applies to 1 as well).

To workaround this, we allow to use larger transmitWindowOffset in
CONNECT_IND - by default this is set to 0, for old TI CC254x IOP should
be set to at least 2.

This also fixes MYNEWT-526.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/9f3452ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/9f3452ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/9f3452ca

Branch: refs/heads/master
Commit: 9f3452cab921043743b9512c55e248acdb676d5d
Parents: baa74ed
Author: Andrzej Kaczmarek <an...@codecoup.pl>
Authored: Tue Apr 25 08:08:10 2017 +0200
Committer: Andrzej Kaczmarek <an...@codecoup.pl>
Committed: Thu May 11 10:47:11 2017 +0200

----------------------------------------------------------------------
 net/nimble/controller/src/ble_ll_sched.c |  7 ++++---
 net/nimble/controller/syscfg.yml         | 10 ++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9f3452ca/net/nimble/controller/src/ble_ll_sched.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_sched.c b/net/nimble/controller/src/ble_ll_sched.c
index 4713f3d..6939a96 100644
--- a/net/nimble/controller/src/ble_ll_sched.c
+++ b/net/nimble/controller/src/ble_ll_sched.c
@@ -365,12 +365,13 @@ ble_ll_sched_master_new(struct ble_ll_conn_sm *connsm,
      * request transmission. Note that adv_rxend is the end of the received
      * advertisement, so we need to add an IFS plus the time it takes to send
      * the connection request. The 1.25 msecs starts from the end of the conn
-     * request.
+     * request. Also include minimum WindowOffset value if configured.
      */
     dur = os_cputime_usecs_to_ticks(req_slots * BLE_LL_SCHED_USECS_PER_SLOT);
     earliest_start = adv_rxend +
         os_cputime_usecs_to_ticks(BLE_LL_IFS + BLE_LL_CONN_REQ_DURATION +
-                                  BLE_LL_CONN_INITIAL_OFFSET);
+                                  BLE_LL_CONN_INITIAL_OFFSET +
+                                  MYNEWT_VAL(BLE_LL_CONN_INIT_MIN_WIN_OFFSET) * BLE_LL_CONN_TX_OFF_USECS);
     earliest_end = earliest_start + dur;
     itvl_t = os_cputime_usecs_to_ticks(connsm->conn_itvl * BLE_LL_CONN_ITVL_USECS);
 #endif
@@ -385,7 +386,7 @@ ble_ll_sched_master_new(struct ble_ll_conn_sm *connsm,
     if (!ble_ll_sched_insert_if_empty(sch)) {
         /* Nothing in schedule. Schedule as soon as possible */
         rc = 0;
-        connsm->tx_win_off = 0;
+        connsm->tx_win_off = MYNEWT_VAL(BLE_LL_CONN_INIT_MIN_WIN_OFFSET);
     } else {
         os_cputime_timer_stop(&g_ble_ll_sched_timer);
         TAILQ_FOREACH(entry, &g_ble_ll_sched_q, link) {

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/9f3452ca/net/nimble/controller/syscfg.yml
----------------------------------------------------------------------
diff --git a/net/nimble/controller/syscfg.yml b/net/nimble/controller/syscfg.yml
index fd4f48a..9af7d96 100644
--- a/net/nimble/controller/syscfg.yml
+++ b/net/nimble/controller/syscfg.yml
@@ -128,6 +128,16 @@ syscfg.defs:
             scheduled items will be at least this far apart
         value: '4'
 
+    BLE_LL_CONN_INIT_MIN_WIN_OFFSET:
+        description: >
+            This is the minimum number of "slots" for WindowOffset value used for
+            CONNECT_IND when creating new connection as a master. Each slot is 1.25
+            msecs long. Increasing this value will delay first connection event after
+            connection is created. However, older TI CC254x controllers cannot change
+            connection parameters later if WindowOffset was set to 0 in CONNECT_IND. To
+            ensure interoperability with such devices set this value to 2 (or more).
+        value: '0'
+
     # The number of random bytes to store
     BLE_LL_RNG_BUFSIZE:
         description: >