2020-06-02 06:34 AM
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.
2020-06-02 06:41 AM
You'd need to implement a request/response type protocol to allow one device to query the other, or send the information periodically.
2020-06-02 06:43 AM
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
2020-06-02 10:01 AM
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
2020-06-02 10:15 AM
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?