Every activated MB participates in an arbitration process where the highest priority message
will be selected, depending on the user’s configuration. And eventually once the message is
transmitted the CODE and TIME STAMP fields are updated and a flag is raised.
Here is this program’s code for transmission:
For receptions with MBs, you need to write the put a MB in to RX INACTIVE mode and set its ID,
then you’ll need to put it in RX EMPTY mode and wait for a reception. The most accurate way to
detect a reception is to fait for the MB’s individual flag (either as an interruption or a simple
flag). And then it can be read by first accessing the Control and Status word (for activating the
internal lock), then reading the ID and the Data, and then making a dummy read on the Free
Running Timer for releasing the internal lock.
There are 69 interrupt sources in this module (every Message Buffer + error flags (Bus Off,
Error, Tx warning, Rx warning) but only 8 interrupt handlers. There is one handler for the Error
Interrupt. There is another handler for Bus Off, Tx Warning and Rx Warning.
And for message buffers: MBs 0 to 3 have one handler, similarly for MBs 4 to 7, MBs 8 to 11 and
MBs 12 to 15. And then MBs 16 to 31 and MBs 32 to 63 each have one interrupt vector.
In these handlers with multiple sources, the user will need to check for particular cases.