cancel
Showing results for 
Search instead for 
Did you mean: 

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

XZou.1
Associate II

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

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

1 ACCEPTED SOLUTION

Accepted Solutions
XZou.1
Associate II

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

View solution in original post

2 REPLIES 2
TDK
Guru

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
Associate II

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