Skip to content

Commit 1c36595

Browse files
cvinayakioannisg
authored andcommitted
Bluetooth: controller: nRF53x: Fix missing sw_switch clear DPPI config
Fix missing sw_switch timer clear DPPI config when re-enabling Tx or Rx after radio_disable() or radio_switch_complete_and_disable() call in LLL state/role contexts. Fixes #28471. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 2f7cc4a commit 1c36595

File tree

1 file changed

+65
-0
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio

1 file changed

+65
-0
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,45 @@ uint32_t radio_rx_chain_delay_get(uint8_t phy, uint8_t flags)
293293

294294
void radio_rx_enable(void)
295295
{
296+
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
297+
#if defined(CONFIG_SOC_SERIES_NRF53X)
298+
/* NOTE: Timer clear DPPI configuration is needed only for nRF53
299+
* because of calls to radio_disable() and
300+
* radio_switch_complete_and_disable() inside a radio event call
301+
* hal_radio_sw_switch_disable(), which in the case of nRF53
302+
* cancels the task subscription.
303+
*/
304+
/* FIXME: hal_sw_switch_timer_clear_ppi_config() sets both task and
305+
* event. Consider a new interface to only set the task, or
306+
* change the design to not clear task subscription inside a
307+
* radio event but when the radio event is done.
308+
*/
309+
hal_sw_switch_timer_clear_ppi_config();
310+
#endif /* CONFIG_SOC_SERIES_NRF53X */
311+
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
312+
296313
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_RXEN);
297314
}
298315

299316
void radio_tx_enable(void)
300317
{
318+
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
319+
#if defined(CONFIG_SOC_SERIES_NRF53X)
320+
/* NOTE: Timer clear DPPI configuration is needed only for nRF53
321+
* because of calls to radio_disable() and
322+
* radio_switch_complete_and_disable() inside a radio event call
323+
* hal_radio_sw_switch_disable(), which in the case of nRF53
324+
* cancels the task subscription.
325+
*/
326+
/* FIXME: hal_sw_switch_timer_clear_ppi_config() sets both task and
327+
* event. Consider a new interface to only set the task, or
328+
* change the design to not clear task subscription inside a
329+
* radio event but when the radio event is done.
330+
*/
331+
hal_sw_switch_timer_clear_ppi_config();
332+
#endif /* CONFIG_SOC_SERIES_NRF53X */
333+
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
334+
301335
nrf_radio_task_trigger(NRF_RADIO, NRF_RADIO_TASK_TXEN);
302336
}
303337

@@ -739,6 +773,20 @@ uint32_t radio_tmr_start_tick(uint8_t trx, uint32_t tick)
739773
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
740774
last_pdu_end_us = 0U;
741775
#endif /* CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
776+
#if defined(CONFIG_SOC_SERIES_NRF53X)
777+
/* NOTE: Timer clear DPPI configuration is needed only for nRF53
778+
* because of calls to radio_disable() and
779+
* radio_switch_complete_and_disable() inside a radio event call
780+
* hal_radio_sw_switch_disable(), which in the case of nRF53
781+
* cancels the task subscription.
782+
*/
783+
/* FIXME: hal_sw_switch_timer_clear_ppi_config() sets both task and
784+
* event. Consider a new interface to only set the task, or
785+
* change the design to not clear task subscription inside a
786+
* radio event but when the radio event is done.
787+
*/
788+
hal_sw_switch_timer_clear_ppi_config();
789+
#endif /* CONFIG_SOC_SERIES_NRF53X */
742790
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
743791

744792
return remainder_us;
@@ -757,6 +805,23 @@ uint32_t radio_tmr_start_now(uint8_t trx)
757805

758806
hal_radio_enable_on_tick_ppi_config_and_enable(trx);
759807

808+
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
809+
#if defined(CONFIG_SOC_SERIES_NRF53X)
810+
/* NOTE: Timer clear DPPI configuration is needed only for nRF53
811+
* because of calls to radio_disable() and
812+
* radio_switch_complete_and_disable() inside a radio event call
813+
* hal_radio_sw_switch_disable(), which in the case of nRF53
814+
* cancels the task subscription.
815+
*/
816+
/* FIXME: hal_sw_switch_timer_clear_ppi_config() sets both task and
817+
* event. Consider a new interface to only set the task, or
818+
* change the design to not clear task subscription inside a
819+
* radio event but when the radio event is done.
820+
*/
821+
hal_sw_switch_timer_clear_ppi_config();
822+
#endif /* CONFIG_SOC_SERIES_NRF53X */
823+
#endif /* !CONFIG_BT_CTLR_TIFS_HW */
824+
760825
/* Capture the current time */
761826
nrf_timer_task_trigger(EVENT_TIMER, NRF_TIMER_TASK_CAPTURE1);
762827
now = EVENT_TIMER->CC[1];

0 commit comments

Comments
 (0)