Commit Graph

427 Commits

Author SHA1 Message Date
Sai Santhosh Malae
d29fd6fcba tests: spi: siwx91x: board config file update
Update CONFIG_SPI_IDEAL_TRANSFER_DURATION_SCALING
value for testcase to pass for higher transfer speeds.

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-06-17 16:11:11 +02:00
Fabrice DJIATSA
746d60b0f8 tests: drivers: spi: remove useless files and testcases
- with the updates made to the spi_ll_stm32 driver,
we no longer need to configure the 16-bit frame/word size
in the DTS overlay file. The test_spi_word_size_16 testsuite
helps us verify the 16-bit frame mode supported on
the ST platform.

- remove testcases that use thoses files in testcase.yaml

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-06-16 14:03:05 -04:00
Fabrice DJIATSA
cc4e2f526a tests: drivers: spi: spi_loopback: handle rx/tx buffers nocache memory
Place transfer buffers in non-cacheable memory when
CONFIG_NOCACHE_MEMORY=y. This change ensures that DMA transfer
buffers are allocated in non-cacheable memory on platforms where
CONFIG_NOCACHE_MEMORY is enabled. This avoids potential cache
coherence issues that are not handled by the SPI driver.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-06-16 14:03:05 -04:00
Fabrice DJIATSA
5daad8f7c1 tests: drivers: spi_loopback: add latency tolerance for some boards
Set a convenient latency for each platform, since each platform
reacts differently to the driver.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-06-16 14:03:05 -04:00
Fabrice DJIATSA
c5f5fc1fa8 tests: drivers: spi: spi_loopback: enable nucleo_c071rb to run test again
Due to RAM overflow by 3200 bytes, decrease size of SPI_LARGE_BUFFER.

signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-06-16 14:03:05 -04:00
Piotr Krzyzanowski
c67db3fd36 tests: drivers: spi: spi_loopback: Add NULL spi_buf_set test
Add the test_spi_null_tx_rx_buf_set

Signed-off-by: Piotr Krzyzanowski <piotr.krzyzanowski@nordicsemi.no>
2025-06-16 08:29:56 +02:00
Bjarki Arge Andreasen
39233656b2 tests: spi: loopback: get spi controller before timed transfer
The test which measures and validates transfer times is using the
helper spi_loopback_transceive() to perform the transfer. This
helper internally gets the spi controller, which is useful for
most tests, but for this one, it means the time to get and put
the spi controller is included in the transfer time measurement.

This commit gets the spi controller before calling
spi_loopback_transceive() which results in only the actual
transfer time being measured.

Before this commit, on the nrf54h20:

  START - test_spi_complete_multiple_timed
  Transfer took 745 us vs theoretical minimum 108 us
  Latency measurement: 637 us
   PASS - test_spi_complete_multiple_timed in 0.008 seconds

  START - test_spi_complete_multiple_timed
  Transfer took 700 us vs theoretical minimum 54 us
  Latency measurement: 646 us

      Assertion failed at ...
  Very high latency
   FAIL - test_spi_complete_multiple_timed in 0.027 seconds

After this commit:

  START - test_spi_complete_multiple_timed
  Transfer took 250 us vs theoretical minimum 108 us
  Latency measurement: 142 us
   PASS - test_spi_complete_multiple_timed in 0.008 seconds

  START - test_spi_complete_multiple_timed
  Transfer took 204 us vs theoretical minimum 54 us
  Latency measurement: 150 us
   PASS - test_spi_complete_multiple_timed in 0.008 seconds

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-10 10:23:20 -04:00
Bjarki Arge Andreasen
5163b8c96a tests: spi: loopback: use CONFIG_ZTEST_STACK_SIZE for thread stacks
The spi_loopback test suite creates three internal threads. The
stack sizes for these threads is hardcoded to 512, which is to little
for some socs, namely the nrf54h20 cpuapp if pm device runtime is
enabled. Instead, determine the stack sizes the same way ztest
stack sizes are determined.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-10 10:23:20 -04:00
Duy Nguyen
9e5aa827bb tests: drivers: spi: Add configuration for SPI test on RX130
Add device tree overlay for spi test on RSKRX130 board

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2025-06-09 08:55:05 +02:00
Piotr Kosycarz
d7006195ac tests: drivers: spi: spi_loopback: configure spi latency expectation
Allow to customize scaling factor used to compare ideal spi transfer
and measured one.

Signed-off-by: Piotr Kosycarz <piotr.kosycarz@nordicsemi.no>
2025-06-06 20:11:32 +01:00
Raffael Rostagno
d8358b29a0 tests: drivers: spi_loopback: Fix NULL rx buff testcase
Fixes setup of TX buffer, which shouldn't be NULL in the RX NULL
tescase.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2025-06-04 08:46:05 +02:00
Khoa Nguyen
291860e193 tests: drivers: spi: Add support spi_controller_peripheral for RA
Add support test app support spi_controller_peripheral for Renesas
RA boards: ek_ra6m5, ek_ra6m4, ek_ra6m3, ek_ra6m2, ek_ra6m1,
ek_ra6e2, fpb_ra6e2, ek_ra4m1, ek_ra2a1

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-06-04 08:44:47 +02:00
Declan Snyder
481711e5a6 tests: spi_loopback: Fix fail handle of thread test
Right now the thread test case does not handle when the test fails, the
test will be aborted by ztest in one of the spawned threads, and cause
desynchronization which messes up the rest of the test. Fix by
synchronizing in the case of fails and return fail from main test thread
instead of the spawned ones.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-31 03:36:33 +02:00
Declan Snyder
c10c13b961 tests: spi_loopback: Handle overflow of print latency
The test that checks latency also prints a measurement of the latency
which is just a visual information for the test output. However, this
print uses a subtraction which can have an overflow in the case where
the kernel timer is behind, so just clamp to 0 in that case where there
is an overflow. This change does not affect the test pass/fail logic.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-31 03:36:33 +02:00
Bjarki Arge Andreasen
d265dadf1c tests: drivers: spi: spi_loopback: skip tests if invalid config
The spi_loopback_transceive() helper currently only prints a
message if a configuration is invalid, continuing the test
case as if it succeeded. This results in the test case using the
helper trying to validate the result from a spi transaction that
was skipped.

Fix this by explicitly skipping the test using the ztest
framework's ztest_test_skip() function, which skips the entire
test case.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-05-26 23:35:42 +02:00
Sebastian Głąb
691816d213 tests: drivers: spi: spi_loopback: Test fast spi on slow GPIO port
Add test configuration where fast SPI instance operates at slow
GPIO port 2.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-05-26 09:19:45 +02:00
Fabrice DJIATSA
23b3602aa1 tests: drivers: spi: spi_loopback: update gpdma1 request sel
According to wba55 refman RM0493, gpdma1 request for
spi1_rx_dma and spi1_tx_dma is 1 and 2.

solve failed test on drivers.spi.stm32_spi_dma.loopback
scenario.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-05-21 12:34:12 +02:00
Fabrice DJIATSA
3b88b3cd4c tests: drivers: spi: spi_loopback: update spi_loopback test
- add stm32u083c_dk board for spi_loopback driver test.
- update testcase yaml file for CI integration

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-05-21 12:33:43 +02:00
Sebastian Głąb
f47f3fe410 tests: drivers: spi: spi_loopback: Test fast instance at low frequency
Due to limited value of clock divider, fast SPI instance
can work only at higher bitrates.

Add check for error message when fast instance is
configured to work at low/unsupported bitrate.

Signed-off-by: Sebastian Głąb <sebastian.glab@nordicsemi.no>
2025-05-20 22:38:08 +02:00
Declan Snyder
74f3b7faa9 tests: spi_loopback: Add CS testing
Add test code to ensure CS is behaving properly in many different
scenarios.

Also add a test case for the SPI_HOLD_ON_CS flag in the API.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-20 22:37:35 +02:00
Declan Snyder
a6273993ee tests: spi_loopback: Add test case of multithread
Add test cases for multithread access with both same spec and different
specs to make sure nothing goes awry.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-20 22:37:35 +02:00
Declan Snyder
972dac1a73 tests: spi_loopback: Add timing testcase
Add testcase to ensure some aspects of the timing is correct.

If the transfer happens faster than it should, fail the test.
If the transfer takes way longer than it should, fail the test.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-20 22:37:35 +02:00
Declan Snyder
4b7ba78b40 tests: spi_loopback: Add test cases for clock modes
Turn the old spi_complete_loop case into 4 cases to test configuring
the different clock modes. The old case was kind of redundant with
everything else anyways so this is more useful to replace it with.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-20 22:37:35 +02:00
Declan Snyder
60d9a16040 tests: spi_loopback: Add different wordsize tests
Add tests for different data frame sizes,
as long as the controller can handle that word size.

Starting out with new tests of 7, 9, 16, 24, 32, 64.

The skipping behavior of ZTest is still not clear for me so for now just
return instead of using zassume or ztest skip if not supported.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-20 22:37:35 +02:00
Declan Snyder
ddb372e602 tests: spi_loopback: Add testcases for same bufs
A common usage of the SPI API by in tree consumers is to have one
underlying buffer used to both RX to and TX from. Add some test cases
ensuring this works properly:
- A case to ensure that RX writes back properly the same data that was
  TX from the buf.
