Watchdog Module

This module provides a Service that will manage the Watchdog on your SOMANET device. Up to 2 clients could control the Service through an interface.

When running the Watchdog Service, the Reference Frequency of the tile where the Service is allocated will be automatically changed to 250MHz.

The Watchdog Service should always run over an IF2 tile so it can access the ports to your SOMANET Drive module.

How to use

Important

We assume that you are using SOMANET Base and your app includes the required board support files for your SOMANET device.

  1. First, add all the SOMANET Motion Control modules to your app Makefile.

    USED_MODULES = module_watchdog module_pwm module_adc module_controllers module_hall_sensor module_utils lib_bldc_torque_control module_profiles module_incremental_encoder module_board-support
    

    Note

    Not all modules will be required, but when using a library it is recommended to include always all the contained modules. This will help solving internal dependency issues.

  2. Include the Watchdog Service header watchdog_service.h in your app.

  3. Instantiate the ports where the Service will be accessing the ports of the watchdog chip.

  4. Inside your main function, instantiate the interfaces array for the Service-Clients communication.

  5. At your IF2 tile, instantiate the Service.

  6. At whichever other core, now you can perform calls to the Watchdog Service through the interfaces connected to it.

    #include <CoreC2X.bsp>                          //Board Support file for SOMANET Core C2X device
    #include <Drive1000-rev-c4.bsp>     //Board Support file for SOMANET Drive module
                                        //(select your board support files according to your device)
    #include <watchdog_service.h> // 2
    
    WatchdogPorts wd_ports = SOMANET_DRIVE_WATCHDOG_PORTS; // 3
    
    int main(void) {
    
        interface WatchdogInterface i_watchdog[2]; // 4
    
        par
        {
            on tile[APP_TILE]: i_watchdog[0].start(); // 6
    
            on tile[IF2_TILE]: watchdog_service(wd_ports, i_watchdog); // 5
        }
    
        return 0;
    }
    

API

Types

WatchdogPorts

Structure type for Watchdog Service ports.

Structure Members:

out port p_shared_enable_tick_led

4-bit Port for Watchdog basic management.

port p_diag_enable

Nullable] Bidirectional port for Diagnostic and enable.

out port p_tick

[Nullable] Port for the periodic tick signal (if applicable in your SOMANET device).

port p_cpld_shared
port p_cpld_fault_monitor

Service

[[combinable]] void watchdog_service(WatchdogPorts &watchdog_ports, interface WatchdogInterface server i_watchdog[2], int tile_usec)

Service to manage the watchdog chip within your SOMANET Drive device.

Parameters:
  • watchdog_ports – Ports structure defining watchdog chip HW access.
  • i_watchdog – Array of communication interfaces to handle up to 2 different clients.

Interface

interface WatchdogInterface

Interface type to communicate with the Watchdog Service.

void protect(int fault_id)

reacts on any detected fault.

Any output through the phases will be disabled.

void reset_faults()

resets the state of fault in watchdog service, and starts the watchdog from the beginning

WatchdogError read_fault_monitor()

read the fault monitor led

void protect(int fault_id)

reacts on any detected fault.

Any output through the phases will be disabled.

void reset_faults()

resets the state of fault in watchdog service, and starts the watchdog from the beginning

WatchdogError read_fault_monitor()

read the fault monitor led

Functions

Function to blink red LED on your SOMANET Drive devices to signal different types of faults.

Parameters:
  • fault – Fault ID, i.e., number of times to blink followed by a pause.
  • period – Red LED on/off period
  • watchdog_ports – Ports structure defining watchdog chip HW access.
  • drive_module_type – Type of the Drive board used to properly handle the ports.
  • output – Value to be written to the shared LED port
  • output_cpld – Value to be written to the shared LED port for cpld boards
  • times – Internal blinking counter
  • delay_counter – External counter incrementing every WD clock cycle