Skip to content

Commit 7f9baee

Browse files
committed
Revert "tests: drivers: spi: Add test case for MLTPAN-55 workaround"
This reverts commit aec0909. Signed-off-by: Marcin Szymczyk <[email protected]>
1 parent 35a943f commit 7f9baee

File tree

7 files changed

+11
-118
lines changed

7 files changed

+11
-118
lines changed

tests/drivers/spi/spim_pan/boards/nrf54h20dk_nrf54h20_cpuapp.overlay

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,10 @@ dut_spi: &spi130 {
4141
dut_spi_dt: test-spi-dev@0 {
4242
compatible = "vnd,spi-device";
4343
reg = <0>;
44-
spi-max-frequency = <DT_FREQ_M(4)>;
44+
spi-max-frequency = <DT_FREQ_M(1)>;
4545
};
4646
};
4747

4848
&exmif {
4949
status = "disabled";
5050
};
51-
52-
tst_timer: &timer131 {
53-
status = "okay";
54-
};
55-
56-
&dppic133 {
57-
owned-channels = <1>;
58-
sink-channels = <1>;
59-
status = "okay";
60-
};

tests/drivers/spi/spim_pan/boards/nrf54l15dk_nrf54l15_cpuapp.overlay

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ dut_spi: &spi21 {
4040
dut_spi_dt: test-spi-dev@0 {
4141
compatible = "vnd,spi-device";
4242
reg = <0>;
43-
spi-max-frequency = <DT_FREQ_M(4)>;
43+
spi-max-frequency = <DT_FREQ_M(1)>;
4444
};
4545
};
4646

4747
&gpio1 {
4848
status = "okay";
4949
};
50-
51-
tst_timer: &timer20 {
52-
status = "okay";
53-
};
54-
55-
&dppic20 {
56-
status = "okay";
57-
};

tests/drivers/spi/spim_pan/boards/nrf54lm20dk_nrf54lm20a_cpuapp.overlay

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ dut_spi: &spi21 {
4040
dut_spi_dt: test-spi-dev@0 {
4141
compatible = "vnd,spi-device";
4242
reg = <0>;
43-
spi-max-frequency = <DT_FREQ_M(4)>;
43+
spi-max-frequency = <DT_FREQ_M(1)>;
4444
};
4545
};
4646

4747
&gpio1 {
4848
status = "okay";
4949
};
50-
51-
tst_timer: &timer20 {
52-
status = "okay";
53-
};
54-
55-
&dppic20 {
56-
status = "okay";
57-
};

tests/drivers/spi/spim_pan/boards/nrf54ls05dk_nrf54ls05b_cpuapp.overlay

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ dut_spi: &spi21 {
4040
dut_spi_dt: test-spi-dev@0 {
4141
compatible = "vnd,spi-device";
4242
reg = <0>;
43-
spi-max-frequency = <DT_FREQ_M(4)>;
43+
spi-max-frequency = <DT_FREQ_M(1)>;
4444
};
4545
};
4646

4747
&gpio1 {
4848
status = "okay";
4949
};
50-
51-
tst_timer: &timer20 {
52-
status = "okay";
53-
};
54-
55-
&dppic20 {
56-
status = "okay";
57-
};

tests/drivers/spi/spim_pan/boards/nrf54lv10dk_nrf54lv10a_cpuapp.overlay

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,10 @@ dut_spi: &spi21 {
4040
dut_spi_dt: test-spi-dev@0 {
4141
compatible = "vnd,spi-device";
4242
reg = <0>;
43-
spi-max-frequency = <DT_FREQ_M(4)>;
43+
spi-max-frequency = <DT_FREQ_M(1)>;
4444
};
4545
};
4646

4747
&gpio1 {
4848
status = "okay";
4949
};
50-
51-
tst_timer: &timer20 {
52-
status = "okay";
53-
};
54-
55-
&dppic20 {
56-
status = "okay";
57-
};
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
CONFIG_SPI=y
22

3-
CONFIG_NRFX_GPPI=y
4-
53
CONFIG_ZTEST=y

tests/drivers/spi/spim_pan/src/main.c

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,14 @@
88
#include <zephyr/ztest.h>
99
#include <zephyr/drivers/spi.h>
1010
#include <nrfx_spim.h>
11-
#include <nrfx_timer.h>
1211
#include <zephyr/linker/devicetree_regions.h>
1312

14-
#include <zephyr/drivers/counter.h>
15-
#include <helpers/nrfx_gppi.h>
16-
17-
/* SPI MODE 0 */
1813
#define SPI_MODE (SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | SPI_LINES_SINGLE | SPI_TRANSFER_MSB)
19-
#define TEST_BUFFER_SIZE 64
14+
15+
#define TEST_BUFFER_SIZE 8
2016

2117
static struct spi_dt_spec spim_spec = SPI_DT_SPEC_GET(DT_NODELABEL(dut_spi_dt), SPI_MODE, 0);
2218
NRF_SPIM_Type *spim_reg = (NRF_SPIM_Type *)DT_REG_ADDR(DT_NODELABEL(dut_spi));
23-
NRF_TIMER_Type *timer_reg = (NRF_TIMER_Type *)DT_REG_ADDR(DT_NODELABEL(tst_timer));
2419

