2024-02-12 12:34 AM
Hello, i have a problem with my spi communication i don't recieve the information from the slave to the master
Master configuration :
Slave configuration :
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.
Solved! Go to Solution.
2024-02-12 01:48 AM
Hi,
see ->
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. )
2024-02-12 01:48 AM
Hi,
see ->
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. )
2024-02-12 03:20 AM
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 ?
2024-02-12 03:29 AM
@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.
2024-02-12 03:31 AM
@Skyy_Tsuki wrote:my variable is stuck to 170 and don't move on my screen
What do you mean by that? How are you observing it?
ie, is that just a problem with your screen display/updating, or are you sure that the variable itself is not getting updated?
2024-02-12 03:46 AM
the goal of my project is to count a number of pulses between two rising edges of a signal but it is very slow as a signal so I use a 90kHz operating card because I cannot count my number of pulse correctly would you have a code to count a number of pulses and I use the second master card at 72 MHz to do my value display as well as the calculations because the goal is to obtain a phase shift currently I wanted to increment a variable every, lighting the LED and sending it to the master to see if the communication works but currently I communicate but do not recover consistent values on the increment variable, I display my values using an st7920 LCD screen.
2024-02-12 04:16 AM
I think you need to start a separate thread on that - it's nothing to do with SPI comms