An asset device can interact with an Octave edge device by sending and receiving information over CANopen. This topic provides a walk through on setting up communications on a mangOH Red using CANopen.
To use CANopen with an FX30S or mangOH Red, the device must be running firmware 1.0.14+ and must be equipped with an IoT expansion card.
For additional information about the CANopen protocol see the [CANopen Reference Guide].
Tutorial for CANopen Communications
This tutorial assumes a working knowledge of CANopen.
Setting up CAN bus on the mangOH Red Through Octave
Follow the steps below to configure Octave to communicate over CANopen:
- Select your mangOH Red in the Octave dashboard and navigate to Build > Device > Services.
- Locate the CANopen section, and click Configure.
- Set Bus name to bus1, set the Bitrate to 125kb/s, and set Mode to spy.
- In the Configuration section, enter an ID and name for the first node. Click "+" to add additional nodes and enter their information as required.
- Set the Polling Period under Objects to 1. This specifies that the object at the edge will be polled every second.
- Define objects for a CANopen object dictionary by setting the ID and name just below the polling period. Click the "+" button on the right hand side to add additional variables to the object dictionary.
- Click the down arrow to the left of the object ID to view its sub indices, and enter the ID, name, and type for each. Click the "+" button on the right hand side to add additional sub indices to a variable. Note that the Const type is read-only and is the same size as Unsigned32. The other types can be used for service-to-object requests which can involve both reads and writes.
- Set up the CANopen Process Data Object (PDO) protocol by clicking the PDOS tab. Click the "+" button on the right hand side to add additional PDOS entries.
- Ensure the arrow to the left of the first PDOS entry points down, and click EntryId to select a variable/subindex combination defined in steps 6 and 7 above. The graph will update to provide a visual indication as to how many bits of the 64-bit data size maximum the entries use. Click the "+" button on the right hand side to add additional PDOS entries.
- Click Save to save the CANopen configuration.
Follow the steps below to identify and verify the resources that have been created for your bus:
- Navigate to Build > Device > Resources in the Octave dashboard.
- Locate and expand canopen and verify that the errorlog/value is null. This field will be populated with an error message if an error occurs when configuring CANopen.
- Expand canopen > bus1 to view the CANopen configuration.
Receiving Data from a CANopen Device
- Navigate to Build > Device > Observations.
- Create a new Observation that sends events to the Cloud Stream, and save it.
- Wait for Octave to poll the device and then view the Observation's Last Value field to see the raw data that was read.
Updated over 2 years ago