Hello,
nRF Connect SDK1.8.0, Windows10 X64.
default code, test spi loopback,
how to know recv data lenght?
thanks
Best regards,
yuyou
Hello,
nRF Connect SDK1.8.0, Windows10 X64.
default code, test spi loopback,
how to know recv data lenght?
thanks
Best regards,
yuyou
Hi,
If the SPI is a master, spi_transceive() will fill the entire rx buffer with data from the miso pin, and it will send all the data from the tx buffer at the same time.
If the SPI is a slave, spi_transceive() will return how much data it has received, and it will have sent data from the tx buffer at the same time.
Note that not all the data in the master's rx buffer is necessarily useful data, as the SPI master simply reads the pin until the buffer is full. Interpreting the contents of the buffer is done by a device driver or your application.
Hello,
thanks for your reply,
as follow, it is slave, 8 bytes have actually been received,
but return 0.
thanks
Best regards,
yuyou
Ah, I'm sorry, I forgot that our implementation of the spi_transceive function does not return the amount of data received on the slave side.
The driver or application on the slave side will have to interpret the contents of the rx buffer, similar to how it would be done on the master side.
Hello,
master side spi_transceive return 0. but
E: Slave mode is not supported on SPI_1
E: Slave mode is not supported on SPI_3
Try adding an overlay with:
&spi3 { compatible = "nordic,nrf-spis"; };