Skip to main content
XZou.1
Associate II
Oct 29, 2020 11:04 AM UTC
Solved

Why the number of data I sent is wrong when using HAL_SPI_TransmitReceive() ?

HAL_SPI_TransmitReceive(&hspi1,tx_sensor_data,rx_sensor_data,8,0);

​

I want sent 8bytes, but only 2bytes sent, why?​

This topic has been closed for replies.
XZou.1
XZou.1Best answer
Associate II
Nov 11, 2020 9:35 AM UTC

I solved it. The general set is wrong. Must set 8 bits not 4bits or 2bits

2 replies

TDK
Oct 29, 2020 11:49 AM UTC

You have a timeout of 0, which may be the issue. If you want it to be blocking, use HAL_MAX_DELAY.

"If you feel a post has answered your question, please click ""Accept as Solution""."
XZou.1
XZou.1AuthorBest answer
Associate II
Nov 11, 2020 9:35 AM UTC

I solved it. The general set is wrong. Must set 8 bits not 4bits or 2bits