flexcomm spi asynchroneous mode not working #87054
Labels
bug
The issue is a bug, or the PR is fixing a bug
platform: NXP Drivers
NXP Semiconductors, drivers
priority: low
Low impact/importance bug
I've tested spi on the NXP RW612 in both sync and async mode, which did not give the expected results.
When I use spi_transceive_cb I see that the the given callback is executed prior to the return of the function
spi_transceive_cb
itself.The board uses this driver: spi_mcux_flexcomm.c
I've used Percepio TraceAlyzer to trace this:
I have added manual trace points, visible in 'yellow'
[app] spi-tx-beg: trace prior to call of function
spi_transceive_cb
[app] spi-tx-end: trace right after the function
spi_transceive_cb
has returned[app] spi-tx-cb: trace in the callback provided as argument to
spi_transceive_cb
Synchronous:

Asynchronous: callback executed prior to the return point of spi_transceive_cb

In the screenshots I've also tried to measure the absolute timings, however due to the overhead of tracing itself this can be misleading. The actual data being sent out is the string
"abcdefghijklmnopqrstuvwxyz"
on 5Mhz, which takes about 41us. With the tracing overhead it's hard to find this particular timings.On the other hand, +/- 300us seems quiete a lot, given the sitution that there is a trace less, and no interrupt context switch.
This has been tested on 4.0.0 as well as the current main, i.e. commit 4bb5ffd, both with zephyr sdk 0.17.0 on Linux/Ubuntu.
This is my test code:
With the following
prj.conf
Is this indeed a bug, or do I have the wrong expectation of
spi_transceive_cb
? In the latter case, how do I setup an asynchronous SPI transfer correctly?The text was updated successfully, but these errors were encountered: