Fault Management

CANSense Encoder Fault System

The CANSense encoder implements a comprehensive fault detection and reporting system to help diagnose and troubleshoot issues with your encoder hardware and communication.

Overview

The fault system uses "sticky faults" - these are fault conditions that remain set until explicitly cleared, allowing you to detect intermittent issues that might otherwise go unnoticed. All fault data is transmitted via CAN bus as part of the boolean status byte.

Available Fault Types

Hardware Fault

Method: getStickyFault_Hardware() Description: Indicates a hardware-level issue with the encoder itself.

This fault is triggered when the encoder detects internal hardware problems such as:

  • Power supply issues

  • Internal component failures

  • Temperature-related problems

Troubleshooting:

  • Check power supply voltage and stability

  • Verify proper grounding

  • Ensure operating temperature is within specifications

  • Contact support if fault persists

Boot During Enable Fault

Method: getStickyFault_BootDuringEnable() Description: Indicates the encoder attempted to boot or restart while the system was enabled.

This typically occurs when:

  • Power was interrupted during operation

  • The encoder experienced a watchdog reset

  • Firmware crashed and restarted

Troubleshooting:

  • Check for power supply interruptions

  • Verify CAN bus termination and wiring

  • Monitor for electrical noise or interference

Loop Overrun Fault

Method: getStickyFault_LoopOverrun() Description: The encoder's internal processing loop took longer than expected to complete.

This can indicate:

  • High CAN bus traffic causing delays

  • Internal processing bottlenecks

  • Timing issues in the encoder firmware

Troubleshooting:

  • Reduce CAN bus utilization if possible

  • Check for other devices flooding the CAN bus

  • Verify CAN bus baud rate settings

Momentary CAN Bus Loss Fault

Method: getStickyFault_MomentaryCanBusLoss() Description: Temporary loss of CAN bus communication was detected.

Common causes include:

  • Loose CAN bus connections

  • Electrical interference

  • Bus-off conditions due to excessive errors

  • Improper termination

Troubleshooting:

  • Inspect all CAN bus connections

  • Verify proper 120Ω termination at both ends

  • Check for damaged or poor-quality cables

  • Look for sources of electrical interference

Bad Magnet Fault

Method: getStickyFault_BadMagnet() Description: The magnetic field strength is outside acceptable parameters.

This occurs when:

  • Magnet is too far from the sensor

  • Magnet is damaged or demagnetized

  • Foreign material interferes with the magnetic field

  • Mechanical misalignment exists

Troubleshooting:

  • Check magnet-to-sensor distance (typically 1-3mm)

  • Verify magnet is properly centered

  • Inspect for metal debris or contamination

  • Replace magnet if damaged

  • Ensure proper mechanical alignment

General CAN Fault

Method: getStickyFault_CANGeneral() Description: General CAN communication issues detected.

This encompasses various CAN-related problems:

  • Bus-off conditions

  • High error rates

  • Protocol violations

  • Communication timeouts

Troubleshooting:

  • Check CAN bus wiring and termination

  • Verify baud rate matches all devices

  • Monitor for excessive error frames

  • Inspect for electrical noise sources

Fault Management

Checking Fault Status

// Check individual faults
if (encoder.getStickyFault_Hardware()) {
    System.out.println("Hardware fault detected!");
}

if (encoder.getStickyFault_BadMagnet()) {
    System.out.println("Magnet alignment issue!");
}

// Check system status
if (encoder.getBooleanStatus8_SystemReady()) {
    System.out.println("System is ready for operation");
} else {
    System.out.println("System not ready - check for faults");
}

Clearing Faults

All sticky faults can be cleared simultaneously using the reset method:

// Clear all sticky faults
encoder.resetStickyFaults();

{% hint style="warning" %} Important: Only clear faults after addressing the underlying cause. Clearing faults without fixing the root problem may mask ongoing issues. {% endhint %}

Diagnostic Workflow

1. Initial Fault Check

Always check for faults during system initialization:

// Check if system is ready
if (!encoder.getBooleanStatus8_SystemReady()) {
    // System not ready, check for specific faults
    checkAllFaults();
}

2. Periodic Monitoring

Implement periodic fault checking in your main loop:

public void periodic() {
    // Check for any new faults
    if (encoder.getStickyFault_Hardware() || 
        encoder.getStickyFault_BadMagnet() ||
        encoder.getStickyFault_CANGeneral()) {
        
        // Handle fault condition
        handleFaultCondition();
    }
}

3. Fault Resolution

Follow this general process for fault resolution:

  1. Identify - Determine which specific faults are active

  2. Diagnose - Use the troubleshooting guides above

  3. Fix - Address the root cause

  4. Clear - Reset sticky faults using resetStickyFaults()

  5. Verify - Confirm the fault doesn't reappear

Best Practices

Fault Logging

Consider implementing comprehensive fault logging:

private void logFaultStatus() {
    if (encoder.getStickyFault_Hardware()) {
        logger.error("Hardware fault on encoder " + encoder.getDeviceID());
    }
    
    if (encoder.getStickyFault_BadMagnet()) {
        logger.warning("Magnet fault on encoder " + encoder.getDeviceID());
    }
    
    // Log other faults as needed
}

Graceful Degradation

Design your system to handle fault conditions gracefully:

public boolean isEncoderHealthy() {
    return encoder.getBooleanStatus8_SystemReady() &&
           !encoder.getStickyFault_Hardware() &&
           !encoder.getStickyFault_BadMagnet();
}

public void operateWithFaultTolerance() {
    if (isEncoderHealthy()) {
        // Normal operation
        useEncoderData();
    } else {
        // Fault condition - use backup or safe mode
        useFallbackSensors();
    }
}

Preventive Maintenance

Regular checks can prevent many fault conditions:

  • Weekly: Visual inspection of connections and mounting

  • Monthly: Magnet alignment and gap measurement

  • Quarterly: CAN bus signal quality analysis

  • Annually: Complete system calibration and testing

{% hint style="info" %} Debug Mode: Enable debug mode during development to see detailed fault information in the console output. {% endhint %}

Troubleshooting Matrix

Fault Type
Primary Cause
Quick Check
Solution

Hardware

Power/Temperature

Check voltage, temperature

Verify power supply, cooling

Boot During Enable

Power interruption

Check power stability

Improve power filtering

Loop Overrun

CAN bus overload

Monitor bus utilization

Reduce CAN traffic

CAN Bus Loss

Connection issue

Wiggle connections

Secure all connections

Bad Magnet

Mechanical alignment

Measure gap/alignment

Adjust mounting

General CAN

Various CAN issues

Check termination

Verify bus configuration

Support and Further Help

If faults persist after following the troubleshooting steps:

  1. Enable debug mode for detailed diagnostic output

  2. Document the specific fault patterns and conditions

  3. Check for firmware updates

  4. Contact technical support with fault logs and system configuration

Last updated