Integration examples

CAN Isolator

MEX can operate as a CAN bus isolator, since it manages both CAN buses as desired. The system has a built-in microcontroller; which manages CAN buses in real-time. Both buses are not electrically connected, in consequence, electrical signals that do not follow the CAN protocol will be isolated.

The functionalities of a CAN isolator are the following:

With MEX it is possible to isolate CAN nets, by filtering certain messages from one CAN line and only transmitting specific information through MEX to the other one. This is a specific case of CAN input filter.

The following diagram summarizes the behavior of MEX as a CAN bus isolator:

../_images/subcan.png

Subnets CAN diagram

Filtered CAN subnet

In this example, only a certain range of CAN IDs will be allowed to cross from one CAN line to the other using the two CAN ports of MEX. Specifically, information will pass from CAN B of MEX to CAN A of MEX:

../_images/subcan_b_to_a.png

Subnets CAN example - From CAN B to CAN A

The allowed range will be from 0x550 to 0x55F.

  1. Create a new mailbox entry for CAN B.

    To do this, go to Input/Output menu \(\rightarrow\) CAN Setup panel \(\rightarrow\) CAN B tab.

    Assign some of the mailboxes to it and set the ID to 0x550. This example uses an ID expressed in hexadecimal notation.

    ../_images/subnet1.png

    Filtered CAN subnet - Mailbox configuration

  2. Set a Mask which will ignore the last 4 bits.

    Note

    Although the ID has been entered in hexadecimal notation, note that the Mask has been set in binary format.

    ../_images/subnet2.png

    Filtered CAN subnet - Mailbox mask configuration

  3. Go to Input/Output menu \(\rightarrow\) CAN I/O panel \(\rightarrow\) Configuration tab.

    Configure CAN Input Filter 3 on CAN B, with the same settings as the Mailbox.

    Important

    This menu only allows decimal numbers. For this example the Id 0x550, is represented as 1360 in decimal format, and the Mask is also represented in decimal format as 2032.

    ../_images/subnet3.png

    Filtered CAN subnet - CAN Input Filter configuration

  4. Bind CAN Output Filter 3 to CAN Input Filter 3 and, configure the CAN Output Filter to CAN A.

    ../_images/subnet4.png

    Filtered CAN subnet - CAN Output Filter configuration

CAN tunnel

A CAN tunnel is a specific case of a message tunnel.

In this example, a transparent tunnel will be created. So, any messages received on Interface A will be sent through Interface B:

../_images/subcan_a_to_b.png

Subnets CAN example - From CAN A to CAN B

Optionally, the mailboxes can be equally distributed to support both standard and extended CAN IDs.

  1. Create a new mailbox entry for Interface A.

    To do this, go to Input/Output menu \(\rightarrow\) CAN Setup panel \(\rightarrow\) CAN A tab.

    Assign half of the mailboxes to it and set a Mask of 0.

    ../_images/tunel1.png

    CAN tunnel - Mailbox configuration

  2. Go to Input/Output menu \(\rightarrow\) CAN I/O panel \(\rightarrow\) Configuration tab.

    Configure CAN Input Filter 3 on CAN A, with CAN id 0, a Mask of 0 and Both as frame format type.

    ../_images/tunel2.png

    CAN tunnel - CAN Input Filter configuration

  3. Bind CAN Output Filter 3 to CAN Input Filter 3 and, configure the CAN Output Filter to CAN B.

    ../_images/tunel3.png

    CAN tunnel - CAN Output Filter configuration

Reading Arbitration Messages

Note that those messages are generated only if arbitration and messages are enabled in MEX.

Arbiter will send its telemetry in little endian format, using its CAN-TX ID.

The appropriate arbitration message format is described in Arbitration - CAN Bus protocol section of the MEX Software manual.

External devices

The step-by-step instructions for the following external devices are explained in detail in the following sections: