watchdog 2.0.0.0
Main Page

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.

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 :

Example key functions :

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;
watchdog_cfg_t watchdog_cfg;
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" );
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 " );
}
#define WATCHDOG_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition watchdog.h:93
#define WATCHDOG_SETUP_TIME_MODE_2
Definition watchdog.h:75
void watchdog_setup_time(watchdog_t *ctx, uint8_t setup_time_mode)
Set the watchdog time function.
void application_init(void)
Definition main.c:34

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" );
}
void application_task(void)
Definition main.c:77

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.