Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nrfx/samples/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Changelog
All notable changes to this project are documented in this file.

## [3.14.0] - 2025-08-22
### Added
- Added support for the nRF54L15 DK to all existing samples except for the RNG sample.
- Added sample for the CRACEN driver.

### Changed
- Divided existing loopback definitions in `common/nrfx_example.h` into individual header files for each board in `common/boards`.
- Moved pin definitions from individual samples to board header files in `common/boards`.

## [3.8.0] - 2024-10-17
### Changed
- Aligned Kconfig definitions to DPPIC multi-instance support in the GPPI and SAADC driver samples.
Expand Down
93 changes: 93 additions & 0 deletions nrfx/samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
## Introduction and configuration

This repository contains sample applications showing the usage examples of the [nrfx drivers] within [Zephyr RTOS].

## Installation

1. Set up Zephyr by following [Getting started] guide.

> Always activate the virtual environment with previously installed `west` and set up `Zephyr`.

## Requirements

Samples support the following development kits:

| **Hardware platforms** | **Board name** | **Build target** |
| ------------------------ | ------------------------- | ------------------------------- |
| nR52 DK | nrf52dk_nrf52832 | `nrf52dk_nrf52832` |
| nRF52833 DK | nrf52833dk_nrf52833 | `nrf52833dk_nrf52833` |
| nRF52840 DK | nrf52840dk_nrf52840 | `nrf52840dk_nrf52840` |
| nRF5340 DK | nrf5340dk_nrf5340 | `nrf5340dk_nrf5340_cpuapp` |
| nRF5340 DK | nrf5340dk_nrf5340 | `nrf5340dk_nrf5340_cpunet` |
| nRF54L15 DK | nrf54l15dk_nrf54l15 | `nrf54l15dk_nrf54l15_cpuapp` |
| nRF9160 DK | nrf9160dk_nrf9160 | `nrf9160dk_nrf9160` |

## Wiring

Samples use a unified system of pins assignment.
Refer to their definitnions in `common/nrfx_example.h`.
By default, pins are connected through different boards as follows:

| **Board name** | **1A** | **1B** | **2A** | **2B** | **3A** | **3B** | **4A** | **4B** |
|--------------------- | ------ | -------- | ------- | ------ | ------ | ------ | ------ | ------ |
| nrf52dk_nrf52832 | P0.03 | P0.31 | P0.04 | P0.30 | P0.28 | P0.29 | P0.26 | P0.27 |
| nrf52833dk_nrf52833 | P0.03 | P0.31 | P0.04 | P0.30 | P0.28 | P0.29 | P0.26 | P0.27 |
| nrf52840dk_nrf52840 | P0.03 | P0.31 | P0.04 | P0.30 | P0.28 | P0.29 | P0.26 | P0.27 |
| nrf5340dk_nrf5340 | P0.04 | P0.26 | P0.05 | P0.25 | P0.06 | P0.07 | P1.02 | P1.03 |
| nrf54l15dk_nrf54l15 | P1.13 | P1.12 | P1.11 | P1.10 | P1.09 | P1.08 | P2.06 | P1.04 |
| nrf9160dk_nrf9160 | P0.14 | P0.19 | P0.15 | P0.18 | P0.16 | P0.17 | P0.30 | P0.31 |

> If a specific sample is using some loopback pins, their corresponding pins should be connected together.
> For example, `LOOPBACK_PIN_1A` should be connected with `LOOPBACK_PIN_1B` and `LOOPBACK_PIN_2A` with `LOOPBACK_PIN_2B`.

@anchor building_and_running
## Building and running

1. Change the directory in `zephyrproject-rtos` repository to one of the samples:
```
cd modules/hal/nordic/nrfx/samples/src/nrfx_timer/timer/
```
2. Build the sample with the `west` on one of the supported boards.
```
west build -b <BOARD>
```
3. Flash the application on the connected target.
```
west flash
```
4. Configure a serial monitor to recognize the port connection with the following parameters:
- 115200 baud rate,
- 8 data bits,
- no parity bit,
- 1 stop bit,
- RTS/CTS flow control.
## Directories

