Skip to content

Commit

Permalink
tests: benchmarks: Add stress test for drivers
Browse files Browse the repository at this point in the history
Create test that will concurrently use drivers for multiple
peripherals, such as:
- UART (LOG system),
- SPI (adxl362 accelerometer),
- I2C (bme680 sensor),
- ADC,
- PWM (LED dimming),
- GPIO (LED toggle),
- timer (kernel),
- counter (timer instance),
- CAN (only on nrf54h20, internal loopback mode),
- temperature sensor (DIE_TEMP),
- flash (external NOR Flash memory; read only),
- I2S (only on nrf54l, send in air, read from air),
- watchdog,
- plus cpu load thread.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
  • Loading branch information
nordic-segl authored and rlubos committed Sep 27, 2024
1 parent 84492d6 commit 6809a6f
Show file tree
Hide file tree
Showing 24 changed files with 1,713 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/test-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@
- "snippets/emulated-*/**/*"
- "tests/subsys/event_manager_proxy/**/*"
- "tests/benchmarks/multicore/**/*"
- "tests/benchmarks/peripheral_load/**/*"
- "tests/drivers/pwm/**/*"
- "tests/drivers/sensor/**/*"

Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@
/tests/benchmarks/multicore/idle_gpio/ @adamkondraciuk @nrfconnect/ncs-low-level-test
/tests/benchmarks/i2c_endless/ @nrfconnect/ncs-low-level-test
/tests/benchmarks/spi_endless/ @nrfconnect/ncs-low-level-test
/tests/benchmarks/peripheral_load/ @nrfconnect/ncs-low-level-test
/tests/bluetooth/tester/ @carlescufi @nrfconnect/ncs-paladin
/tests/bluetooth/iso/ @nrfconnect/ncs-audio @Frodevan
/tests/crypto/ @stephen-nordic @magnev
Expand Down
19 changes: 19 additions & 0 deletions scripts/ci/tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,25 @@ ci_tests_benchmarks_i2c_endless:
- nrf/tests/benchmarks/i2c_endless/
- zephyr/drivers/i2c/

ci_tests_benchmarks_peripheral_load:
files:
- modules/hal/nordic/nrfx/
- nrf/tests/benchmarks/peripheral_load/
- zephyr/drivers/sensor/adi/adxl362
- zephyr/drivers/sensor/bosch/bme680
- zephyr/drivers/sensor/nordic/temp/
- zephyr/drivers/adc/
- zephyr/drivers/can/
- zephyr/drivers/counter/
- zephyr/drivers/flash/
- zephyr/drivers/gpio/
- zephyr/drivers/i2c/
- zephyr/drivers/i2s/
- zephyr/drivers/pwm/
- zephyr/drivers/spi/
- zephyr/drivers/watchdog/
- zephyr/soc/nordic/

ci_tests_benchmarks_spi_endless:
files:
- modules/hal/nordic/nrfx/
Expand Down
12 changes: 12 additions & 0 deletions tests/benchmarks/peripheral_load/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2024 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(periph_stress)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_NRFS=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
aliases {
test-counter = &timer137;
watchdog0 = &wdt010;
};

zephyr,user {
io-channels = <&adc 0>, <&adc 1>;
};
};

&adc {
#address-cells = <1>;
#size-cells = <0>;

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_2";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10)>;
zephyr,input-positive = <NRF_SAADC_AIN4>;
zephyr,resolution = <10>;
};

channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_2";
zephyr,reference = "ADC_REF_EXTERNAL0";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10)>;
zephyr,input-positive = <NRF_SAADC_AIN5>;
zephyr,resolution = <10>;
};
};

&mx25uw63 {
status = "okay";
};

&timer137 {
status = "okay";
prescaler = <4>;
};

temp_sensor: &temp_nrfs {
status = "okay";
};

&wdt010 {
status = "okay";
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Rev. 0.8.1:
* P0.00 - TX_0
* P0.01 - RX_0
* P0.02 - RTS_0
* P0.03 - CTS_0
* P0.04 - Button_3
*
* P1.00 - 32k_XTAL1
* P1.01 - 32k_XTAL2
* P1.02 - NFC_1
* P1.03 - NFC_2
* P1.04 - TX_1
* P1.05 - RX_1
* P1.06 - RTS_1
* P1.07 - CTS_1
* P1.08 - Button_1 / I2S_SDOUT
* P1.09 - Button_2 / I2S_SDIN
* P1.10 - LED_1 / I2S_LRCK_M
* P1.11 - TWIM_SCL to BME680 + ADC_ch0
* P1.12 - TWIM_SDA to BME680 + ADC_ch1
* P1.13 - Button_4 / CS_BME680
* P1.14 - LED_3 / IRQ / I2S_SCK_M
*
* P2.00 - QSPI
* P2.01 - QSPI
* P2.02 - QSPI
* P2.03 - QSPI
* P2.04 - QSPI
* P2.05 - QSPI
* P2.06 - SPIM_SCK
* P2.07 - LED_2
* P2.08 - SPIM_MOSI to ADXL362
* P2.09 - LED_0 / SPIM_MISO to ADXL362
* P2.10 - CS_ADXL362
*/

/ {
aliases {
i2s-node0 = &i2s20;
test-counter = &timer24;
};

zephyr,user {
io-channels = <&adc 0>, <&adc 1>;
};
};

&pinctrl {
i2s20_default_alt: i2s20_default_alt {
group1 {
psels = <NRF_PSEL(I2S_SCK_M, 1, 14)>,
<NRF_PSEL(I2S_LRCK_M, 1, 10)>,
<NRF_PSEL(I2S_SDOUT, 1, 8)>,
<NRF_PSEL(I2S_SDIN, 1, 9)>;
};
};
};

&adc {
#address-cells = <1>;
#size-cells = <0>;

channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10)>;
zephyr,input-positive = <NRF_SAADC_AIN4>; /* P1.11 - I2C SCL on sensor shield */
zephyr,resolution = <10>;
};

channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1_4";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN5>; /* P1.12 - I2C SDA on sensor shield */
zephyr,resolution = <12>;
};
};

&i2s20 {
status = "okay";
pinctrl-0 = <&i2s20_default_alt>;
pinctrl-names = "default";
};

&timer24 {
status = "okay";
prescaler = <4>;
};

temp_sensor: &temp {
status = "okay";
};

&wdt31 {
status = "okay";
};
11 changes: 11 additions & 0 deletions tests/benchmarks/peripheral_load/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CONFIG_LOG=y

CONFIG_SENSOR=y
CONFIG_ADC=y
CONFIG_CAN=y
CONFIG_COUNTER=y
CONFIG_FLASH=y
CONFIG_GPIO=y
CONFIG_I2S=y
CONFIG_PWM=y
CONFIG_WATCHDOG=y
112 changes: 112 additions & 0 deletions tests/benchmarks/peripheral_load/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
sample:
name: Peripheral stress test

common:
depends_on: adc gpio i2c pwm spi watchdog
tags: drivers spi sensors ci_tests_benchmarks_peripheral_load
harness: console

tests:
sample.benchmarks.peripheral_stress_test.nrf54h:
filter: not CONFIG_COVERAGE
harness_config:
fixture: pca63566
type: multi_line
ordered: false
regex:
- ".*Accelerometer thread has completed"
- ".*ADC thread has completed"
- ".*BME680 thread has completed"
- ".*CAN thread has completed"
- ".*Counter thread has completed"
- ".*Flash thread has completed"
- ".*GPIO thread has completed"
- ".*PWM thread has completed"
- ".*TEMP thread has completed"
- ".*Timer thread has completed"
- ".*WDT thread has completed"
- ".*CPU load thread has completed"
- ".*all \\d{1,} threads have completed"
extra_args:
- SHIELD=pca63566
platform_allow: nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp

sample.benchmarks.peripheral_stress_test.nrf54h_coverage:
filter: CONFIG_COVERAGE
harness_config:
fixture: pca63566
type: multi_line
ordered: false
regex:
- ".*Accelerometer thread has completed"
- ".*ADC thread has completed"
- ".*BME680 thread has completed"
- ".*CAN thread has completed"
- ".*Counter thread has completed"
- ".*Flash thread has completed"
- ".*GPIO thread has completed"
- ".*PWM thread has completed"
- ".*TEMP thread has completed"
- ".*Timer thread has completed"
- ".*WDT thread has completed"
- ".*CPU load thread has completed"
- ".*all \\d{1,} threads have completed"
extra_args:
- SHIELD=pca63566;coverage_support
platform_allow: nrf54h20dk/nrf54h20/cpuapp
integration_platforms:
- nrf54h20dk/nrf54h20/cpuapp

sample.benchmarks.peripheral_stress_test.nrf54l:
filter: not CONFIG_COVERAGE
harness_config:
fixture: pca63565
type: multi_line
ordered: false
regex:
- ".*Accelerometer thread has completed"
- ".*ADC thread has completed"
- ".*BME680 thread has completed"
- ".*Counter thread has completed"
- ".*Flash thread has completed"
- ".*GPIO thread has completed"
- ".*I2S thread has completed"
- ".*PWM thread has completed"
- ".*TEMP thread has completed"
- ".*Timer thread has completed"
- ".*WDT thread has completed"
- ".*CPU load thread has completed"
- ".*all \\d{1,} threads have completed"
extra_args:
- SHIELD=pca63565
platform_allow: nrf54l15dk/nrf54l15/cpuapp
integration_platforms:
- nrf54l15dk/nrf54l15/cpuapp

sample.benchmarks.peripheral_stress_test.nrf54l_coverage:
filter: CONFIG_COVERAGE
harness_config:
fixture: pca63565
type: multi_line
ordered: false
regex:
- ".*Accelerometer thread has completed"
- ".*ADC thread has completed"
- ".*BME680 thread has completed"
- ".*Counter thread has completed"
- ".*Flash thread has completed"
- ".*GPIO thread has completed"
- ".*I2S thread has completed"
- ".*PWM thread has completed"
- ".*TEMP thread has completed"
- ".*Timer thread has completed"
- ".*WDT thread has completed"
- ".*CPU load thread has completed"
- ".*all \\d{1,} threads have completed"
extra_args:
- SHIELD=pca63565;coverage_support
platform_allow: nrf54l15dk/nrf54l15/cpuapp
integration_platforms:
- nrf54l15dk/nrf54l15/cpuapp
Loading

0 comments on commit 6809a6f

Please sign in to comment.