Skip to content

Commit 9c871fb

Browse files
bjornspockcarlescufi
authored andcommitted
Bluetooth: controller: nRF21540 FEM support for nRF52x Series
Added nRF21540 FEM support for nRF52x Series. Signed-off-by: Bjørn Spockeli <[email protected]> Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 9930e22 commit 9c871fb

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,29 @@ static inline void hal_lna_ppi_setup(void)
297297
/* Nothing specific to LNA with FEM to handle inside TRX chains */
298298
}
299299

300-
/* TODO: Dummy assignments, implementation will be added in subsequently */
301300
#define HAL_ENABLE_FEM_PPI 4
302301
#define HAL_DISABLE_FEM_PPI 5
303302

304303
static inline void hal_fem_ppi_setup(void)
305304
{
306-
/* TODO: Implementation will be added in subsequently */
305+
nrf_ppi_channel_and_fork_endpoint_setup(
306+
NRF_PPI,
307+
HAL_ENABLE_FEM_PPI,
308+
(uint32_t)&(EVENT_TIMER->EVENTS_COMPARE[3]),
309+
(uint32_t)&(NRF_GPIOTE->TASKS_OUT[
310+
CONFIG_BT_CTLR_PDN_GPIOTE_CHAN]),
311+
(uint32_t)&(NRF_GPIOTE->TASKS_OUT[
312+
CONFIG_BT_CTLR_CSN_GPIOTE_CHAN]));
313+
nrf_ppi_channel_and_fork_endpoint_setup(
314+
NRF_PPI,
315+
HAL_DISABLE_FEM_PPI,
316+
(uint32_t)&(NRF_RADIO->EVENTS_DISABLED),
317+
(uint32_t)&(NRF_GPIOTE->TASKS_OUT[
318+
CONFIG_BT_CTLR_PDN_GPIOTE_CHAN]),
319+
(uint32_t)&(NRF_GPIOTE->TASKS_OUT[
320+
CONFIG_BT_CTLR_CSN_GPIOTE_CHAN]));
307321
}
322+
308323
#endif /* CONFIG_BT_CTLR_FEM_NRF21540 */
309324

310325
/******************************************************************************/
@@ -639,7 +654,8 @@ static inline void hal_radio_sw_switch_ppi_group_setup(void)
639654
BIT(HAL_TRIGGER_CRYPT_PPI) | \
640655
BIT(HAL_TRIGGER_AAR_PPI) | \
641656
HAL_USED_PPI_CHANNELS_2 | HAL_USED_PPI_CHANNELS_3 | \
642-
HAL_USED_PPI_CHANNELS_4 | HAL_USED_PPI_CHANNELS_5)
657+
HAL_USED_PPI_CHANNELS_4 | HAL_USED_PPI_CHANNELS_5 | \
658+
HAL_USED_PPI_CHANNELS_6)
643659

644660
#if defined(HAL_TRIGGER_RATEOVERRIDE_PPI)
645661
#define HAL_USED_PPI_CHANNELS_2 \
@@ -677,6 +693,14 @@ static inline void hal_radio_sw_switch_ppi_group_setup(void)
677693
#define HAL_USED_PPI_CHANNELS_5 0
678694
#endif
679695

696+
#if defined(HAL_ENABLE_FEM_PPI)
697+
#define HAL_USED_PPI_CHANNELS_6 \
698+
(BIT(HAL_ENABLE_FEM_PPI) | \
699+
BIT(HAL_DISABLE_FEM_PPI))
700+
#else
701+
#define HAL_USED_PPI_CHANNELS_6 0
702+
#endif
703+
680704
BUILD_ASSERT(
681705
(HAL_USED_PPI_CHANNELS & NRFX_PPI_CHANNELS_USED_BY_PWM_SW) == 0,
682706
"PPI channels used by the Bluetooth controller overlap with those "

0 commit comments

Comments
 (0)