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
thanks for reply,
maybe zephyr.dts modify is invalid,
Because I'm trying to change the pins in master, reload and recompile, but it still use the old pins.
thanks
Best regards,
yuyou
You can't edit files in the build folder. You need to add/edit configs in the prj.conf file, not in the build folder.
To edit pins, you need to add an overlay file to the application, named nrf52840dk_nrf52840.overlay and add the new values there.
Hi,
thanks for reply.
i created file nrf52840dk_nrf52840.overlay as follow:
only change pin to 0x1e,reload project clean solution and rebuild, it still runing whit old pin.it means nrf52840dk_nrf52840.overlay not used.
so,change prj.conf、boards/nrf52840dk_nrf52840.conf、*.dts、*.overlay files,must run CMake,it will be used.
but this case is all about discuss :
how to know recv data lenght in master?
thanks
Best regards,
Like I said in my first reply, you need to interpret the contents of the rx buffer to know the length of received data in the master. It will always receive the full size of the rx buffer, and your driver or application needs to figure out how much of that data is useful.
Closing this case due to this duplicate: https://devzone.nordicsemi.com/support-private/support/284016
Closing this case due to this duplicate: https://devzone.nordicsemi.com/support-private/support/284016