Skip to main content
IRodr.2
Associate II
May 29, 2021 2:18 PM UTC
Solved

SPI4 error

Hi,

I'm trying to use SPI to communicate between two boards. On the MASTER side, i am using the HAL_SPI_Transmit(&hspi4, (uint8_t*)TxData,sizeof(TxData),100); and on the slave side i have enabled the interrupt, HAL_SPI_Receive_IT(&hspi4,RxData,1);

The message that i am trying to send is simply a 0x01. But it doesn't receive properly on the slave side....

Did anyone experience something like this?

This topic has been closed for replies.
IRodr.2
IRodr.2Best answer
Associate II
May 31, 2021 9:31 PM UTC

thanks! i found the solution. I didn't set neither the pullup or pulldown. After i set as pulldown it started working properly.

Thank you all.

6 replies

TDK
May 30, 2021 4:47 PM UTC

You're sending many bytes but only receiving 1. This is going to cause issues if the master sends another byte before the slave is ready.

"If you feel a post has answered your question, please click ""Accept as Solution""."
IRodr.2
IRodr.2Author
Associate II
May 30, 2021 5:06 PM UTC

Hi, thanks for your response. I dint' get the point... i am only sending 0x01, and have a buffer size of 1 on the Slave side.

TDK
May 30, 2021 5:16 PM UTC
How are you managing the CS line? Send a byte with CS high first to ensure the peripheral is enabled to avoid an extra clock edge. Ensure slave is ready to receive before you set CS low. A logic analyzer on the lines would clear things up.
"If you feel a post has answered your question, please click ""Accept as Solution""."
IRodr.2
IRodr.2Author
Associate II
May 30, 2021 7:41 PM UTC

I am not using as far as i know CS....

Ons KOOLI
Visitor II
May 31, 2021 10:33 AM UTC

Hi @IRodr.2​ ,

and welcome to ST Community.

Please refer to the STM32CubeH7, under directory: Projects\$board_name$\Examples\SPI\SPI_FullDuplex_ComIT

This example shows how to ensure SPI data buffer transmission/reception between two boards by using an interrupt.

Best Regards,

Ons.

IRodr.2
IRodr.2AuthorBest answer
Associate II
May 31, 2021 9:31 PM UTC

thanks! i found the solution. I didn't set neither the pullup or pulldown. After i set as pulldown it started working properly.

Thank you all.