Infineon XMC7000 Series Using Manual

Infineon XMC7000 Series Using Manual

Using the watchdog timer
Hide thumbs Also See for XMC7000 Series:

Advertisement

Quick Links

AN233887
Using the Watchdog Timer in XMC7000 family
MCUs

About this document

Scope and purpose
This application note describes how to handle the watchdog timer in XMC7000 family MCUs. It introduces the
functions of the basic watchdog timer and multi-counter watchdog timer and the necessary configurations to
generate faults, interrupts, and reset.
Intended audience
This document is intentded for anyone using XMC7000 family MCUs.

Table of contents

About this document ....................................................................................................................... 1
Table of contents ............................................................................................................................ 1
1
Introduction .......................................................................................................................... 3
2
Basic WDT .............................................................................................................................. 4
2.1
Source clock ............................................................................................................................................ 5
2.2
WDT timer counter .................................................................................................................................. 5
2.3
Register protection .................................................................................................................................. 5
2.4
Warning interrupt .................................................................................................................................... 5
2.5
Timeout mode ......................................................................................................................................... 6
2.6
Window mode .......................................................................................................................................... 7
2.7
Basic WDT settings .................................................................................................................................. 7
2.7.1
Use case .............................................................................................................................................. 8
2.7.2
Configuring the Basic WDT ................................................................................................................ 9
2.8
Clearing the basic WDT ......................................................................................................................... 11
2.8.1
Use case ............................................................................................................................................ 12
2.8.2
Example flow to clear the basic WDT .............................................................................................. 12
2.9
Reset cause indication for the basic WDT ............................................................................................ 12
2.10
Basic WDT registers ............................................................................................................................... 13
3
Multi-counter WDT ................................................................................................................ 14
3.1
Source clock .......................................................................................................................................... 14
3.2
Register protection in MCWDT .............................................................................................................. 14
3.3
MCWDT interrupts ................................................................................................................................. 15
3.3.1
Pre-warning interrupt ...................................................................................................................... 15
3.3.2
MCWDT Subcounter 2 interrupt ....................................................................................................... 15
3.4
Timeout mode ....................................................................................................................................... 15
3.5
Window mode ........................................................................................................................................ 16
3.6
Selecting the CPU .................................................................................................................................. 17
3.7
MCWDT settings ..................................................................................................................................... 17
3.7.1
Use case ............................................................................................................................................ 18
3.7.2
Configuring the MCWDT ................................................................................................................... 19
Application Note
www.infineon.com
Please read the Important Notice and Warnings at the end of this document
page 1 of 33
002-33887 Rev. *A
2022-05-25

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the XMC7000 Series and is the answer not in the manual?

Questions and answers

