1.. zephyr:code-sample:: esp32-xt-wdt 2 :name: XTAL32K Watchdog Timer (WDT) 3 4 Trigger watchdog interrupt on external 32K crystal failure. 5 6Overview 7******** 8 9This sample shows how to work with XTAL32K Watchdog Timer (XT WDT) peripheral. 10To properly run this sample, you need to have a board with an external 32.728 Hz 11crystal oscillator connected to the XTAL_32K_P and XTAL_32K_N pins. 12 13The app will ask for the crystal removal to simulate a crystal failure and trigger 14the XT WDT interrupt. Internally the hardware switch the RTC SLOW clock source from 15ESP32_RTC_SLOW_CLK_SRC_XTAL32K to ESP32_RTC_SLOW_CLK_SRC_RC_SLOW (136 KHz for C3 and S3 / 169 KHz for S2). 17 18Supported SoCs 19************** 20 21The following SoCs supports the XT WDT peripheral: 22 23* ESP32-C3 24* ESP32-S2 25* ESP32-S3 26 27Building and Running 28******************** 29 30Make sure you have your board connected over USB port and the external crystal is connected 31to pins XTAL_32K_P and XTAL_32K_N. 32 33.. code-block:: console 34 35 west build -p -b esp32s3_devkitm/esp32s3/procpu samples/boards/espressif/xt_wdt 36 west flash 37 38If using another supported Espressif board, replace the argument in the above 39command with a proper board name (e.g., ``esp32s2_saola``). 40 41Sample Output 42============= 43 44To check output of this sample, run ``west espressif monitor`` or any other serial 45console program (e.g., minicom, putty, screen, etc). 46This example uses ``west espressif monitor``, which automatically detects the serial 47port at ``/dev/ttyUSB0``: 48 49.. code-block:: console 50 51 $ west espressif monitor 52 53.. code-block:: console 54 55 *** Booting Zephyr OS build v3.6.0-3896-gb4a7f061524f *** 56 [00:00:01.287,000] <inf> xt_wdt_sample: XT WDT Sample on esp32s3_devkitm/esp32s3/procpu 57 [00:00:01.287,000] <inf> xt_wdt_sample: Current RTC SLOW clock rate: 32768 Hz 58 [00:00:01.287,000] <inf> xt_wdt_sample: Remove the external 32K crystal to trigger the watchdog 59 XT WDT callback 60 [00:00:03.554,000] <inf> xt_wdt_sample: Current RTC SLOW clock rate: 136000 Hz 61