-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: drivers: audio: Add tests for PDM
Added tests for PDM that check PDM_CLK output frequency and ensure that dmic API works as expected. Signed-off-by: Michał Stasiak <[email protected]>
- Loading branch information
1 parent
bb0ce75
commit 989cde8
Showing
8 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(pdm_loopback) | ||
|
||
target_sources(app PRIVATE src/main.c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
source "Kconfig.zephyr" | ||
|
||
config TEST_PDM_SAMPLING_RATE | ||
int "PDM sample rate in Hz" | ||
default 10000 | ||
help | ||
The test will use it to define frequency of PDM sampling and | ||
calculate the size of the buffer. | ||
|
||
config TEST_PDM_EXPECTED_FREQUENCY | ||
int "Expected PDM_CLK frequency in Hz" | ||
default 1000000 | ||
help | ||
The test will use it to confirm that the captured PDM_CLK | ||
frequency in correct. | ||
|
||
config TEST_PDM_SAMPLING_TIME | ||
int "PDM sampling time for one block in ms" | ||
default 100 | ||
help | ||
The test will use it to calculate the size of data block and | ||
determine the period of capturing timer. | ||
|
||
config TEST_USE_DMM | ||
bool "Use of DMM prealocation" | ||
default n | ||
help | ||
The test will use it to determine whether to prealocate DMM | ||
buffer or use regular mem slab and allocate dmm buffer inside | ||
PDM driver. |
56 changes: 56 additions & 0 deletions
56
tests/drivers/audio/pdm_loopback/boards/nrf54h20dk_nrf54h20_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
*/ | ||
|
||
/ { | ||
gpio_test { | ||
compatible = "gpio-leds"; | ||
pulse_counter: pulse_counter { | ||
gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; | ||
}; | ||
}; | ||
}; | ||
|
||
&pinctrl { | ||
pdm0_default_alt: pdm0_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(PDM_CLK, 1, 2)>, | ||
<NRF_PSEL(PDM_DIN, 1, 4)>; | ||
}; | ||
}; | ||
}; | ||
|
||
pdm_dev: &pdm0 { | ||
status = "okay"; | ||
pinctrl-0 = <&pdm0_default_alt>; | ||
pinctrl-names = "default"; | ||
clock-source = "PCLK32M"; | ||
memory-regions = <&cpuapp_dma_region>; | ||
}; | ||
|
||
&gpio1 { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiote130 { | ||
owned-channels = <0>; | ||
status = "okay"; | ||
}; | ||
|
||
&timer130 { | ||
status = "okay"; | ||
}; | ||
|
||
&dppic130 { | ||
owned-channels = <0>; | ||
source-channels = <0>; | ||
status = "okay"; | ||
}; | ||
|
||
&dppic133 { | ||
owned-channels = <0>; | ||
sink-channels = <0>; | ||
status = "okay"; | ||
}; |
38 changes: 38 additions & 0 deletions
38
tests/drivers/audio/pdm_loopback/boards/nrf54l15dk_nrf54l15_cpuapp.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
/ { | ||
gpio_test { | ||
compatible = "gpio-leds"; | ||
pulse_counter: pulse_counter { | ||
gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>; | ||
}; | ||
}; | ||
}; | ||
|
||
&pinctrl { | ||
pdm20_default_alt: pdm20_default_alt { | ||
group1 { | ||
psels = <NRF_PSEL(PDM_CLK, 1, 10)>, | ||
<NRF_PSEL(PDM_DIN, 1, 12)>; | ||
}; | ||
}; | ||
}; | ||
|
||
pdm_dev: &pdm20 { | ||
status = "okay"; | ||
pinctrl-0 = <&pdm20_default_alt>; | ||
pinctrl-names = "default"; | ||
clock-source = "PCLK32M"; | ||
}; | ||
|
||
&gpio1 { | ||
status = "okay"; | ||
}; | ||
|
||
&timer00 { | ||
status = "okay"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Copyright (c) 2024 Nordic Semiconductor ASA | ||
# | ||
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
# | ||
|
||
CONFIG_ZTEST=y | ||
CONFIG_TEST_USERSPACE=y | ||
|
||
CONFIG_AUDIO=y | ||
CONFIG_AUDIO_DMIC=y | ||
CONFIG_GPIO=y | ||
CONFIG_NRFX_GPPI=y |
Oops, something went wrong.