I am new to the CAN protocol and I am trying to utilise it through the Linux's SocketCAN. However, I am confused by the 2 different CAN sockets available, RAW and Broadcast Manager (BCM).
Documentation states that BCM sockets is not intended for sending individual CAN frames. Intuitively I am guessing BCM is more for single master- multiple slave configuration, but this seems somewhat wrong.
What is the BCM intended for? Or rathe, what's the difference in terms of functionality between them? In what kind of situation do I choose to use Broadcast Manager over Raw Sockets?
I suggest looking into official documentation: https://www.kernel.org/doc/html/latest/networking/can.html
In short:
For example: You can send messages periodically from your code by using RAW socket and some timer.
Or you can send one message on BCM socket with appropriate configuration and afterwards Linux kernel will periodically send CAN messages for you. To stop this, you send a message on BCM socket again with different configuration.
BCM socket can also be used for automatic monitoring of received messages. In this case you specify how often you expect each message to be received and a data mask, send a message to BCM socket to configure this and voila. You will be able to read from the BCM socket only when the timeout for receiving expected message is triggered and when the message changed the content based on your provided data mask.