How to send and receive CAN bus messages
Send and receive CAN bus messages using Profinity's built-in CAN tools. Receiving shows the traffic on the bus, and sending transmits a packet once or on a schedule. The Send / receive CAN bus messages page is the full CAN utilities reference.
Before you start, you need:
- Profinity running, with an active profile that has the adapter configured.
- A CAN bus adapter connected and active. To set one up, refer to How to connect to CAN bus.
- A role that includes the View CAN data permission to receive and view CAN messages, and the Send CAN messages permission to send them.
Check user permissions
On a Server or Enterprise installation:
- Select ADMIN in the side menu, then Users & Groups.
- Select your user account.
- Check that one of the Assigned roles includes View CAN data, which allows CAN messages to be received and viewed. To send messages, check that an assigned role includes Send CAN messages, which also includes View CAN data.
- Change the roles if needed, and select Save.
Changing a user's roles revokes their active sessions, so the user must sign in again for the change to take effect. A Windows desktop installation runs as a built-in user that holds every permission, so it needs no change (refer to Licensing).
Receive CAN messages
Select CAN UTILITIES in the side menu, then SEND & RECEIVED CAN. The CAN Activity window opens and shows all CAN messages currently on the network. Select a message to see its details. The columns, the Spaced data and Heatmap toggles, and the sort and filter options are described in Receive CAN packets.
Send a CAN packet
A sent packet can command connected hardware
A packet sent from Profinity goes on to the live CAN bus, and every connected device acts on it. A packet can start a motor controller, open a contactor, or change a device setting. Check what is connected to the bus, and what the packet's CAN ID and data mean, before you send it. Be especially careful with a scheduled packet, which keeps sending until you delete it.
A packet can be sent once, or saved so that Profinity adds it to the Scheduled CAN Packets list and continues to send it in the background. To send a packet:
- Select the + icon in the Scheduled CAN Packets list at the bottom of the screen. The packet editor opens. To start from a received packet instead, double-click it or select it in the CAN Activity panel. Then select the Open in schedule editor + icon at the top of the page.
- Enter the CAN ID (hex or decimal).
- Select the Endian byte order, which is little endian by default. The schedule editor reference explains why little endian is the default.
- Choose the Data Format, which is Bytes, Int16, Int32, Floats, or Raw Data, and enter the values.
The raw data updates automatically as the values change.
For example, in Bytes the values
0x01,0x02, and0x03go in bytes 0 to 2. In Int16, the values1234and5678go inInt16[0]andInt16[1], and Profinity converts them to bytes. - Set the Interval [ms] to choose how often Profinity sends the packet. For example, 100 ms sends it 10 times per second. The value is a whole number from 1 to 4,294,967,295. Leave it blank, or enter 0, to send the packet once. Blank is the default. The primary button then reads SEND instead of START.
- Select Save to add the packet to the scheduled list. The packet appears in the scheduled packets panel, and it starts sending at once if an interval is set.
- To send a packet manually at any time, including a packet that is not on a schedule, select it in the Scheduled CAN Packets list. Then select the Send arrow button, or press the Space key. Profinity sends the packet immediately.
- Check the CAN Activity panel, where the sent message appears with an outgoing direction. Confirm that the CAN ID and data match your configuration.
Manage scheduled packets
The Scheduled CAN Packets list at the bottom of the screen shows every scheduled packet. Profinity saves a scheduled packet with the profile, so the saved packets are restored after you change profile or restart Profinity. A packet with an interval starts sending when you save it, and it keeps sending after the user signs out. Packets do not start automatically after a profile change or a restart of Profinity. To restart a stopped packet, open it in the Scheduled CAN Packets list and select START.
To stop a packet, select it in the scheduled packets panel, then select Delete or press the Delete key. This removes the packet from the schedule, and Profinity does not keep a copy, so a deleted packet cannot be restored. To use it again, create the packet again. To change a packet, select it, then select Edit or double-click it. Change the settings, and select Save.
To avoid sending unexpected traffic to a live bus, send a packet manually before you schedule it. Also check that the CAN ID, data format, and CAN bus bit rate match what the network expects.
Troubleshooting
| What you see | Cause | What to do |
|---|---|---|
| A scheduled packet never appears in the CAN Activity panel. | Usually one of these: (1) the adapter is disconnected, so its status indicator is not green; (2) the signed-in user lacks the Send CAN messages permission; (3) the CAN ID is invalid; (4) no interval is set, so the packet waits for a manual send. | Work through the causes in that order. Then select the packet and select the Send arrow, to confirm that it transmits before you rely on the schedule. |
| A packet that was sent is missing from the CAN Activity panel. | A filter usually hides it. The adapter may also be receiving no traffic back, or the CAN bus bit rate may differ from the network. | Clear the filters, check that the adapter is receiving traffic, and check the bit rate in the adapter's settings (for example Candapter BaudRate or PCAN BaudRate; a Tritium bridge uses Bit rate (kbps) in its firmware settings). |
| The data differs from what was entered. | The byte order or the data format is usually wrong. | Check that the Endian setting matches your system. Check the conversion between bytes and integers. Review the raw data to confirm the values. |
For every option of the packet editor, refer to Send / receive CAN bus messages.