Commit Graph

443 Commits

Author SHA1 Message Date
Khaoula Bidani
bcbe5f3b26 tests: drivers: spi_loopback: add latency tolerance for nucleo_u385rg_q
Set a convenient latency for nucleo_u385rg_q

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-07-11 09:40:47 -05:00
Declan Snyder
f7853dfb16 tests: spi_loopback: Fix same_buf_cmd test
The tests was written wrong. It was meant to test using same spi bufs
for both rx and tx, as in tree many sensor and other spi device drivers
use this paradigm. But the 2nd buf setup call was overwriting the first.
Fix by not using the helper function for this case.

And for the write back test, test using same spi_buf_set.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-07-09 17:18:22 -05:00
Declan Snyder
0574ac7e84 tests: spi_loopback: skip hold_on_cs test if not supported
This early exit section is only reached if there is an error.
In the case of not supported, the ret variable will be 0 and zassert
won't happen. This is because the test was meant to be skipped, not
passed or failed, in this case. So add the skip call.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-07-01 11:00:43 -10:00
Karol Lasończyk
061036f9e3 tests: samples: Extend support for nRF54LM20A
Extends support and adds new overlays.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-27 18:26:57 -05:00
Raymond Lei
dd90248a3a test: spi_loopback: nxp: Add Flexio spi test support
Add overlay file for RT1170 EVK and simply existing flexio spi overlay
file for RT1060 EVKC and RT1064 EVK. One flexio-spi interface for both slow
and fast tests. Fast baud rate set to 16Mbps now.

Signed-off-by: Raymond Lei <raymond.lei@nxp.com>
2025-06-27 09:05:47 -10:00
Mert Ekren
e7dd1e507a tests: drivers: spi: Add MAX32657 overlay files
Enable 'spi_loopback' test for MAX32657 boards.

Signed-off-by: Mert Ekren <mert.ekren@analog.com>
2025-06-27 10:01:27 -05:00
Bjarki Arge Andreasen
160c196435 tests: drivers: spi: loopback: extend nrf overlays with miso/mosi
Add miso-gpios and mosi-gpios to nrf overlays required for
device_deinit testing.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-27 10:57:59 +02:00
Bjarki Arge Andreasen
ecb5457898 tests: drivers: spi: loopback: test device_deinit
Introduce test for device_deinit() which deinitializes the spi
bus, then configures miso as input, mosi as output using gpio,
utilizing the loopback to test directly controlling the pins.
Then reinit the spi device.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-27 10:57:59 +02:00
Julien Panis
a631df5cd8 tests: drivers: spi: spi_loopback: Add testcase for cc23x0
Enable DMA for the test.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-06-27 10:56:54 +02:00
Raymond Lei
0d2935218c drivers: spi: nxp: fix PCS broken issue and PCS_HOLD_ON support
Different LPSPI IPs are used for RT11xx and MCXN. On a older version of
LPSPI, a transmit command or a TX data need to be issued to end a frame.
On a new version, no such requirement.

Based on above information, we have to make DMA transfers "cascade" in
the DMA ISR to keep CS asserted during the whole SPI transfer.

PCS_HOLD_ON is a feature to keep CS asserted during multi SPI transfers.
It is implemented and supported on new LPSPI IP but it is impossible to
be supported on an older version like RT11xx.

Signed-off-by: Raymond Lei <raymond.lei@nxp.com>
2025-06-26 22:06:04 -05:00
Declan Snyder
6aa46f4019 tests: spi: Add overlay for frdm_mcxa156 dual test
Add an overlay to the spi_controller_peripheral test for the
frdm_mcxa156. Since this IP has multiple CS, need to introduce a way to
configure the correct CS to the test; just going to use zephyr,user for
now instead of refactoring to be less nordic-specific, keeping the usage
optional.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-06-26 11:07:55 -10:00
Abderrahmane JARMOUNI
da62b1c19d tests: drivers: spi_loopback: fix buffers alignment size
Size given to __aligned() is in bytes.
Align following DCACHE line size, or default to 32-byte alignment

Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
2025-06-26 11:12:11 +02:00
Khoa Nguyen
c6f237ed0b tests: drivers: spi: Add support spi_loopback for ek_ra8p1
Add support test app spi_loopback for Renesas ek_ra8p1

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-06-25 15:56:20 -10:00
Thao Luong
e2267bd59e tests: drivers: spi: Add support ek_ra2l1 for spi_loopback test
Add support for ek_ra2l1 on spi_loopback.

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2025-06-25 09:52:23 +02:00
Khaoula Bidani
f2c37c4b13 tests: drivers: spi: spi_loopback: add stm32u3 boards overlays
add SPI loopback test overlays for Nucleo U385RG-Q board.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-06-24 14:22:58 +02:00
Declan Snyder
877fa975cc spi_nxp_lpspi: Remove MCUX branding
Since the LPSPI drivers no long use MCUX at all, remove the MCUX
branding, to avoid confusion. In the future if an implementation uses
the MCUX SDK driver, it should specifically be called by MCUX in the
name.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-06-18 17:51:19 -04:00
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