You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2022/01/18 15:05:19 UTC
[mynewt-nimble] branch master updated: nimble/ll: Adjust start time of the first anchor point of connection
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new 35a5603 nimble/ll: Adjust start time of the first anchor point of connection
35a5603 is described below
commit 35a560341c294c0d626a7d5fcd17126f9e2e1b17
Author: Yeming Li <62...@qq.com>
AuthorDate: Fri Dec 31 15:40:18 2021 +0800
nimble/ll: Adjust start time of the first anchor point of connection
Set the start_time of the first anchor point of new connection to
entry->end_time+1.
For the 32768 Hz crystal in nrf chip, 1 tick is 30.517us.
The connection state machine use anchor point to store the cpu
ticks and anchor_point_usec to store the remainder. Therefore,
to compensate the inaccuracy of the crystal, the ticks of
anchor_point will be add with 1 once the value of
anchor_point_usec exceed 31. If two connections have same
connection interval, the time difference between the two start
of schedule item will decreased 1, which lead to an overlap.
To prevent this from happenning, we set the start_time of sch
to 1 cpu tick after the end_time of entry.
---
nimble/controller/src/ble_ll_sched.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/nimble/controller/src/ble_ll_sched.c b/nimble/controller/src/ble_ll_sched.c
index fe47dbc..cd60014 100644
--- a/nimble/controller/src/ble_ll_sched.c
+++ b/nimble/controller/src/ble_ll_sched.c
@@ -237,7 +237,19 @@ ble_ll_sched_insert(struct ble_ll_sched_item *sch, uint32_t max_delay,
}
} else {
preempt_first = NULL;
- sch->start_time = entry->end_time;
+ /*
+ * For the 32768 Hz crystal in nrf chip, 1 tick is 30.517us.
+ * The connection state machine use anchor point to store the
+ * cpu ticks and anchor_point_usec to store the remainder.
+ * Therefore, to compensate the inaccuracy of the crystal, the
+ * ticks of anchor_point will be add with 1 once the value of
+ * anchor_point_usec exceed 31. If two connections have same
+ * connection interval, the time difference between the two
+ * start of schedule item will decreased 1, which lead to
+ * an overlap. To prevent this from happenning, we set the
+ * start_time of sch to 1 cpu tick after the end_time of entry.
+ */
+ sch->start_time = entry->end_time + 1;
if ((max_delay == 0) || CPUTIME_GEQ(sch->start_time,
max_start_time)) {