- A case simulating a very common paradigm which is to use one
  underlying buf but declare the spi buf sets as though the first word
  is a command from TX and the rest are data for RX.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-05-20 22:37:35 +02:00
Bindu S
d33cd0ea69 tests: drivers: spi: spi_loopback: Enabled SPI in BTL-S
Added overlay and conf to enable SPI tests on BTL-S board.

Signed-off-by: Bindu S <bindu.s@intel.com>
2025-05-20 15:24:18 +02:00
Scott Worley
356827e4f4 tests: drivers: spi: loopback: Add Microchip MEC174x and MEC175x boards
Add Microchip MEC5 HAL based mec_assy6941 evaluation board to
the Zephyr SPI loopback driver test.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2025-05-16 21:36:50 +02:00
Peter Wang
2fc2c1dd2a boards: frdm_mcxa166, frdm_mcxa276: add spi support
1. enable spi support
2. verified tests/drivers/spi/spi_loopback

Signed-off-by: Peter Wang <chaoyi.wang@nxp.com>
2025-05-16 19:01:50 +02:00
Jérôme Pouiller
a1f48216bc soc: silabs: siwx91x: Rename pins
The reference manual and the schematics of the reference designs
numbers the pins from 0 to 57. So let's also apply this scheme to the
pinctrl.

Note while PIN are numbered between 0 and 64, the GPIOs are represented
with 4 block of 16 GPIOs. This is the way the GPIOs are documented in
the reference manual, so we don't change that (In addition,
gpio_port_pins_t is a uint32_t, so it won't be possible to represent 64
GPIOs in one gpio_port_pins_t anyway).

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-05-15 09:00:39 +02:00
Quang Le
66eb8a8c1d tests: drivers: spi: Add support for RZ/G3S-SMARC
Enable SPI driver tests for RZ/G3S-SMARC

Signed-off-by: Quang Le <quang.le.eb@bp.renesas.com>
Signed-off-by: Binh Nguyen <binh.nguyen.xw@renesas.com>
2025-05-15 09:00:31 +02:00
Bjarki Arge Andreasen
726fd18e88 tests: drivers: spi: spi_loopback: nrf54h20 cpuapp: add cs gpio
Add CS GPIO to nrf54h20dk/nrf54h20/cpuapp which is connected to
PORT which is in the "fast domain". The fast domain needs to be
resumed from thread context given it requires IPC communication.

This thus ensures that GPIO can be used with and without
PM_DEVICE_RUNTIME enabled.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-05-14 15:19:22 +02:00
Bjarki Arge Andreasen
1cda0eeba0 tests: drivers: spi: spi_loopback: impl pm_device_runtime support
Implement pm_device_runtime support to spi_loopback test suite.

Specifically:
- call pm_device_runtime_get() on SPI bus before using SPI bus
- call pm_device_runtime_put() once SPI bus is no longer needed.
  This is after transceive has been performed, or after calling
  spi_release_dt() after a transceive has been performed.

This addition has no affect if PM_DEVICE_RUNTIME is not enabled
on a board/test case basis.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-05-14 15:19:22 +02:00
Furkan Akkiz
13a36718fa tests: drivers: Enable new test for MAX32650 boards
This commit enables following tests for MAX32650EVKIT and MAX32650FTHR:
- counter/counter_basic_api
- dma/chan_blen_transfer
- dma/loop_transfer
- i2c/i2c_target_api (only for MAX32650EVKIT)
- spi/spi_loopback

Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
Signed-off-by: Burak Babaoglu <burak.babaoglu@analog.com>
2025-05-14 11:03:22 +01:00
Neil Chen
aa1f9e2d34 tests: drivers: spi: add spi test support for frdm_mcxa153 board
add spi test support for frdm_mcxa153 board.
reduce isr stack size to avoid ram overflow.

Signed-off-by: Neil Chen <cheng.chen_1@nxp.com>
2025-05-09 12:51:20 +02:00
Fabrice DJIATSA
b5090e220a tests: drivers: spi: spi_loopback: update spi_loopback test
add nucleo_wba55cg board for spi_loopback driver test.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-05-02 09:17:26 +02:00
Fabrice DJIATSA
19ba839d66 tests: drivers: spi: spi_loopback: update testcase file
add stm32n6570_dk in yaml file for CI test integration
purpose.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2025-05-01 18:17:15 +02:00
Sai Santhosh Malae
8e57cc6f70 drivers: spi: siwx91x: spi_loopback test support
1. Add board config and overlay files
2. Update testcase.yaml

Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
2025-04-30 18:44:11 +02:00
Derek Snell
dd825203b5 boards: nxp: add mcx_n9xx_evk
Another board for the MCXN947 SOC, very similar to FRDM-MCXN947

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-04-25 11:04:08 +02:00
Greg Leach
2aff40b1b1 tests: Add BL54L15/L15u DVK support
Adds support for the BL54L15 and BL54L15u DVK boards.

