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 IFM tile so it can access the ports to your SOMANET IFM device.

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 IFM 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 <CORE_C22-rev-a.bsp>   //Board Support file for SOMANET Core C22 device
    #include <IFM_DC100-rev-b.bsp>  //Board Support file for SOMANET IFM DC100 device
                                    //(select your board support files according to your device)
    
    #include <watchdog_service.h> // 2
    
    WatchdogPorts wd_ports = SOMANET_IFM_WATCHDOG_PORTS; // 3
    
    int main(void) {
    
        interface WatchdogInterface i_watchdog[2]; // 4
    
        par
        {
            on tile[APP_TILE]: i_watchdog[0].start(); // 6
    
            on tile[IFM_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.

out port p_tick

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

port p_cpld_shared

Service

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

Service to manage the watchdog chip within your IFM SOMANET 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.

int status(void)

send the status of WD service to the client (ACTIVE/INACTIVE)

void start(void)

Initialize and starts ticking the watchdog.

void stop(void)

Stops ticking the watchdog.

Therefore, any output through the phases is disabled.

void protect(int fault_id)

on any detected fault.

Any output through the phases will be disabled.

void reset_faults()

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

Functions

Function to blink red LED on your IFM SOMANET 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.
  • IFM_module_type – Type of the IFM board used to properly handle the ports.
  • output – Value to be written to the shared LED port
  • times – Internal blinking counter
  • delay_counter – External counter incrementing every WD clock cycle