cancel
Showing results for 
Search instead for 
Did you mean: 

SPI4 error

IRodr.2
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

6 REPLIES 6
TDK
Guru

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

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.

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".

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

Ons KOOLI
Senior III

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.

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.