Skip to content

Commit 5dec22a

Browse files
bjarki-andreasennashif
authored andcommitted
tests: drivers: spi: loopback: wait for idle before timed test
Wait a bit before performing timed spi_loopback_transceive() in test_spi_complete_multiple_timed to ensure the console is idle, otherwise the console completing and suspending in the "background" near the end of the spi transaction can introduce latency. Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
1 parent 35c8301 commit 5dec22a

File tree

1 file changed

+7
-1
lines changed
  • tests/drivers/spi/spi_loopback/src

1 file changed

+7
-1
lines changed

tests/drivers/spi/spi_loopback/src/spi.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,13 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed)
359359
*/
360360
zassert_ok(pm_device_runtime_get(spec->bus));
361361

362-
/* since this is a test program, there shouldn't be much to interfere with measurement */
362+
/*
363+
* since this is a test program, there shouldn't be much to interfere with measurement.
364+
* still let's wait for the console to complete printing so it does not complete and
365+
* suspend near the end of the spi transaction.
366+
*/
367+
k_msleep(10);
368+
363369
start_time = k_cycle_get_32();
364370
spi_loopback_transceive(spec, &tx, &rx, 2);
365371
end_time = k_cycle_get_32();

0 commit comments

Comments
 (0)