Summary of Contents for Infineon XMC7000 Series

  • Page 1: Table Of Contents

    Selecting the CPU ..........................17 MCWDT settings ............................. 17 3.7.1 Use case ............................18 3.7.2 Configuring the MCWDT ........................19 Application Note Please read the Important Notice and Warnings at the end of this document 002-33887 Rev. *A www.infineon.com page 1 of 33 2022-05-25...
  • Page 2 Using the Watchdog Timer in XMC7000 family MCUs Table of contents Clearing the MCWDT ..........................22 3.8.1 Use case ............................22 3.8.2 Example flow to clear the MCWDT ....................22 3.8.3 Example program to clear the MCWDT ................... 24 MCWDT fault handling ........................... 24 3.9.1 Use case ............................
  • Page 3: Introduction

    Using the Watchdog Timer in XMC7000 family MCUs Introduction Introduction This application note describes the watchdog timer (WDT) for the XMC7000 family MCU. A WDT detects an unexpected firmware execution path by generating warning interrupts, faults, or resets. It allows the system to recover from an unsafe execution of an application program.
  • Page 4: Basic Wdt

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Basic WDT Figure 2 shows the block diagram of the Basic WDT. It supports one 32-bit free-running counter that counts up with the ILO0 clock if the ENABLE [31] bit is set to ‘1’ in the WDT_CTL register. Operation during Hibernate mode is possible because the WDT logic and ILO0 are supplied by the external high- voltage supply (V ).
  • Page 5: Source Clock

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT watchdog servicing timing to fulfill the window timing conditions. If the LOWER_ACTION bit is not set, the Basic WDT can be serviced anytime before the UPPER_LIMIT value is reached. Source clock The source clock that can be selected for the Basic WDT is fixed to the ILO0 clock: 32.768 kHz.
  • Page 6: Timeout Mode

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Figure 3 illustrates an example for a 500-milliseconds periodic wakeup timing with auto servicing activated. The calculation is done using the following equation: ��������_���������� = 32768 ���� × 500 ���� = 16384 = 0��00004000 Counts value 0xFFFFFFFF WARN_LIMIT = 0x4000...
  • Page 7: Window Mode

    This section describes how to configure the WDT based on a use case using the ModusToolbox™ CAT1 Peripheral Driver Library provided by Infineon. The code snippets in this application note are part of the ModusToolbox™ CAT1 Peripheral Driver Library. See Other references.
  • Page 8: Use Case

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Figure 5 shows an example flow to configure the basic WDT. Basic Watchdog Timer Setting Disable Basic Watchdog Timer Unlock Basic Watchdog Timer Registers Set LOWER_LIMIT Set UPPER_LIMIT Set WARN_LIMIT Set LOWER_ACTION Set UPPER_ACTION Set WARN_ACTION...
  • Page 9: Configuring The Basic Wdt

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Window mode: Used • Warn interrupt: Used (IRQ number: 2) • Auto service: Unused • Debugger configuration: Enables the trigger input for WDT to pause the counter during debug mode •...
  • Page 10 Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Code Listing 1 Example of basic WDT configuration using Hardware Abstraction Layer (HAL) void initialize_wdt() cy_rslt_t result; /* Initialize the WDT */ result = cyhal_wdt_init(&wdt_obj, WDT_TIME_OUT_MS); /* WDT initialization failed. Stop program execution */ if (result != CY_RSLT_SUCCESS) CY_ASSERT(0);...
  • Page 11: Clearing The Basic Wdt

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Clearing the basic WDT Clearing the basic WDT is performed by setting the SERVICE[0] bit to ‘1’ in the SERVICE register. The firmware must consider reading this bit until it is ‘0’ before writing ‘1’ to this bit. Servicing of the basic WDT counter must be done regularly to ensure a stable software flow.
  • Page 12: Use Case

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT Counts value 0xFFFFFFFF UPPER_LIMIT = 0x8000 SERVICE SERVICE SERVICE Sequence 1: Sequence 2: Sequence 3: 750ms 250ms 450ms 125ms LOWER_LIMIT = 0x1000 Time 100ms 300ms 200ms 150ms 100ms 150ms 100ms 150ms 200ms 100ms 300ms...
  • Page 13: Basic Wdt Registers

    Using the Watchdog Timer in XMC7000 family MCUs Basic WDT 2.10 Basic WDT registers Table 2 Basic WDT registers Name Description WDT_CTL Watchdog Counter Control Register WDT_LOWER_LIMIT WDT Lower Limit Register WDT_UPPER_LIMIT WDT Upper Limit Register WDT_WARN_LIMIT WDT Warn Limit Register WDT_CONFIG WDT Configuration Register WDT_CNT...
  • Page 14: Multi-Counter Wdt

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Multi-counter WDT The MCWDT includes three subcounters: Subcounters 0, 1, and 2. Subcounter 0 and Subcounter 1 are 16-bit counters, which behave like the basic WDT. Window mode and pre- warning interrupts are supported.
  • Page 15: Mcwdt Interrupts

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Subcounter 0 and Subcounter 1: CTL, LOWER_LIMIT, UPPER_LIMIT, WARN_LIMIT, CONFIG, SERVICE, and CNT registers MCWDT_LOCK = 1 • MCWDT_LOCK = 2 • To protect the MCWDT registers, one single write access to the LOCK register is required: MCWDT_LOCK = 3 •...
  • Page 16: Window Mode

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT The UPPER_ACTION[1:0] bit field in the CONFIG register specifies how a FAULT is handled: No action is taken • Generate only a FAULT to be handled by the FAULT structures •...
  • Page 17: Selecting The Cpu

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Selecting the CPU In a multi-CPU system, you should assign one MCWDT to a dedicated CPU to select the SLEEPDEEP for controlling the counter behavior in the respective CPU low-power mode. The counter pauses while the respective CPU is in a low-power mode if the SLEEPDEEP_PAUSE[30] bit is set to ‘1’...
  • Page 18: Use Case

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT MCWDT Setting Configure MCWDT Parameters Clear Fault Status Enable Fault MCWDT Configure Fault Enable Fault Interrupt Setup Interrupt System Interrupt Control Configure Interrupt Configure NVIC Priority Register Configure Interrupt Priority Enable Interrupt Enable NVIC Interrupt Controller De-initialize MCWDT...
  • Page 19: Configuring The Mcwdt

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Deep Sleep Pause: Enable − Debug mode: Enable − Subcounter 1: Same as Subcounter 0 • Subcounter 2: • Action: Interrupt − Auto service: Enable − Deep Sleep Pause: Enable −...
  • Page 20 Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Code preview: This code is auto-generated after the configuration in the Device Configurator. Code Listing 2 shows an example program of the MCWDT configuration part. For details of the interrupt and initial fault setting procedure, see the “Interrupt and Fault Report Structure”...
  • Page 21 Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Code Listing 2 Example program to configure MCWDT /* Enable global interrupts */ __enable_irq(); /* Initialize retarget-io to use the debug UART port */ result = cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX, CY_RETARGET_IO_BAUDRATE); /* retarget-io initialization failed. Stop program execution */ (result != CY_RSLT_SUCCESS) handle_error();...
  • Page 22: Clearing The Mcwdt

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Code Listing 2 Example program to configure MCWDT Cy_GPIO_Inv(CYBSP_USER_LED1_PORT, CYBSP_USER_LED1_PIN); if(MCWDT_INTR_MASKED_CTR1_INT_Msk & masked) Cy_GPIO_Inv(CYBSP_USER_LED2_PORT, CYBSP_USER_LED2_PIN); if(MCWDT_INTR_MASKED_CTR2_INT_Msk & masked) Cy_GPIO_Inv(CYBSP_USER_LED3_PORT, CYBSP_USER_LED3_PIN); Cy_MCWDT_ClearInterrupt(MCWDT_0_HW, masked); Clearing the MCWDT Clearing the MCWDT is performed by setting the CTR0_SERVICE[0] bit to ‘1’ for Subcounter 0 and the CTR1_SERVICE[1] bit to ‘1’...
  • Page 23 Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT Figure 11 Example flow to clear the MCWDT Application Note 23 of 33 002-33887 Rev. *A 2022-05-25...
  • Page 24: Example Program To Clear The Mcwdt

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT 3.8.3 Example program to clear the MCWDT Code Listing 3 shows an example program to clear the MCWDT. Code Listing 3 Example program to clear the MCWDT int main(void) for(;;) Cy_MCWDT_Unlock(MCWDT_0_HW);...
  • Page 25: Example Flow Of Mcwdt Fault Handler

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT 3.9.2 Example flow of MCWDT fault handler Figure 12 shows an example flow of the MCWDT fault handler. Fault Report Handler Read Fault Status Is there any Fault in MCWDT? Subcounter 0 Lower Limit Fault? Subcounter 0 Upper Limit Fault? Subcounter 0 Lower Limit Fault Handling...
  • Page 26: Reset Cause Indication For Mcwdt

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT 3.10 Reset cause indication for MCWDT If the MCWDT counter is not serviced or serviced too early, a system reset can be issued after the FAULT is not handled in time. When the device comes out of reset, it is useful to know the cause of the reset. Reset causes are recorded in the RES_CAUSE register.
  • Page 27: Mcwdt Registers

    Using the Watchdog Timer in XMC7000 family MCUs Multi-counter WDT 3.11 MCWDT registers Table 4 MCWDT registers Name Description MCWDTx_CTRy_CTL MCWDT Subcounter 0/1 Control Register MCWDTx_CTRy_LOWER_LIMIT MCWDT Subcounter 0/1 Lower Limit Register MCWDTx_CTRy_UPPER_LIMIT MCWDT Subcounter 0/1 Upper Limit Register MCWDTx_CTRy_WARN_LIMIT MCWDT Subcounter 0/1 Warn Limit Register MCWDTx_CTRy_CONFIG MCWDT Subcounter 0/1 Configuration Register...
  • Page 28: Debug Support

    Using the Watchdog Timer in XMC7000 family MCUs Debug support Debug support Both types of WDTs support different debug modes. The configuration is done with the DEBUG_TRIGGER_ENABLE[28] and DEBUG_RUN[31] bits, which are both located in the related CONFIG register for basic WDT and MCWDT. The WDT reset request is blocked during debug modes, while debugging through MCWDT reset is possible using breakpoints during debug modes.
  • Page 29: Definitions, Acronyms, And Abbreviations

    Using the Watchdog Timer in XMC7000 family MCUs Definitions, acronyms, and abbreviations Definitions, acronyms, and abbreviations Table 6 Definitions, acronyms, and abbreviations Terms Definitions Advanced High-performance Bus Central Processing Unit CPUSS CPU subsystem High-frequency crystal oscillator ILO0 32-kHz internal low-speed oscillator Interrupt request Interrupt Service Routine kilohertz...
  • Page 30: Related Documents

    Using the Watchdog Timer in XMC7000 family MCUs Related documents Related documents The following are the XMC7000 family series datasheets and technical reference manuals. Contact Technical support to obtain these documents. Device datasheet • Datasheet 32-Bit Arm® Cortex®-M7 Microcontroller XMC7100 Family (Doc No. 002-33896) −...
  • Page 31: Other References

    Using the Watchdog Timer in XMC7000 family MCUs Other references Other references Infineon provides the ModusToolbox™ CAT1 Peripheral Driver Library including the initialization code as sample software to access various peripherals. Code snippets in this application note are part of the ModusToolbox™ CAT1 Peripheral Driver Library. Contact Technical support to obtain the ModusToolbox™...
  • Page 32: Revision History

    Using the Watchdog Timer in XMC7000 family MCUs Revision history Revision history Document Date of release Description of changes version 2021-12-08 Initial release. 2022-05-25 Updated the code listing. Application Note 32 of 33 002-33887 Rev. *A 2022-05-25...
  • Page 33 Infineon Technologies hereby disclaims dangerous substances. For information on the types © 2022 Infineon Technologies AG. any and all warranties and liabilities of any kind in question please contact your nearest Infineon All Rights Reserved. (including without limitation warranties of non- Technologies office.

This manual is also suitable for:

Xmc7100 seriesXmc7200 series

Table of Contents