2520
#define MEMORY_SECTION(node) \
2621
COND_CODE_1(DT_NODE_HAS_PROP(node, memory_regions), \
@@ -44,27 +39,15 @@ static void set_buffers(void)
4439
memset(rx_buffer, 0xFF, TEST_BUFFER_SIZE);
4540
}
4641

47-
static uint32_t configure_test_timer(NRF_TIMER_Type *preg)
48-
{
49-
const nrfy_timer_config_t test_timer_config = {.prescaler = 1,
50-
.mode = NRF_TIMER_MODE_COUNTER,
51-
.bit_width = NRF_TIMER_BIT_WIDTH_16};
52-
53-
nrfy_timer_periph_configure(preg, &test_timer_config);
54-
nrfy_timer_task_trigger(preg, NRF_TIMER_TASK_START);
55-
56-
return nrfy_timer_task_address_get(preg, NRF_TIMER_TASK_COUNT);
57-
}
58-
5942
/*
6043
* Reference: MLTPAN-8
6144
* Requirements to trigger the PAN workaround
6245
* CPHA = 0 (configured in SPI_MODE)
63-
* PRESCALER > 2 (4 for 4MHz)
46+
* PRESCALER > 2 (16 for 1MHz)
6447
* First transmitted bit is 1 (0x8B, MSB)
6548
*/
6649

67-
ZTEST(spim_pan, test_spim_mltpan_8_workaround)
50+
ZTEST(spim_pan, test_spim_pan_workaround)
6851
{
6952
int err;
7053

@@ -76,59 +59,13 @@ ZTEST(spim_pan, test_spim_mltpan_8_workaround)
7659

7760
set_buffers();
7861

79-
err = spi_transceive_dt(&spim_spec, &tx_spi_buf_set, &rx_spi_buf_set);
8062
TC_PRINT("SPIM prescaler: %u\n", spim_reg->PRESCALER);
8163
zassert_true(spim_reg->PRESCALER > 2, "SPIM prescaler is not greater than 2\n");
82-
zassert_ok(err, "SPI transceive failed: %d\n", err);
8364

84-
zassert_mem_equal(tx_buffer, rx_buffer, TEST_BUFFER_SIZE, "TX buffer != RX buffer\n");
85-
}
86-
87-
/*
88-
* Reference: MLTPAN-55
89-
* Requirements to trigger the PAN workaround
90-
* MODE 0 or MODE 2 (CPHA = 0)
91-
* PRESCALER = 4 (4 MHz) for SPIM2x and SPIM3x
92-
* RX.MAXCNT lower than TX.MAXCNT
93-
*/
94-
95-
ZTEST(spim_pan, test_spim_mltpan_55_workaround)
96-
{
97-
int err;
98-
uint8_t ppi_channel;
99-
uint32_t timer_cc_before, timer_cc_after;
100-
101-
uint32_t timer_task;
102-
uint32_t spim_event;
103-
104-
struct spi_buf tx_spi_buf = {.buf = tx_buffer, .len = TEST_BUFFER_SIZE};
105-
struct spi_buf_set tx_spi_buf_set = {.buffers = &tx_spi_buf, .count = 1};
106-
107-
struct spi_buf rx_spi_buf = {.buf = rx_buffer, .len = TEST_BUFFER_SIZE - 1};
108-
struct spi_buf_set rx_spi_buf_set = {.buffers = &rx_spi_buf, .count = 1};
109-
110-
set_buffers();
111-
112-
err = nrfx_gppi_channel_alloc(&ppi_channel);
113-
zassert_equal(nrfx_gppi_channel_alloc(&ppi_channel), NRFX_SUCCESS,
114-
"Failed to allocate GPPI channel");
115-
116-
timer_task = configure_test_timer(timer_reg);
117-
spim_event = nrf_spim_event_address_get(spim_reg, NRF_SPIM_EVENT_END);
118-
119-
nrfx_gppi_channel_endpoints_setup(ppi_channel, spim_event, timer_task);
120-
nrfx_gppi_channels_enable(BIT(ppi_channel));
121-
122-
timer_cc_before = nrfy_timer_capture_get(timer_reg, NRF_TIMER_CC_CHANNEL0);
12365
err = spi_transceive_dt(&spim_spec, &tx_spi_buf_set, &rx_spi_buf_set);
124-
timer_cc_after = nrfy_timer_capture_get(timer_reg, NRF_TIMER_CC_CHANNEL0);
125-
126-
TC_PRINT("Timer count before: %u, timer count after: %u\n", timer_cc_before,
127-
timer_cc_after);
66+
zassert_ok(err, "SPI transceive failed: %d\n", err);
12867

129-
zassert_true((timer_cc_after - timer_cc_before) > 0,
130-
"NRF_SPIM_EVENT_END did not trigger\n");
131-
zassert_mem_equal(tx_buffer, rx_buffer, TEST_BUFFER_SIZE - 1, "TX buffer != RX buffer\n");
68+
zassert_mem_equal(tx_buffer, rx_buffer, TEST_BUFFER_SIZE, "TX buffer != RX buffer\n");
13269
}
13370

13471
ZTEST_SUITE(spim_pan, NULL, test_setup, NULL, NULL, NULL);

0 commit comments

Comments
 (0)