Skip to content

Commit 1099823

Browse files
committed
[nrf fromlist] tests: boards: nrf: gppi: Add pdm0 node as test sink
Test is using one of the peripherals as sink for PPI events. So far it supported LPCOMP or ECB on nrf54h20 cpurad. Some SoCs don't have LPCOMP and another peripheral need to be used. Extended test to use PDM in that case. nrf54h20 cpuapp configuration is changed to use PDM instead of LPCOMP. Upstream PR #: 107582 Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
1 parent 733b865 commit 1099823

2 files changed

Lines changed: 34 additions & 5 deletions

File tree

tests/boards/nrf/gppi/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ dut_timer2: &timer134 {
1616
status = "reserved";
1717
};
1818

19-
&comp {
19+
&pdm0 {
2020
status = "reserved";
2121
};

tests/boards/nrf/gppi/src/main.c

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,46 @@
1010
#include <zephyr/ztest.h>
1111
#include <hal/nrf_timer.h>
1212
#include <hal/nrf_egu.h>
13-
#if defined(CONFIG_SOC_NRF54H20_CPURAD)
13+
#include <helpers/nrfx_gppi.h>
14+
#if DT_NODE_EXISTS(DT_NODELABEL(pdm0)) && DT_NODE_HAS_STATUS(DT_NODELABEL(pdm0), reserved)
15+
#include <hal/nrf_pdm.h>
16+
#elif DT_NODE_EXISTS(DT_NODELABEL(comp)) && DT_NODE_HAS_STATUS(DT_NODELABEL(comp), reserved)
17+
#include <hal/nrf_lpcomp.h>
18+
#elif defined(CONFIG_SOC_NRF54H20_CPURAD)
1419
#include <hal/nrf_ecb.h>
1520
#endif
16-
#include <hal/nrf_lpcomp.h>
17-
#include <helpers/nrfx_gppi.h>
1821

1922
NRF_TIMER_Type *timer0 = (NRF_TIMER_Type *)DT_REG_ADDR(DT_NODELABEL(dut_timer0));
2023
NRF_TIMER_Type *timer1 = (NRF_TIMER_Type *)DT_REG_ADDR(DT_NODELABEL(dut_timer1));
2124
NRF_TIMER_Type *timer2 = (NRF_TIMER_Type *)DT_REG_ADDR(DT_NODELABEL(dut_timer2));
2225

23-
#if DT_NODE_EXISTS(DT_NODELABEL(comp)) && DT_NODE_HAS_STATUS(DT_NODELABEL(comp), reserved)
26+
#if DT_NODE_EXISTS(DT_NODELABEL(pdm0)) && DT_NODE_HAS_STATUS(DT_NODELABEL(pdm0), reserved)
27+
NRF_PDM_Type *pdm = (NRF_PDM_Type *)DT_REG_ADDR(DT_NODELABEL(pdm0));
28+
29+
static void sink_setup(void)
30+
{
31+
nrf_pdm_task_trigger(pdm, NRF_PDM_TASK_STOP);
32+
nrf_pdm_event_clear(pdm, NRF_PDM_EVENT_STARTED);
33+
nrf_pdm_enable(pdm);
34+
}
35+
36+
static void sink_cleanup(void)
37+
{
38+
nrf_pdm_task_trigger(pdm, NRF_PDM_TASK_STOP);
39+
nrf_pdm_disable(pdm);
40+
}
41+
42+
static bool sink_evt_check(void)
43+
{
44+
return nrf_pdm_event_check(pdm, NRF_PDM_EVENT_STARTED);
45+
}
46+
47+
static uint32_t sink_tsk_addr(void)
48+
{
49+
return nrf_pdm_task_address_get(pdm, NRF_PDM_TASK_START);
50+
}
51+
52+
#elif DT_NODE_EXISTS(DT_NODELABEL(comp)) && DT_NODE_HAS_STATUS(DT_NODELABEL(comp), reserved)
2453
NRF_LPCOMP_Type *lpcomp = (NRF_LPCOMP_Type *)DT_REG_ADDR(DT_NODELABEL(comp));
2554

2655
static void sink_setup(void)

0 commit comments

Comments
 (0)