Skip to main content
IRodr.2
Associate II
May 29, 2021
Solved

SPI4 error

  • May 29, 2021
  • 3 replies
  • 2615 views

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.
Best answer by IRodr.2

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.

3 replies

TDK
Super User
May 30, 2021

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

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
Super User
May 30, 2021
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

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

Ons KOOLI
Associate
May 31, 2021

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

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.