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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
New test case is for building an application simultaneously
utilizing SPIM120, SPIM120, SPIS120 and SPIS13x.
Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
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>
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>