This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ZEPHYR spi asynchronus api transfer with asymmetric buffers error

Hi,

Zephyr 3.0 , nrf5340  ncs 1.9.1 

i can successfully sent data with

this function ; 
So it sends 2 transactions without changing cs state.
1byte tx+rx  , and remaining rx bytes at the second transaction.. all works as expected.
but if i try async transceive function with these the same buffers / buffersets , i got kpoll event signal result as  -5 error ...
update: i could get 0 (success) but again it only sends the first buffers in the buffer set . 
if count is 1 in the buffer set , it works, but if count is 2 only the first parts fires. 
this is the debugger watch after the first chunk transferred. so this is the second chunk and it says 0 for rx and tx buffers.
if i use synchronous spi these chunks points the initial buffer address...
i tested with symmetric buffers, and it worked! 
one more finding , may be this helps to find out the issue ; 
i have added this code to make a breakpoint for debugger in spi_context_update_rx(struct spi_context *ctx, uint8_t dfs, uint32_t len) function( as you can see above. line 13)
I set my second buffer length as 256
If i transfer these buffers with this function ;
spi_transceive_async_dt(&cfg->bus,&tx, &rx,signal_);
debugger will never stop at  len>100 condition;
if i transfer the same buffer with 
err = spi_transceive_dt(&cfg->bus,&tx, &rx);
debugger stops at break point and , i can see len is 256...
So i check the documentation i couldn't find any information about this issue.
How can we use asymmetric buffer/sets with asynchronous spi api ?
Thanks.
  • Hi Mehmet

    I don't seem to have any issues with this on my side. I can use the spi_transceive_async functions whether or not I have the same number of TX and RX buffers. 

    Please find my main.c file attached:

    Are you sure you are setting up the poll signal and event correctly?

    How are you polling the signal after starting the SPI transaction?

    Best regards
    Torbjørn

  • Could you please give me full project , i couldnt make it work standalone. 

  • Hi Mehmet

    I have attached the project here: 

    5432.spi_test.zip

    It is basically just the zephyr blinky sample, with some code added to test the SPI driver. 

    It was tested in v1.9.1. 

    If you are still having problems getting it to build or run please let me know which issues you're seeing, and I will do my best to help. 

    Best regards
    Torbjørn