cancel
Showing results for 
Search instead for 
Did you mean: 

how to access a variable of one board from the other board?

SGUIG.1
Associate II

Hello everyone, i am working on a project to connect two stm32 boards via CAN bus which i managed to do successfully, now i am looking for a way to acces to the variables of one board from the other board. i really hope one of you can reply. thank you.

4 REPLIES 4

You'd need to implement a request/response type protocol to allow one device to query the other, or send the information periodically.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

do you have an idea on how to do that? this is my first time using stm32 and things are not clear for me. also i am already sending Data between both of the boards but i want to be able to access some variable of one board from an other. i would like it if you can show me an example. thank you

Jack Peacock_2
Senior III

Divide the identifier into two logical fields: a service code, and an object identifier. Request a variable by sending an identifier with the "request" service code and object identifier. The receiving node splits the identifier into the service code and identifier. Since the service is a request, look up the variable using the object identifier. Compose a new identifier with a service code of "reply" and the same object identifier, place the variable data in the data field, and send the new message. The original node receives the reply and processes the data.

Sorry, no code, I don't use the HAL or LL routines.

Jack Peacock

I'm sure I could invent a method, probably by specifying an address to read on the remote device, but I can't spend hours creating something, and I don't really understand the reason/necessity to do this.

Why does one device need to see the other's variables? Can't you integrate that visibility at a packet level. For example if you need to see the number of pulses on a pin on the remote device, can't that device just report that periodically? Or have query method?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..