Canandmag Faults

CanandmagFaults are a series of flags sent with the Helium Canandmag’s status frame that indicate if the device is experiencing an issue. This API presents faults in two formats: active and sticky faults.

Active faults are updated every time a status frame is sent, and thus if an issue is resolved it will update the fault flag accordingly. This is useful for issues that can be transient, such as undervoltage faults (which occurs during a brownout)

Sticky faults do not automatically clear when set to true. For example, if a Helium Canandmag briefly undervolts, due to a brownout, but normal power is later restored, the undervoltage fault will still be set to true. Sticky faults must be cleared by the user.

Fetching Faults

//Get a canandmag object with CAN ID 0
Canandmag canandmag = new Canandmag(0);

//Fetch this canandmag's active faults
Canandmag.Faults faults = canandmag.getActiveFaults();

//Fetch this canandmag's sticky faults
Canandmag.Faults sticky = canandmag.getStickyFaults();
using namespace redux::sensors::canandmag;
//Get a canandmag object with CAN ID 0
Canandmag canandmag{0};

//Fetch this canandmag's active faults
CanandmagFaults faults = canandmag.GetActiveFaults();

//Fetch this canandmag's sticky faults
CanandmagFaults sticky = canandmag.GetStickyFaults();
How to clear sticky faults
canandmag.clearStickyFaults();
canandmag.ClearStickyFaults();

Types Of Faults

Power Cycle

The power cycle fault flag, which is set to true when the encoder first boots. Clearing sticky faults on initialization and then checking this flag can be used to determine if the encoder rebooted.

CAN ID Conflict

The CAN ID Conflict flag is set to true when the device detects another device with the same CAN ID. While available in the API, you should check the physical device for the LED flashing blue (which indicates a detected CAN ID conflict). Alchemist should be used to configure the different devices to avoid CAN ID conflicts.

CAN General Error

The CAN general error flag, which will raise if the device encounters a CAN fault during operation. If communication with the device still functions, this will not register as an active fault for long if at all. This may raise due to wiring issues, such as an intermittently shorted CAN bus.

Out Of Temperature Range

The Out Of Temperature Range flag is set to true if the encoder detects its temperature is outside the safe operating range of 0-70 degrees Celsius. This is a potential problem if the motor is operating in very close physical proximity to a motor, such as mounted on its casing or the front plate where heat is generally dissipated. Otherwise it is unlikely to see this error during normal use.

Hardware Fault

A Hardware Fault indicates the device has detected a problem during operation. For the Helium Canandmag, this generally will indicate that the device is unable to communicate with the on board magnetic field sensors.

Magnet Out Of Range

The Magnet Out Of Range fault is set to true if the device is unable to detect the magnet that it is supposed to be reading. This flag will always match the encoder’s LED being set to a red color (which indicates no detected magnet). Most often, this is due to the magnet being too far away from the surface of the encoder.

Undervolt

The Undervolt flag is set to true if the device detects an undervoltage (brownout) condition during operation. As a note, this fault very rarely trips, as a severe undervoltage condition that can cause this fault is likely to also reset the encoder (see: Power Cycle fault)