Bluetooth: controller: Fix slave drift compensation

As ticker can only drift in 32kHz units, the slave Rx
window should consider a +/- one 32kHz unit in addition to
+/- 16us jitter of the master. Hence, for the current
implementation the slave Rx window jitter is +/- 48us.
Future improvement can be done by using remainder of 32kHz
unit drift to reduce this jitter to +/- 16us.

With this fix 20ppm clock accuracy passes conformance TIM
tests (else 251-500ppm had to be used).

Problem was not seen in real life as master do not have a
+/- 16us jitter.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2017-07-19 05:51:58 +02:00 committed by Johan Hedberg
commit a682554231

View file

@ -1009,6 +1009,7 @@ static inline u32_t isr_rx_adv(u8_t devmatch_ok, u8_t devmatch_id,
conn_offset_us -= radio_tx_chain_delay_get(0, 0);
conn_offset_us -= rx_ready_delay;
conn_offset_us -= RADIO_TICKER_JITTER_US << 1;
conn_offset_us -= RADIO_TICKER_JITTER_US;
/* Stop Advertiser */
ticker_status = ticker_stop(RADIO_TICKER_INSTANCE_ID_RADIO,
@ -3180,7 +3181,7 @@ static inline void isr_close_conn(void)
#else /* !CONFIG_BLUETOOTH_CONTROLLER_PHY */
preamble_to_addr_us = addr_us_get(0);
#endif /* !CONFIG_BLUETOOTH_CONTROLLER_PHY */
start_to_address_expected_us =
start_to_address_expected_us = RADIO_TICKER_JITTER_US +
(RADIO_TICKER_JITTER_US << 1) +
preamble_to_addr_us +
window_widening_event_us;
@ -3195,7 +3196,8 @@ static inline void isr_close_conn(void)
ticks_drift_plus =
TICKER_US_TO_TICKS(start_to_address_actual_us);
ticks_drift_minus =
TICKER_US_TO_TICKS((RADIO_TICKER_JITTER_US << 1) +
TICKER_US_TO_TICKS(RADIO_TICKER_JITTER_US +
(RADIO_TICKER_JITTER_US << 1) +
preamble_to_addr_us);
}
@ -6933,7 +6935,8 @@ static void event_slave(u32_t ticks_at_expire, u32_t remainder, u16_t lazy,
TICKER_US_TO_TICKS(RADIO_TICKER_START_PART_US),
_radio.remainder_anchor);
radio_tmr_aa_capture();
hcto = remainder_us + (RADIO_TICKER_JITTER_US << 2) +
hcto = remainder_us + RADIO_TICKER_JITTER_US +
(RADIO_TICKER_JITTER_US << 2) +
(conn->slave.window_widening_event_us << 1) +
conn->slave.window_size_event_us;