Bluetooth: Controller: Fix radio_tmr_aa_save() value for ISO receive
Fix the access address and radio ready timestamp to derive
the value of the first subevent, so that correct anchor
point reference is used in scheduling subsequent subevents.
@@ -522,19 +522,30 @@ static void isr_rx(void *param)
rssi_ready = radio_rssi_is_ready();
trx_cnt++;
+ /* initialize LLL context reference */
+ lll = param;
+
/* Save the AA captured for the first anchor point sync */
if (!radio_tmr_aa_restore()) {
+ const struct lll_sync_iso_stream *stream;
+ uint32_t se_offset_us;
+ uint8_t se;
+
crc_ok_anchor = crc_ok;
- radio_tmr_aa_save(radio_tmr_aa_get());
- radio_tmr_ready_save(radio_tmr_ready_get());
+
+ stream = ull_sync_iso_lll_stream_get(lll->stream_handle[0]);
+ se = ((lll->bis_curr - stream->bis_index) *
+ ((lll->bn * lll->irc) + lll->ptc)) +
+ ((lll->irc_curr - 1U) * lll->bn) + (lll->bn_curr - 1U) +
+ lll->ptc_curr + lll->ctrl;
+ se_offset_us = lll->sub_interval * se;
+ radio_tmr_aa_save(radio_tmr_aa_get() - se_offset_us);
+ radio_tmr_ready_save(radio_tmr_ready_get() - se_offset_us);
}
/* Clear radio rx status and events */
lll_isr_rx_status_reset();
- /* initialize LLL context reference */
- lll = param;
-
/* BIS index */
bis_idx = lll->bis_curr - 1U;
