Skip to main content
XZou.1
Associate II
October 29, 2020
Solved

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

  • October 29, 2020
  • 2 replies
  • 771 views

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.
Best answer by XZou.1

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

2 replies

TDK
October 29, 2020

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
November 11, 2020

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