Signed-off-by: Greg Leach <greg.leach@ezurio.com>
2025-04-23 15:02:20 +02:00
Piotr Krzyzanowski
b983b0441b tests: drivers: spi: Add NULL spi_buf_set tests
Add test cases where spi_transceive gets NULL spi_buf_set
once for tx and once for rx.

Signed-off-by: Piotr Krzyzanowski <piotr.krzyzanowski@nordicsemi.no>
2025-04-14 20:03:28 +02:00
Luis Ubieda
6feb1c639b tests: spi_loopback: Extend RTIO fallback messages to 5
Loopback test requires this in order to properly execute half
transactions. Otherwise, testsuite fails.

It was overlooked when fixing #85894.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-04-09 21:10:53 +02:00
Håkon Amundsen
76a825c5fa tests: spi_controller_peripheral: fix CTRLSEL conflict
Both EXMIF and SPIS peripherals are claiming GPIO port 6 pin 0, but
with different CTRLSEL values. This will trigger a build error with
nrf-regtool 9.0.0 as it is not possible to apply this configuration
to hardware.

Fix the issue by disabling the EXMIF node that is enabled by default.

Signed-off-by: Håkon Amundsen <haakon.amundsen@nordicsemi.no>
2025-04-09 21:10:19 +02:00
Emil Gydesen
ecceec9b28 tests: drivers: SPI: Replace OVERLAY_CONFIG with EXTRA_CONF_FILE
Replace OVERLAY_CONFIG with EXTRA_CONF_FILE as the former
is deprecated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-04-08 22:58:43 +02:00
Matthias Hauser
941a5489d3 dts: boards: we: add board Ophelia-IV
add new board Ophelia-IV

Signed-off-by: Matthias Hauser <matthias.hauser@we-online.de>
2025-04-03 13:16:05 +02:00
Declan Snyder
2eb8cfb7f5 tests: spi_loopback: Fix synchronization mistakes
There are a couple things going wrong in this test code right now.

First of all, there is no syncrhonization of when the async polling
thread should start polling, causing sometimes the poll to fail on tests
before the async test ran. Add a semaphore to fix this.

The lock test was setting up a nonsense NOP transfer of 0 length.
This might cause unexpected behavior and is not the point of
this test case.
But, still we should add a seperate test case specifically for
testing this instead.

Also add a teardown function to release the locks to allow other test
cases to run in case of some failures.

Also a minor change to remove some ARG_UNUSED invocations for some
arguments that are actually used.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-04-01 04:15:31 +02:00
Derek Snell
725c0ebc50 doc: tests: drivers: spi_loopback: frdm_rw612 add comment
Document the signals to short to pass this test.

Signed-off-by: Derek Snell <derek.snell@nxp.com>
2025-03-26 21:57:05 +01:00
cyliang tw
ca0f5f6924 tests: drivers: spi: spi_loopback: support numaker_m55m1
Add support for Nuvoton numaker board numaker_m55m1.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2025-03-26 11:34:17 +01:00
Nikodem Kastelik
8b77098ca1 tests: drivers: spi: add test case for nRF54H20 SPIS120
New test case is for building an application simultaneously
utilizing SPIM120, SPIM120, SPIS120 and SPIS13x.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-03-22 13:38:34 +01:00
Declan Snyder
3a477c56dd tests: spi_loopback: Remove logging module
Since we are using ZTest, if we use the ZTest paradigm properly, we
don't need a logging module, since ZTest already logs what it does.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-03-21 14:41:02 -04:00
Declan Snyder
6bcee13d9b tests: spi_loopback: Use ZTest properly
Instead of having a bunch of giant if conditions and just running
all the test cases from one actual ZTest case, convert all the test
cases into proper ZTest test cases.

Removing the returns is now required because otherwise there will be
compiler warnings, and they were never doing anything anyways in the
event of zassert fail. ZTest cases are meant to report pass or fail with
ztest paradigm, not with return values and log messages.

Also move the test of the spi lock/release to a separate test suite
since it is not really testing an actual bus transfer, but rather a
that a feature in the SPI API is respected.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-03-21 14:41:02 -04:00