Skip to main content
Associate II
February 12, 2024
Solved

spi problem communication STM32F103c8t6

  • February 12, 2024
  • 1 reply
  • 7229 views

Hello, i have a problem with my spi communication i don't recieve the information from the slave to the master 

Master configuration :

master.png

masterclock.png

Slave configuration : 

spislave.png

spiclock.png

I want to receive how many time my led blink and i want to write it on my lcd screen. 

But everytime is printing 0.

This topic has been closed for replies.
Best answer by AScha.3

Hi,

see ->

AScha3_0-1707730974687.png

So try using:  HAL_SPI_TransmitReceive(..)  in master, to do the data "loop exchange" 

and in slave also , giving the data to transmit and wait for ready .

(You cannot separately send or receive , as you tried before. )

1 reply

AScha.3
AScha.3Answer
Super User
February 12, 2024

Hi,

see ->

AScha3_0-1707730974687.png

So try using:  HAL_SPI_TransmitReceive(..)  in master, to do the data "loop exchange" 

and in slave also , giving the data to transmit and wait for ready .

(You cannot separately send or receive , as you tried before. )

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate II
February 12, 2024

Thanks that's working but my variable is stuck to 170 and don't move on my screen, and i have a question the frequency of my two cpu does influe on my spi connection ? i can have on my slave 93.5kHz and 72 MHz on my master ? 

Andrew Neil
Super User
February 12, 2024

@Skyy_Tsuki wrote:

 the frequency of my two cpu does influe on my spi connection ? 


An SPI connection includes a clock line: the Master provides the clock to the Slave - so, in principle, the internal clock speed of the processors is irrelevant.

 


@Skyy_Tsuki wrote:

 my slave 93.5kHz and 72 MHz on my master ? 


Really? Your Slave is 93 kilo Hertz?? That's extremely slow!!

If it's really running that slowly, that's going to severely restrict the maximum SPI rate that it can cope with.

You just need to ensure that your SCK rate is within the capabilities of the slave.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.