```
.
├── common # Various boards and examples common files
├── doc # Project documentation files
└── src # Examples base
├── nrfx_cracen # Examples related to CRACEN peripheral
├── nrfx_egu # Examples related to EGU peripheral
├── nrfx_gppi # Examples related to GPPI helper
├── nrfx_pwm # Examples related to PWM peripheral
├── nrfx_rng # Examples related to RNG peripheral
.
.
.
```

@cond DOXYGEN_EXCLUDE
## Generating documentation

Documentation for the samples is available in the `doc/html` folder.
For more details refer to [Documentation].
@endcond

[//]: #
[nrfx drivers]: https://infocenter.nordicsemi.com/topic/struct_drivers/struct/nrfx_latest.html
[Zephyr RTOS]: https://docs.zephyrproject.org/latest/index.html
[Getting started]: https://docs.zephyrproject.org/latest/develop/getting_started/index.html
[Documentation]: doc/README.md

143 changes: 143 additions & 0 deletions nrfx/samples/common/boards/nrf52833dk_nrf52833_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#ifndef NRF52833DK_NRF52833_CONFIG_H__
#define NRF52833DK_NRF52833_CONFIG_H__

#define LOOPBACK_PIN_1A 3
#define LOOPBACK_PIN_1B 31
#define LOOPBACK_PIN_2A 4
#define LOOPBACK_PIN_2B 30
#define LOOPBACK_PIN_3A 28
#define LOOPBACK_PIN_3B 29
#define LOOPBACK_PIN_4A 26
#define LOOPBACK_PIN_4B 27

#define LED1_PIN 13
#define LED2_PIN 14
#define LED3_PIN 15
#define LED4_PIN 16

/** @brief Symbol specifying analog input associated with analog pin A0 on the Development Kit. */
#define ANALOG_INPUT_A0 1
/** @brief Symbol specifying analog input associated with analog pin A1 on the Development Kit. */
#define ANALOG_INPUT_A1 2
/** @brief Symbol specifying analog input associated with analog pin A2 on the Development Kit. */
#define ANALOG_INPUT_A2 4

/* EXAMPLE-SPECIFIC DEFINES: */

/* NRFX_EGU */
/** @brief Symbol specifying EGU instance to be used in the nrfx_egu example. */
#define EGU_INST_IDX 0

/* NRFX_GPPI */
/** @brief Symbol specifying TIMER instance to be used in the nrfx_gppi examples. */
#define GPPI_TIMER_INST_IDX 0

/** @brief Symbol specifying GPIOTE instance to be used in the nrfx_gppi examples. */
#define GPPI_GPIOTE_INST_IDX 0

/** @brief Symbol specifying output pin associated with primary task in the nrfx_gppi examples. */
#define GPPI_OUTPUT_PIN_PRIMARY LED1_PIN

/** @brief Symbol specifying output pin associated with fork task in the nrfx_gppi examples. */
#define GPPI_OUTPUT_PIN_FORK LED2_PIN

/* NRFX_PWM */
/** @brief Symbol specifying PWM instance to be used in the nrfx_pwm examples. */
#define PWM_INST_IDX 0

/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED1_PIN LED1_PIN
/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED2_PIN LED2_PIN
/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED3_PIN LED3_PIN
/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED4_PIN LED4_PIN

/* NRFX_SAADC */
/** @brief Symbol specifying GPIOTE instance to be used in the nrfx_saadc examples. */
#define SAADC_GPIOTE_INST_IDX 0

/** @brief Symbol specifying timer instance to be used in the nrfx_saadc examples. */
#define SAADC_TIMER_INST_IDX 0
/**
* @brief Symbol specifying the maximum number of SAADC channels that can be used in the
* nrfx_saadc examples.
*/
#define SAADC_MAX_CHANNELS 3

/** @brief Symbol specifying analog input to be observed by SAADC channel 0 in the nrfx_saadc examples. */
#define SAADC_CH0_AIN ANALOG_INPUT_TO_SAADC_AIN(ANALOG_INPUT_A0)
/** @brief Symbol specifying analog input to be observed by SAADC channel 1 in the nrfx_saadc examples. */
#define SAADC_CH1_AIN ANALOG_INPUT_TO_SAADC_AIN(ANALOG_INPUT_A1)
/** @brief Symbol specifying analog input to be observed by SAADC channel 2 in the nrfx_saadc examples. */
#define SAADC_CH2_AIN ANALOG_INPUT_TO_SAADC_AIN(ANALOG_INPUT_A2)

/** @brief Symbol specifying GPIO pin connected to SAADC channel 0 in the nrfx_saadc examples. */
#define SAADC_CH0_LOOPBACK_PIN LOOPBACK_PIN_1B
/** @brief Symbol specifying GPIO pin connected to SAADC channel 1 in the nrfx_saadc examples. */
#define SAADC_CH1_LOOPBACK_PIN LOOPBACK_PIN_2B
/** @brief Symbol specifying GPIO pin connected to SAADC channel 2 in the nrfx_saadc examples. */
#define SAADC_CH2_LOOPBACK_PIN LOOPBACK_PIN_3B

/* NRFX_SPIM */
/** @brief Symbol specifying SPIM instance to be used in nrfx_spim examples. */
#define SPIM_INST_IDX 1

/* NRFX_SPIM_SPIS */
/** @brief Symbol specifying SPIM instance to be used in nrfx_spim_spis examples. */
#define SPIM_SPIS_SPIM_INST_IDX 1
/** @brief Symbol specifying SPIS instance to be used in nrfx_spim_spis examples. */
#define SPIM_SPIS_SPIS_INST_IDX 2

/** @brief Symbol specifying master's pin number for MOSI in nrfx_spim_spis examples. */
#define SPIM_SPIS_MOSI_PIN_MASTER LOOPBACK_PIN_1A
/** @brief Symbol specifying slave's pin number for MOSI in nrfx_spim_spis examples. */
#define SPIM_SPIS_MOSI_PIN_SLAVE LOOPBACK_PIN_1B
/** @brief Symbol specifying master's pin number for MISO in nrfx_spim_spis examples. */
#define SPIM_SPIS_MISO_PIN_MASTER LOOPBACK_PIN_2A
/** @brief Symbol specifying slave's pin number for MISO in nrfx_spim_spis examples. */
#define SPIM_SPIS_MISO_PIN_SLAVE LOOPBACK_PIN_2B
/** @brief Symbol specifying master's pin number for SCK in nrfx_spim_spis examples. */
#define SPIM_SPIS_SCK_PIN_MASTER LOOPBACK_PIN_3A
/** @brief Symbol specifying slave's pin number for SCK in nrfx_spim_spis examples. */
#define SPIM_SPIS_SCK_PIN_SLAVE LOOPBACK_PIN_3B
/** @brief Symbol specifying master's pin number for SS in nrfx_spim_spis examples. */
#define SPIM_SPIS_SS_PIN_MASTER LOOPBACK_PIN_4A
/** @brief Symbol specifying slave's pin number for CSN in nrfx_spim_spis examples. */
#define SPIM_SPIS_CSN_PIN_SLAVE LOOPBACK_PIN_4B

/* NRFX_TIMER */
/** @brief Symbol specifying timer instance to be used in nrfx_timer/timer example. */
#define TIMER_INST_IDX 0

/** @brief Symbol specifying timer instance to be used in timer mode (T) in nrfx_timer/counter example. */
#define TIMER_T_INST_IDX 0
/** @brief Symbol specifying timer instance to be used in counter mode (C) in nrfx_timer/counter example. */
#define TIMER_C_INST_IDX 1

/* NRFX_TWIM_TWIS */
/** @brief Symbol specifying TWIM instance to be used in nrfx_twim_twis examples. */
#define TWIM_INST_IDX 0
/** @brief Symbol specifying TWIS instance to be used in nrfx_twim_twis examples. */
#define TWIS_INST_IDX 1

/** @brief Symbol specifying pin number of master SCL to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_MASTER_SCL_PIN LOOPBACK_PIN_1A
/** @brief Symbol specifying pin number of slave SCL to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_SLAVE_SCL_PIN LOOPBACK_PIN_1B
/** @brief Symbol specifying pin number of master SDA to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_MASTER_SDA_PIN LOOPBACK_PIN_2A
/** @brief Symbol specifying pin number of slave SDA to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_SLAVE_SDA_PIN LOOPBACK_PIN_2B

/* NRFX_UARTE */
/** @brief Symbol specifying UARTE instance to be used in nrfx_uarte examples. */
#define UARTE_INST_IDX 1

/** @brief Symbol specifying TX pin number of UARTE to be used in nrfx_uarte examples. */
#define UARTE_TX_PIN LOOPBACK_PIN_1A
/** @brief Symbol specifying RX pin number of UARTE to be used in nrfx_uarte examples. */
#define UARTE_RX_PIN LOOPBACK_PIN_1B

#endif // NRF52833DK_NRF52833_CONFIG_H__
143 changes: 143 additions & 0 deletions nrfx/samples/common/boards/nrf52840dk_nrf52840_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#ifndef NRF52840DK_NRF52840_CONFIG_H__
#define NRF52840DK_NRF52840_CONFIG_H__

#define LOOPBACK_PIN_1A 3
#define LOOPBACK_PIN_1B 31
#define LOOPBACK_PIN_2A 4
#define LOOPBACK_PIN_2B 30
#define LOOPBACK_PIN_3A 28
#define LOOPBACK_PIN_3B 29
#define LOOPBACK_PIN_4A 26
#define LOOPBACK_PIN_4B 27

#define LED1_PIN 13
#define LED2_PIN 14
#define LED3_PIN 15
#define LED4_PIN 16

/** @brief Symbol specifying analog input associated with analog pin A0 on the Development Kit. */
#define ANALOG_INPUT_A0 1
/** @brief Symbol specifying analog input associated with analog pin A1 on the Development Kit. */
#define ANALOG_INPUT_A1 2
/** @brief Symbol specifying analog input associated with analog pin A2 on the Development Kit. */
#define ANALOG_INPUT_A2 4

/* EXAMPLE-SPECIFIC DEFINES: */

/* NRFX_EGU */
/** @brief Symbol specifying EGU instance to be used in the nrfx_egu example. */
#define EGU_INST_IDX 0

/* NRFX_GPPI */
/** @brief Symbol specifying TIMER instance to be used in the nrfx_gppi examples. */
#define GPPI_TIMER_INST_IDX 0

/** @brief Symbol specifying GPIOTE instance to be used in the nrfx_gppi examples. */
#define GPPI_GPIOTE_INST_IDX 0

/** @brief Symbol specifying output pin associated with primary task in the nrfx_gppi examples. */
#define GPPI_OUTPUT_PIN_PRIMARY LED1_PIN

/** @brief Symbol specifying output pin associated with fork task in the nrfx_gppi examples. */
#define GPPI_OUTPUT_PIN_FORK LED2_PIN

/* NRFX_PWM */
/** @brief Symbol specifying PWM instance to be used in the nrfx_pwm examples. */
#define PWM_INST_IDX 0

/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED1_PIN LED1_PIN
/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED2_PIN LED2_PIN
/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED3_PIN LED3_PIN
/** @brief Symbol specifying a pin connected to LED to be used in the nrfx_pwm examples. */
#define PWM_LED4_PIN LED4_PIN

/* NRFX_SAADC */
/** @brief Symbol specifying GPIOTE instance to be used in the nrfx_saadc examples. */
#define SAADC_GPIOTE_INST_IDX 0

/** @brief Symbol specifying timer instance to be used in the nrfx_saadc examples. */
#define SAADC_TIMER_INST_IDX 0
/**
* @brief Symbol specifying the maximum number of SAADC channels that can be used in the
* nrfx_saadc examples.
*/
#define SAADC_MAX_CHANNELS 3

/** @brief Symbol specifying analog input to be observed by SAADC channel 0 in the nrfx_saadc examples. */
#define SAADC_CH0_AIN ANALOG_INPUT_TO_SAADC_AIN(ANALOG_INPUT_A0)
/** @brief Symbol specifying analog input to be observed by SAADC channel 1 in the nrfx_saadc examples. */
#define SAADC_CH1_AIN ANALOG_INPUT_TO_SAADC_AIN(ANALOG_INPUT_A1)
/** @brief Symbol specifying analog input to be observed by SAADC channel 2 in the nrfx_saadc examples. */
#define SAADC_CH2_AIN ANALOG_INPUT_TO_SAADC_AIN(ANALOG_INPUT_A2)

/** @brief Symbol specifying GPIO pin connected to SAADC channel 0 in the nrfx_saadc examples. */
#define SAADC_CH0_LOOPBACK_PIN LOOPBACK_PIN_1B
/** @brief Symbol specifying GPIO pin connected to SAADC channel 1 in the nrfx_saadc examples. */
#define SAADC_CH1_LOOPBACK_PIN LOOPBACK_PIN_2B
/** @brief Symbol specifying GPIO pin connected to SAADC channel 2 in the nrfx_saadc examples. */
#define SAADC_CH2_LOOPBACK_PIN LOOPBACK_PIN_3B

/* NRFX_SPIM */
/** @brief Symbol specifying SPIM instance to be used in nrfx_spim examples. */
#define SPIM_INST_IDX 1

/* NRFX_SPIM_SPIS */
/** @brief Symbol specifying SPIM instance to be used in nrfx_spim_spis examples. */
#define SPIM_SPIS_SPIM_INST_IDX 1
/** @brief Symbol specifying SPIS instance to be used in nrfx_spim_spis examples. */
#define SPIM_SPIS_SPIS_INST_IDX 2

/** @brief Symbol specifying master's pin number for MOSI in nrfx_spim_spis examples. */
#define SPIM_SPIS_MOSI_PIN_MASTER LOOPBACK_PIN_1A
/** @brief Symbol specifying slave's pin number for MOSI in nrfx_spim_spis examples. */
#define SPIM_SPIS_MOSI_PIN_SLAVE LOOPBACK_PIN_1B
/** @brief Symbol specifying master's pin number for MISO in nrfx_spim_spis examples. */
#define SPIM_SPIS_MISO_PIN_MASTER LOOPBACK_PIN_2A
/** @brief Symbol specifying slave's pin number for MISO in nrfx_spim_spis examples. */
#define SPIM_SPIS_MISO_PIN_SLAVE LOOPBACK_PIN_2B
/** @brief Symbol specifying master's pin number for SCK in nrfx_spim_spis examples. */
#define SPIM_SPIS_SCK_PIN_MASTER LOOPBACK_PIN_3A
/** @brief Symbol specifying slave's pin number for SCK in nrfx_spim_spis examples. */
#define SPIM_SPIS_SCK_PIN_SLAVE LOOPBACK_PIN_3B
/** @brief Symbol specifying master's pin number for SS in nrfx_spim_spis examples. */
#define SPIM_SPIS_SS_PIN_MASTER LOOPBACK_PIN_4A
/** @brief Symbol specifying slave's pin number for CSN in nrfx_spim_spis examples. */
#define SPIM_SPIS_CSN_PIN_SLAVE LOOPBACK_PIN_4B

/* NRFX_TIMER */
/** @brief Symbol specifying timer instance to be used in nrfx_timer/timer example. */
#define TIMER_INST_IDX 0

/** @brief Symbol specifying timer instance to be used in timer mode (T) in nrfx_timer/counter example. */
#define TIMER_T_INST_IDX 0
/** @brief Symbol specifying timer instance to be used in counter mode (C) in nrfx_timer/counter example. */
#define TIMER_C_INST_IDX 1

/* NRFX_TWIM_TWIS */
/** @brief Symbol specifying TWIM instance to be used in nrfx_twim_twis examples. */
#define TWIM_INST_IDX 0
/** @brief Symbol specifying TWIS instance to be used in nrfx_twim_twis examples. */
#define TWIS_INST_IDX 1

/** @brief Symbol specifying pin number of master SCL to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_MASTER_SCL_PIN LOOPBACK_PIN_1A
/** @brief Symbol specifying pin number of slave SCL to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_SLAVE_SCL_PIN LOOPBACK_PIN_1B
/** @brief Symbol specifying pin number of master SDA to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_MASTER_SDA_PIN LOOPBACK_PIN_2A
/** @brief Symbol specifying pin number of slave SDA to be used in nrfx_twim_twis examples. */
#define TWIM_TWIS_SLAVE_SDA_PIN LOOPBACK_PIN_2B

/* NRFX_UARTE */
/** @brief Symbol specifying UARTE instance to be used in nrfx_uarte examples. */
#define UARTE_INST_IDX 1

/** @brief Symbol specifying TX pin number of UARTE to be used in nrfx_uarte examples. */
#define UARTE_TX_PIN LOOPBACK_PIN_1A
/** @brief Symbol specifying RX pin number of UARTE to be used in nrfx_uarte examples. */
#define UARTE_RX_PIN LOOPBACK_PIN_1B

#endif // NRF52840DK_NRF52840_CONFIG_H__
Loading