Dear community !
Although I have successfully configured several ESP32s with the SN65HVD23x transceiver, I am unable to understand the structure of sending and receiving CAN messages. If anyone would be willing to spend the time and energy, I would ask for an explanation.
A simple sketch of the application :
ESP32 devices with CAN, placed in “rooms” that will serve as “controllers”. We can call them, controller_1, controller_2, etc…
ESP32 devices with CAN, placed in the utility room with relays connected to switch the desired appliance based on a pulse from the “controllers”. Call them relay_board_1, relay_board_2, etc…
In both cases, every single ESP32 board has an SN65HVD23x “transceiver” connected to it and is part of the CAN network.
As I mentioned, “controller_x” will send an on/off message to the desired appliance, which will be connected to “relay_board_x”.
I would like to achieve a state where every single device in the CAN chain, sees every CAN message (which is probably the default state in the default CAN configuration), and “decides” if the message belongs to it, and should execute som actions. Likewise then send a message from “relay_board_x” about the on/off state back to “controller_x” through the visual response on the display on “controller_x”.
My understanding from the documentation about CAN messages was:
can_id : Identifier of the device in the CAN network. If I have 20 devices on the network, it would be can_id: 01 , can_id: 02… to can_id: 20
data : the configured value to be sent when a certain command is executed.
I had thought that if I configure for example for the action “ON” canbus_send: data 11 and for “OFF” canbus_send: data 10 on “controller_01”, then the sent message will have the format 01x11 , respectively 01x10, as a combination of device “can_id” and the “data”. Subsequently, I can then set on_frame: on “relay_board_x”, what action to take when the message “01x11 resp. 01x10” appears in the CAN network.
However, this assumption was false on my part, and I cannot explain the structure of these reports and how I would know the desired state. I honestly admit I cannot understand it, and for that reason all efforts to succeed are in vain.
Would any of you please be willing to provide an explanation how should I understand the structure and help in creating a few send and receive commands so that I have a template ?
Thank you very much !