CAN Bus Communication: Difference between revisions

From STorM32-BGC Wiki
Jump to navigation Jump to search
No edit summary
Line 30: Line 30:


For the details on the messages, see pavelsky's rcgroups thread [https://www.rcgroups.com/forums/showthread.php?2071772-DJI-NAZA-Phantom-A2-CAN-bus-communication-protocol-NazaCanDecoder-Arduino-library DJI NAZA/Phantom/A2 CAN bus communication protocol - NazaCanDecoder Arduino library].
For the details on the messages, see pavelsky's rcgroups thread [https://www.rcgroups.com/forums/showthread.php?2071772-DJI-NAZA-Phantom-A2-CAN-bus-communication-protocol-NazaCanDecoder-Arduino-library DJI NAZA/Phantom/A2 CAN bus communication protocol - NazaCanDecoder Arduino library].
=== STorM32-Link Features ===
----
The DJI CAN bus STorM32-Link provides 3 features:
* '''''Control of the STorM32 functions by the radio transmitter.''''' This feature has the same effect as if the receiver would be connected to the STorM32 controller at its inputs, except that such a physical connection is not required since the information is read off from the DJI CAN bus. For this to work the parameter {{PARAMNAME|Virtual Channel Configuration}} in the {{GUI|Setup}} tab must be set to {{PARAMVALUE|serial}}.
* '''''Yaw drift compensation.''''' This feature suppresses any yaw drift of the camera IMU. This allows one e.g. to put the yaw axis into {{PARAMVALUE|hold}} mode for extended periods of time, and yet the camera will not drift away (the accuracy and stability depends on the accuracy and stability of the flight controller's yaw angle).
* '''''Horizon drift compensation.''''' This feature helps to maintain a leveled horizon even in high-g maneuvers, there the horizon would usually tilt. For this to work the parameter {{PARAMNAME|STorM32Link Configuration}} must be set to {{PARAMVALUE|v1}}.
A demo video showing the effectiveness of the horizon drift compensation is available on the firmware author's youtube channel.


== UAVCAN ==
== UAVCAN ==

Revision as of 08:14, 30 July 2018

The information on this page refers to firmware v2.40 and higher.

The STorM32 gimbal controller supports the DJI CAN bus and UAVCAN protocols. This allows communicating with the STorM32 controller through a CAN bus, very similar to the communication through the serial interfaces or Wifi.

DJI CAN Bus

The STorM32 gimbal controller can be connected to the CAN bus of a DJI flight controller, which enables STorM32-Link.

Currently only the DJI Naza M2 is supported.

See also Using STorM32 with DJI.

Configuration


In the GUI, the DJI CAN bus related parameters are located in the [GUI:Interfaces Tool] window, which is accessible via the [GUI:Tools] menu.

Uavcan Configuration:
Set to “dji naza” to activate the CAN bus communication with a DJI Naza M2. The STorM32 board needs to be reset for a change to become effective.

STorM32Link Configuration:
Set to any value different from “off” to activate the STorM32-Link features.

When the CAN bus is configured to “dji naza”, the STorM32-Link will become PRESENT and OK, as indicated in the respective areas in the [GUI:Dashboard] tab and the [GUI:DataDisplay]. The parameter STorM32Link Configuration determines if and which STorM32-Link features are functional.

DJI CAN Bus Messages


The STorM32 listens to the 0x090-1002 (OSD data) and 0x108-1009 (input/output) messages. In order to enable the emission of the OSD data message, the STorM32 emits 0x108-1007 (OSD heartbeat) messages at 1 Hz.

For the details on the messages, see pavelsky's rcgroups thread DJI NAZA/Phantom/A2 CAN bus communication protocol - NazaCanDecoder Arduino library.

UAVCAN

The STorM32's UAVCAN support offers the very same functions and features as the communication through the serial interfaces or Wifi; they only differ by the bus which is used.

See also Using STorM32 with ArduPilot.

Configuration


The STorM32 parameters, which are related to UAVCAN, are split into the 'normal' and the 'UAVCAN' parameter sections. The parameters in the normal section are accessible like all the other parameters, e.g. via the GUI. The parameters in the UAVCAN section are however accessible only by using UAVCAN's Node configuration mechanism. The two parameter sections are exclusive, that is, a parameter is either in the one or the other section, but not in both. The single exception is the Uavcan Node ID parameter, which can be configured by either mechanism.

GUI Parameters

In the GUI, the parameters in the normal section are located in the [GUI:Interfaces Tool] window, which is accessible via the [GUI:Tools] menu.

Uavcan Configuration:
Set to “uavcan” to activate the UAVCAN communication. The STorM32 board needs to be reset for a change to become effective.

Uavcan Node ID:
Sets the node ID of the STorM32 controller (default = 71). Dynamic node allocation is not supported. The range of allowed IDs is restricted to 11 - 124. The STorM32 board needs to be reset for a change to become effective.

This parameter also sets the channel ID for the UAVCAN tunnel.Broadcast messages.

UAVCAN Parameters

The parameters in the UAVCAN section can be accessed e.g. using the UAVCAN GUI Tool, and a SLCAN adapter. A uc4h SLCAN adapter is probably the cheapest option, for a advanced option see the Zubax Babel.

NodeId:
Sets the node ID of the STorM32 controller (default = 71). Dynamic node allocation is not supported. The range of allowed IDs is restricted to 11 - 124. The STorM32 board needs to be reset for a change to become effective.

NodeStatus Rate:
Sets the rate at which the uavcan.protocol.NodeStatus message is emitted (default = 1000). A value of 1000 means that a message is broadcasted every 1000 ms.

GimbalStatus Rate:
Sets the rate at which the storm32.GimbalStatus message is emitted (default = 500). A value of 500 means that a message is broadcasted every 500 ms. A value of 0 deactivates the emission of the message.

UAVCAN Messages


The STorM32 controller supports the UAVCAN standard data types which are needed for basic operation, as well as the tunnel.Broadcast data type.

NodeStatus (BC, ID 341)

See uavcan.protocol.NodeStatus.

GetNodeInfo (SR, ID 1)

See uavcan.protocol.GetNodeInfo.

RestartNode (SR, ID 5)

See uavcan.protocol.RestartNode.

param.ExecuteOpCode (SR, ID 10)

See uavcan.protocol.param.ExecuteOpcode.

param.GetSet (SR, ID 11)

See uavcan.protocol.param.GetSet.

tunnel.Broadcast (BC, ID 2010)

See uavcan.tunnel.Broadcast.

This message appears to not yet have been finally released to the official standard. It is most important though, since it provides the backbone for the communication with the STorM32 controller via UAVCAN. The STorM32 essentially implements a UAVCAN-UART bridge which is based on exchanging these tunnel messages.

See also Uavcan.