cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between two stm32 boards

CircuitFreak
Associate III

 

Hello Everyone,

I'm reaching out for some guidance on a project that I've been working on. Despite considerable effort, I'm still struggling to find an effective solution.

My project involves developing a controller design to manage different models on each STM32 microcontroller. The goal is to synchronize these controllers. I have successfully built the models, and they are functioning well. The key task is for each board to transmit data to another board. This data is crucial for calculations, leading to the generation of new data. This process of data exchange needs to be continuous. The image below shows how the each stm32 work. 

CircuitFreak_1-1706636236779.png

Here's the challenge: I'm having difficulties with the data transmission and reception between the boards. The data, which is in double format.

I would greatly appreciate any advice or suggestions on this matter, as I'm starting to run low on ideas.

Thank you in advance!

 

P.S. This is the code i am using for both boards. Just to check if i can transmit and receive at the same time. 

CircuitFreak_0-1706646591206.png

 

19 REPLIES 19
TDK
Guru

Where is the entry point for the loop?

If you feel a post has answered your question, please click "Accept as Solution".

Each board has it own initial conditions. The it goes into he while(1) loop. Does this answer your question? 

Andrew Neil
Evangelist III

So how are you connecting the 2 boards - UART? Other?

They key to this kind of thing is to not try to do both ends at once!

Start by getting one end working & fully tested against, say, a terminal in a PC.

Then get the other  end working & fully tested against, say, a terminal in a PC.

Then - and only then - bring the two together.

I have tired both SPI & and UART. When I loop the connection onto itself. It works fine. I checked this by sending the data the serial comms thru UART. The trouble happens when I make the connect from board 1 to board 2. 

Bob S
Principal

What trouble?  You haven't given us any info on what is or is not happening.  Nor have you shown any code (hint: use the code format button, click on "..." then "</>").

What do you see that you don't expect?  What don't you see that you do expect?

i not sure where "..." is. The trouble is that i can figure out how to send and receive. The figure above shows that.  

Sounds like a hardware issue possibly. Show us a diagram on how you're connecting the boards together with PS.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

Sure can, what is PS tho? Do you want a picture? I connect MOSI to MOSI, MISO to MISO, NSS to NSS, and CLk to CLK on each of the boards, using spi. 

Pavel A.
Evangelist III

Here you can find help with your project, both in hardware and software.