TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (137095 times)
  2. FAT32 Library (70236 times)
  3. Network Ethernet Library (56122 times)
  4. USB Device Library (46434 times)
  5. Network WiFi Library (42071 times)
  6. FT800 Library (41384 times)
  7. GSM click (29112 times)
  8. mikroSDK (26561 times)
  9. PID Library (26489 times)
  10. microSD click (25486 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Watchdog click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.9

mikroSDK Library: 2.0.0.0

Category: RTC

Downloaded: 68 times

Not followed.

License: MIT license  

Watchdog Click is a compact add-on board that contains a simple countdown timer for a wide variety of applications. This board features the TPS3430, a standalone watchdog timer with a programmable watchdog window and programmable reset delay from Texas Instruments.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Watchdog click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Watchdog click" changes.

Do you want to report abuse regarding "Watchdog click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


Watchdog click

Watchdog Click is a compact add-on board that contains a simple countdown timer for a wide variety of applications. This board features the TPS3430, a standalone watchdog timer with a programmable watchdog window and programmable reset delay from Texas Instruments.

watchdog_click.png

click Product page


Click library

  • Author : Stefan Ilic
  • Date : Sep 2021.
  • Type : GPIO type

Software Support

We provide a library for the Watchdog Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Watchdog Click driver.

Standard key functions :

  • watchdog_cfg_setup Config Object Initialization function.

    void watchdog_cfg_setup ( watchdog_cfg_t *cfg );
  • watchdog_init Initialization function.

    err_t watchdog_init ( watchdog_t *ctx, watchdog_cfg_t *cfg );
  • watchdog_default_cfg Click Default Configuration function.

    err_t watchdog_default_cfg ( watchdog_t *ctx );

Example key functions :

  • watchdog_set_set0 Set S0 ( RST ) pin state function.

    void watchdog_set_set0 ( watchdog_t *ctx, uint8_t set0_state );
  • watchdog_get_wdo Get WDO ( INT ) pin state function.

    uint8_t watchdog_get_wdo ( watchdog_t *ctx );
  • watchdog_send_pulse Send pulse function.

    void watchdog_send_pulse ( watchdog_t *ctx, uint16_t p_duration_ms );

Example Description

This is an example that demonstrates the use of the Watchdog click board.

The demo application is composed of two sections :

Application Init

Initialization driver enables - GPIO, configure the watchdog window, enable watchdog, also write log.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    watchdog_cfg_t watchdog_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    watchdog_cfg_setup( &watchdog_cfg );
    WATCHDOG_MAP_MIKROBUS( watchdog_cfg, MIKROBUS_1 );
    if ( DIGITAL_OUT_UNSUPPORTED_PIN == watchdog_init( &watchdog, &watchdog_cfg ) ) {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }
    watchdog_default_cfg ( &watchdog );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "   Configure of the  \r\n" );
    log_printf( &logger, "   watchdog window   \r\n" );
    watchdog_setup_time( &watchdog, WATCHDOG_SETUP_TIME_MODE_2 );
    Delay_ms ( 1000 );

    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, "   Watchdog enabled  \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms ( 1000 );

    log_info( &logger, " Application Task " );
}

Application Task

In the first part of the example, we send pulses in a valid time window (Correct Operation). The second part of the example sends pulses outside the valid time window and then the watchdog detects a fault condition, display "Fault", performs the reset and turn on the LED ( WDT FLT ) on the Watchdog click board. Results are being sent to the Usart Terminal where you can track their changes.


void application_task ( void ) 
{
    log_printf( &logger, "  Correct Operation  \r\n" );
    uint8_t n_cnt = 40;
    while ( n_cnt > 0 ) {
        watchdog_send_pulse( &watchdog, 1 );
        Delay_ms ( 50 );
        n_cnt--;
    }
    log_printf( &logger, "---------------------\r\n" );

    log_printf( &logger, "        Fault        \r\n" );
    n_cnt = 8;
    while ( n_cnt > 0 ) {
        watchdog_send_pulse( &watchdog, 1 );
        Delay_ms ( 250 );
        n_cnt--;
    }
    log_printf( &logger, "---------------------\r\n" );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Watchdog

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

CAN Isolator 2 click

0

CAN Isolator 2 Click is a compact add-on board that provides isolated CAN communication. This board features the ISO1042, an isolated CAN transceiver from Texas Instruments. This galvanically-isolated CAN transceiver meets the ISO11898-2 specifications and offers a +/-70V DC bus fault protection, along with the +/-30V of common mode voltage range. The transceiver supports two CAN modes, with speeds of up to 1Mbps in Classic CAN and flexible data rate (FD) CAN, which allows much faster transfer of payload compared to the classic CAN with up to 5Mbps.

[Learn More]

9DOF 3 click

0

9DOF 3 Click introduces the BMX055, a small-scale absolute orientation sensor in the class of low-noise 9-axis measurement units, from Bosch Sensortec. It comprises the full functionality of a triaxial, low-g acceleration sensor, a triaxial angular rate sensor and a triaxial geomagnetic sensor. All three sensor components of the BMX055 can be operated and addressed independently from each other. On top, the BMX055 integrates a multitude of features that facilitate its use especially in the area of motion detection applications, such as device orientation measurement, gaming, HMI or menu browser control. 9DOF 3 Click offers both SPI and I2C digital interfaces for easy and fast system integration.

[Learn More]

ROTARY B click

0

Rotary B click carries a 15-pulse incremental rotary encoder with detents, surrounded by a ring of 16 blue LEDs. It’s a perfect solution for adding a precision input knob to your design. The encoder outputs A and B signals (out of phase to each other); the knob also acts as a push-button which sends an interrupt to the target board MCU. The LED ring is controlled through SPI lines (CS, SCK, MISO, MOSI). Rotary click™ can be used with either a 3.3V or 5V power supply.

[Learn More]