Skip to content

Commit

Permalink
samples: peripheral: 802154_phy_test: support nRF54L15
Browse files Browse the repository at this point in the history
Enable 802154_phy_test sample for nRF54L15.

Signed-off-by: Jędrzej Ciupis <[email protected]>
  • Loading branch information
Jędrzej Ciupis authored and cvinayak committed Apr 18, 2024
1 parent 03d0966 commit 7be7808
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ Peripheral samples
* Support for the :ref:`nRF54L15 PDK <ug_nrf54l15_gs>` board.
* Support for the :ref:`zephyr:nrf54h20dk_nrf54h20` board.

* :ref:`802154_phy_test` sample:

* Added support for the :ref:`nRF54L15 PDK <ug_nrf54l15_gs>` board.

PMIC samples
------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
#

CONFIG_SHELL_PROMPT_UART=">"

# nrfx drivers configuration:
CONFIG_NRFX_POWER=y # enable DC/DC support
CONFIG_NRFX_RNG=y # enable RNG
CONFIG_NRFX_TIMER2=y # enable TIMER2

# Allow sharing the RTC between IEEE 802.15.4 and Zephyr
CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=3
15 changes: 15 additions & 0 deletions samples/peripheral/802154_phy_test/boards/nrf52833dk_nrf52833.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2023 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_SHELL_PROMPT_UART=">"

# nrfx drivers configuration:
CONFIG_NRFX_POWER=y # enable DC/DC support
CONFIG_NRFX_RNG=y # enable RNG
CONFIG_NRFX_TIMER2=y # enable TIMER2

# Allow sharing the RTC between IEEE 802.15.4 and Zephyr
CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=3
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
#

CONFIG_SHELL_PROMPT_UART=">"

# nrfx drivers configuration:
CONFIG_NRFX_POWER=y # enable DC/DC support
CONFIG_NRFX_RNG=y # enable RNG
CONFIG_NRFX_TIMER2=y # enable TIMER2

# Allow sharing the RTC between IEEE 802.15.4 and Zephyr
CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=3
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ CONFIG_NCS_SAMPLE_REMOTE_SHELL_CHILD_IMAGE=y
CONFIG_APP_RPC=y

CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=2

# nrfx drivers configuration:
CONFIG_NRFX_POWER=y # enable DC/DC support
CONFIG_NRFX_RNG=y # enable RNG
CONFIG_NRFX_TIMER2=y # enable TIMER2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_SHELL_PROMPT_UART=">"

# currently unsupported for nRF54L15
CONFIG_PTT_CACHE_MGMT=n

# nrfx drivers configuration:
CONFIG_NRFX_TIMER20=y # enable TIMER2
CONFIG_NRFX_DPPI=y # enable DPPIC
11 changes: 0 additions & 11 deletions samples/peripheral/802154_phy_test/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,12 @@ CONFIG_LOG_BACKEND_UART=n
# Enable temperature sensor
CONFIG_NRFX_TEMP=y

# Enable DC/DC Support
CONFIG_NRFX_POWER=y

# Enable RNG
CONFIG_NRFX_RNG=y
# Use XOSHIRO PRNG
CONFIG_XOSHIRO_RANDOM_GENERATOR=y

# Enable Timer
CONFIG_NRFX_TIMER2=y

# Enabling radio driver
CONFIG_NRF_802154_RADIO_DRIVER=y

# Allow sharing the RTC between IEEE 802.15.4 and Zephyr
CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=3

# Enable ring buffers
CONFIG_RING_BUFFER=y

Expand Down
3 changes: 2 additions & 1 deletion samples/peripheral/802154_phy_test/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ tests:
- nrf52840dk_nrf52840
- nrf21540dk_nrf52840
- nrf5340dk_nrf5340_cpunet
- nrf54l15pdk_nrf54l15_cpuapp
platform_allow: nrf52833dk_nrf52833 nrf52840dk_nrf52840 nrf21540dk_nrf52840
nrf5340dk_nrf5340_cpunet
nrf5340dk_nrf5340_cpunet nrf54l15pdk_nrf54l15_cpuapp
tags: ci_build ci_rs_build ci_rs_weekly
sample.peripheral.802154_phy_test.ant_div_mode_auto:
build_only: true
Expand Down
22 changes: 20 additions & 2 deletions samples/peripheral/802154_phy_test/src/periph_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ LOG_MODULE_REGISTER(periph);

#if IS_ENABLED(CONFIG_PTT_CLK_OUT)
/* Timer instance used for HFCLK output */
#if defined(NRF52_SERIES) || defined(NRF53_SERIES)
#define PTT_CLK_TIMER 2
#elif defined(NRF54L_SERIES)
#define PTT_CLK_TIMER 20
#endif

static nrfx_timer_t clk_timer = NRFX_TIMER_INSTANCE(PTT_CLK_TIMER);

Expand All @@ -50,12 +54,22 @@ static nrfx_timer_t clk_timer = NRFX_TIMER_INSTANCE(PTT_CLK_TIMER);
[DT_PROP(gpio_node, port)] = \
NRFX_GPIOTE_INSTANCE(DT_PROP(GPIOTE_NODE(gpio_node), instance)),

#define COND_GPIOTE_INST_AND_COMMA(gpio_node) \
COND_CODE_1(DT_NODE_HAS_PROP(gpio_node, gpiote_instance), \
(GPIOTE_INST_AND_COMMA(gpio_node)), \
())

static const nrfx_gpiote_t gpiote_inst[GPIO_COUNT] = {
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpio, GPIOTE_INST_AND_COMMA)
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpio, COND_GPIOTE_INST_AND_COMMA)
};

#define NRF_GPIOTE_FOR_GPIO(idx) &gpiote_inst[idx]
#define NRF_GPIOTE_FOR_PSEL(psel) &gpiote_inst[psel >> 5]

static inline bool gpiote_is_valid(const nrfx_gpiote_t *gpiote)
{
return gpiote->p_reg != NULL;
}
#endif /* IS_ENABLED(CONFIG_PTT_CLK_OUT) */

static const struct gpio_dt_spec led0 = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
Expand Down Expand Up @@ -94,6 +108,10 @@ void periph_init(void)
for (int i = 0; i < GPIO_COUNT; ++i) {
const nrfx_gpiote_t *gpiote = NRF_GPIOTE_FOR_GPIO(i);

if (!gpiote_is_valid(gpiote)) {
continue;
}

if (!nrfx_gpiote_init_check(gpiote)) {
err_code = nrfx_gpiote_init(gpiote, 0);
NRFX_ASSERT(err_code);
Expand Down Expand Up @@ -127,7 +145,7 @@ bool ptt_clk_out_ext(uint8_t pin, bool mode)
nrfx_err_t err;
const nrfx_gpiote_t *gpiote = NRF_GPIOTE_FOR_PSEL(pin);

if (!nrf_gpio_pin_present_check(pin)) {
if (!nrf_gpio_pin_present_check(pin) || !gpiote_is_valid(gpiote)) {
return false;
}

Expand Down

0 comments on commit 7be7808

Please sign in to comment.