Skip to content

Commit ac84995

Browse files
cvinayakcarlescufi
authored andcommitted
Bluetooth: Controller: Fix use of pre-programmed PPI
Fix to not use pre-programmed PPI when NRF_TIMER0 is not used as the radio event timer. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent cfcbe5d commit ac84995

File tree

2 files changed

+23
-24
lines changed

2 files changed

+23
-24
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#if defined(CONFIG_BT_CTLR_TIFS_HW) || !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
7+
#if (EVENT_TIMER_ID == 0)
88

99
/* PPI channel 20 is pre-programmed with the following fixed settings:
1010
* EEP: TIMER0->EVENTS_COMPARE[0]
@@ -35,15 +35,15 @@
3535
*/
3636
#define HAL_RADIO_END_TIME_CAPTURE_PPI 27
3737

38-
#else /* CONFIG_BT_CTLR_TIFS_HW || !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
38+
#else /* EVENT_TIMER_ID != 0 */
3939

4040
#define HAL_RADIO_ENABLE_TX_ON_TICK_PPI 2
4141
#define HAL_RADIO_ENABLE_RX_ON_TICK_PPI 2
4242
#define HAL_RADIO_RECV_TIMEOUT_CANCEL_PPI 3
4343
#define HAL_RADIO_DISABLE_ON_HCTO_PPI 4
4444
#define HAL_RADIO_END_TIME_CAPTURE_PPI 5
4545

46-
#endif /* CONFIG_BT_CTLR_TIFS_HW || !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
46+
#endif /* EVENT_TIMER_ID != 0 */
4747

4848
/* Start event timer on RTC tick wire the RTC0 EVENTS_COMPARE[2] event to
4949
* EVENT_TIMER TASKS_START task.
@@ -89,7 +89,7 @@
8989
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
9090
/* PPI setup used for SW-based auto-switching during TIFS. */
9191

92-
#if !defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
92+
#if (EVENT_TIMER_ID == 0)
9393

9494
/* Clear SW-switch timer on packet end:
9595
* wire the RADIO EVENTS_END event to SW_SWITCH_TIMER TASKS_CLEAR task.
@@ -98,7 +98,7 @@
9898
*/
9999
#define HAL_SW_SWITCH_TIMER_CLEAR_PPI 8
100100

101-
#else /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
101+
#else /* EVENT_TIMER_ID != 0 */
102102

103103
/* Clear event timer (sw-switch timer) on Radio end:
104104
* wire the RADIO EVENTS_END event to the
@@ -109,7 +109,7 @@
109109
*/
110110
#define HAL_SW_SWITCH_TIMER_CLEAR_PPI HAL_RADIO_END_TIME_CAPTURE_PPI
111111

112-
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
112+
#endif /* EVENT_TIMER_ID != 0 */
113113

114114
/* Wire a SW SWITCH TIMER EVENTS_COMPARE[<cc_offset>] event
115115
* to a PPI GROUP TASK DISABLE task (PPI group with index <index>).

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

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,24 @@
77
/* Use the timer instance ID, not NRF_TIMERx directly, so that it can be checked
88
* in radio_nrf5_ppi.h by the preprocessor.
99
*/
10-
#if !defined(CONFIG_BT_CTLR_TIFS_HW)
10+
#if defined(CONFIG_BT_CTLR_TIFS_HW)
11+
#define EVENT_TIMER_ID 0
12+
#define EVENT_TIMER _CONCAT(NRF_TIMER, EVENT_TIMER_ID)
1113

14+
/* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission
15+
* or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is
16+
* received or transmitted.
17+
*/
18+
#define NRF_RADIO_TXRX_END_EVENT EVENTS_END
19+
/* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE.
20+
* This is a default shortcut used to automatically disable Radio after end of PDU.
21+
*/
22+
#define NRF_RADIO_SHORTS_PDU_END_DISABLE RADIO_SHORTS_END_DISABLE_Msk
23+
24+
#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3
25+
#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3
26+
27+
#else /* !CONFIG_BT_CTLR_TIFS_HW */
1228
#if defined(CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER)
1329
#define EVENT_TIMER_ID 4
1430
#define EVENT_TIMER _CONCAT(NRF_TIMER, EVENT_TIMER_ID)
@@ -110,21 +126,4 @@
110126
#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3
111127
#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3
112128
#endif /* !CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER */
113-
114-
#else /* !CONFIG_BT_CTLR_TIFS_HW */
115-
#define EVENT_TIMER_ID 0
116-
#define EVENT_TIMER _CONCAT(NRF_TIMER, EVENT_TIMER_ID)
117-
118-
/* Wrapper for EVENTS_END event generated by Radio peripheral at the very end of the transmission
119-
* or reception of a PDU on air. In case of regular PDU it is generated when last bit of CRC is
120-
* received or transmitted.
121-
*/
122-
#define NRF_RADIO_TXRX_END_EVENT EVENTS_END
123-
/* Wrapper for RADIO_SHORTS mask connecting EVENTS_END to EVENTS_DISABLE.
124-
* This is a default shortcut used to automatically disable Radio after end of PDU.
125-
*/
126-
#define NRF_RADIO_SHORTS_PDU_END_DISABLE RADIO_SHORTS_END_DISABLE_Msk
127-
128-
#define HAL_EVENT_TIMER_SAMPLE_CC_OFFSET 3
129-
#define HAL_EVENT_TIMER_SAMPLE_TASK NRF_TIMER_TASK_CAPTURE3
130129
#endif /* !CONFIG_BT_CTLR_TIFS_HW */

0 commit comments

Comments
 (0)