Skip to content

Commit f67a94f

Browse files
cvinayakkartben
authored andcommitted
Bluetooth: Controller: Fix single timer end time capture
Fix single timer use end time capture from being disabled as end time and timer clear use the same PPI. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 65d69ec commit f67a94f

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_dppi.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,10 @@ static inline void hal_radio_sw_switch_cleanup(void)
528528
{
529529
hal_radio_sw_switch_disable();
530530
nrf_dppi_channels_disable(NRF_DPPIC,
531-
(BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) |
532-
BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI)));
531+
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
532+
BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) |
533+
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
534+
BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI));
533535
nrf_dppi_group_disable(NRF_DPPIC, SW_SWITCH_TIMER_TASK_GROUP(0));
534536
nrf_dppi_group_disable(NRF_DPPIC, SW_SWITCH_TIMER_TASK_GROUP(1));
535537
}

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio_nrf5_ppi.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void)
170170
/* No need to configure anything for the pre-programmed channel. */
171171
}
172172

173-
#else
173+
#else /* !(EVENT_TIMER_ID == 0) */
174174

175175
static inline void hal_radio_end_time_capture_ppi_config(void)
176176
{
@@ -181,7 +181,7 @@ static inline void hal_radio_end_time_capture_ppi_config(void)
181181
(uint32_t)&(EVENT_TIMER->TASKS_CAPTURE[HAL_EVENT_TIMER_TRX_END_CC_OFFSET]));
182182
}
183183

184-
#endif /* (EVENT_TIMER_ID == 0) */
184+
#endif /* !(EVENT_TIMER_ID == 0) */
185185

186186
/*******************************************************************************
187187
* Start event timer on RTC tick:
@@ -307,7 +307,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void)
307307
(uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR));
308308
}
309309

310-
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
310+
#else /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
311311

312312
/* Clear event timer (sw-switch timer) on Radio end:
313313
* wire the RADIO EVENTS_END event to the
@@ -325,7 +325,7 @@ static inline void hal_sw_switch_timer_clear_ppi_config(void)
325325
(uint32_t)&(SW_SWITCH_TIMER->TASKS_CLEAR));
326326
}
327327

328-
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
328+
#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
329329

330330
/* The 2 adjacent PPI groups used for implementing SW_SWITCH_TIMER-based
331331
* auto-switch for TIFS. 'index' must be 0 or 1.
@@ -453,11 +453,15 @@ static inline void hal_radio_sw_switch_disable(void)
453453
{
454454
/* Disable the following PPI channels that implement SW Switch:
455455
* - Clearing SW SWITCH TIMER on RADIO END event
456+
* - Do not clear for single timer use as it uses the same PPI as
457+
* end time capture
456458
* - Enabling SW SWITCH PPI Group on RADIO END event
457459
*/
458460
nrf_ppi_channels_disable(
459461
NRF_PPI,
462+
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
460463
BIT(HAL_SW_SWITCH_TIMER_CLEAR_PPI) |
464+
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
461465
BIT(HAL_SW_SWITCH_GROUP_TASK_ENABLE_PPI));
462466

463467
/* Invalidation of subscription of S2 timer Compare used when

0 commit comments

Comments
 (0)