Rp2040 watchdog. reason Logs the reason for the last reset.
Rp2040 watchdog There's an 8bit counter used to generate the "tick clock" used by the timer from the "reference clock" (usually the crystal. k. I want software that: Sets up a watchdog. 3 seconds. io/en/latest/rp2040. This is a countdown timer that can restart parts of the chip if it reaches zero. Enables the hardware watchdog timer with a delay value of delay_ms milliseconds. Both bits are zero for the case of a hardware reset. This timer will reset the device if it hasn’t been fed after a specified amount of time. I Thanks, interesting read. This enables a timer which will reboot the rp2040 if Watchdog::feed() does not get called for the configured period. The maximum time between resetting the watchdog counter is approximately 8. I can detect a watchdog reset easily enough via watchdog_caused_reboot (); and for RP2040 I could also determine if it was POR, Reset (RUN pin) toggle, or debugger reset by interrogating the VREG_AND_CHIP_RESET register set that is defined in the RP2040-specific 'hardware_regs' directory. The second stage of the bootloader (which lives at the beginning of the user's program) then runs after the Mar 15, 2022 · Is there another way to get a watchdog function on the Adafruit QTPy RP2040 using your arduino-pico library ? Dec 19, 2023 · Hello everyone, I am attempting to use a Raspberry Pi Pico W to send messages using MQTT. Changing the WDT time is an option, but being assured the "feed" essentially resets it to the initial time-out is also fine. If some code hangup blocks the reset, the watchdog will reset the Pico. May 9, 2025 · The RP2040 bootrom implements a sophisticated reboot mechanism using the system watchdog timer. Enables the hardware watchdog timer with a delay value of delay_ms milliseconds. func (*SPI Sep 15, 2022 · Am using Pico's, so rp2040's and played with it using MicroPython v1. The RP2040 has a built in HW watchdog Timer. The behavior reported here is seen on RP2040 only. Supporting functions for the Pico hardware watchdog timer. The issue is that it works for a while, then resets. This library is used in conjunction with the BlueMicro_HID library to create input devices like keyboards. They may provide additional help, guidance or inspiration -. scratch0 Scratch register. 8. scratch1 Apr 30, 2025 · The root cause is lightsleep turns off the ROSC. Watchdog Boot section of the RP2040 datasheet. mem32 [0x40058000] = machine. Note that on some platforms the watchdog timer cannot be disabled once it has been enabled. Jun 11, 2025 · WIZnet W55RP20 The W55RP20 is a System-in-Package solution integrating an Raspberry Pi RP2040 with 2 MB flash and the W5500 ethernet controller. Aug 6, 2023 · There are eight Scratch registers and the Pico SDK uses only some of them; the rest can be used for your own purposes. The circuit anticipates a pulse on the RP2040's WDT_WDI (Watch Dog Timer Watch Dog In) pin (aka GPIO21) e API documentation for the Rust `Watchdog` struct in crate `rp2040`. TO THE MAXIMUM EXTENT PERMITTED BY Nov 23, 2022 · https://arduino-pico. I am developing using VScode under Windows, using SDK V1. Currently on RP2040, RAISE mo Load the watchdog timer. There should be two ways to wake the microcontroller from that low-power-sleep mode Feb 12, 2024 · Some people abuse watchdog timer to cause a reboot. It says it runs on the rp2040 chip (as in it doesn't have its own dedicated hardware), I wonder if the whole rp2040 can crash rendering the watchdog useless. Oct 9, 2023 · Hi All, I am trying to implement my own MQTT bootloader for the RP2040. trunk README Timer_RP2040 Watchdog Module for the RP2040 platform Debt Technical Debt for this component is located here Register block Type Aliases CTRL Watchdog control\n The rst_wdsel register determines which subsystems are reset when the watchdog is triggered. reset () but I This sample application is a hello-world style application, it will print "Hello World" to the USB-CDC UART and flash the LED at 1 Hertz in a non-blocking fashion by making use of the on-board timer. RP2040 boot sequence ¶ The RP2040 datasheet separates the boot sequence into the "hardware-controlled" section which happens before the processors begin executing the bootrom, and the "processor-controlled" section during which processor cores 0 and 1 begin to execute the bootrom. —The maximum time on the RP2040 Watchdog appears to be 8,3 Seconds —it appears the watchdog cannot be disabled once started! —OTA upload is longer Nov 22, 2023 · MicroPython uses the native RP2040 watchdog and that appeared to work as I was expecting when I tested on a Pico. 19. This sequence ensures system stability and provides fallback mechanisms when the primary boot path fails. WDT (Watchdog timer) The RP2040 has a watchdog which is a countdown timer that can restart parts of the chip if it reaches zero. 0:00 - Greetings, administrivia, and Pickles the watchdog12:30 - Lecture plan13:00 - Overview of watchdog timer21:35 - Boot sequence25:25 - Watchdog demo cod Oct 15, 2024 · Proposed Features On Flight Controller V4c, we introduced the radiation tolerant watchdog timer from the OreSat C3 Flight Computer. " rp2040 datasheet, section 4. Hardware Watchdog Timer API Supporting functions for the Pico hardware watchdog timer. Apr 21, 2022 · Unfortunately my own attempts to use 'watchdog_reboot' to restart code already running in RAM have not been successful, so I can't really give advice on that. Feb 3, 2021 · 如果因为看门狗功能导致复位,上电后可以通过watchdog_caused_reboot判断复位源,通过watchdog_enable进行参数初始化,可以选择是否在DEBUG模式暂停,但是低功耗模式所有时钟都停了的时候他也不例外,通过定期的watchdog_update喂狗,可以不被狗咬,没有中断功能,也没有窗口喂狗 Oct 7, 2011 · Interestingly the Pico C SDK datasheet says 'watchdog_reboot' will "Define actions to perform at watchdog timeout", doesn't say it will do anything beyond that. Sep 2, 2024 · watchdog_timeout (Optional, string): The timeout to apply to the RP2040 watchdog (in seconds or milliseconds). mem32 [0x40058000] & ~ (1<<30) Dec 5, 2016 · Browse through hundreds of tutorials, datasheets, guides and other technical documentation to get started with Arduino products. RAISE is to raise a WatchDogTimeout exception when the timer expires, while RESET causes a hard reset of the board. I'll see if I can find my notes on what uses which and where, the code I used. Dec 2, 2014 · The watchdog can be used to reboot into SRAM. 7 in the RP2040 manual. The WatchDogTimer is used to restart the system when the Nov 26, 2023 · The problem i am facing is my device is getting in the gsm section and the rp2040 crashes and becomes unresponsive untill a manual reset is given, i have also implemented a watchdog timer in my code but when this crash happens the watchdog too fails to reset the device. With more online digging or spending some time perusing RP2040 datasheet it is possible to discover a much better method: use AIRCR Cortex-M0+ register (section 2. Examples whit Arduino nano RP2040 connect. Did watchdog_enable cause the last reboot? Perform additional checking along with watchdog_caused_reboot to determine if a watchdog timeout initiated by watchdog_enable caused the last reboot. \n The watchdog can be triggered in software. This allows for controlled system resets with the ability to pass parameters to the next boot cycle. An overview is presented in the 2. 1M-2M for application Nov 26, 2025 · watchdog – Watchdog Timer The watchdog module provides support for a Watchdog Timer. It's a custom board with 16M of flash. a TX and MOSI (if rp2040 is master) SCK: 2, 6, 18 SPI1 bus GPIO pins: SI : 8, 12 SO : 11, 15 SCK: 10, 14 No pin configuration is needed of SCK, SDO and SDI needed after calling Configure. Resume from sleep doesn't cause a reset. So unless something in MicroPython for the Pico W or Pico SDK is calling 'watchdog_update ()' I can't see any reason it wouldn't reset the RP2040. This method checks for a special value in watchdog scratch register 4 placed there by watchdog_enable. I have used the Watchdog to allow the Pi W to reset to a known state (it will be located outside in a protected but relatively inaccessible place. WDT. 4 days ago · class WDT – watchdog timer The WDT is used to restart the system when the application crashes and ends up into a non recoverable state. There are a couple of Serial Bootloaders for the Pico and RP2040 I am aware of and Google may turn up more. Apr 30, 2022 · # Stop/disable the RP2040 watchdog timer # 0x40058000 = WATCHDOG_CTRL register, bit 30 is the ENABLE bit machine. The watchdog_reboot () API appears to exist in the PicoSDK to perform such a reboot. Oct 1, 2021 · I'm looking for a method/function to be able to reset a Raspberry Pi Pico via programming, using the Pic's C SDK. For example, a watchdog is an important safety feature in the E-Vehicle charging controller with Raspberry Pi Pico-W RP2040 Nov 3, 2022 · the way I read the datasheet, the timer IS configurable. I have implemented the Over the Air Updates and Watch dog separately but the issue occurs when I try to have both of them. It obtains its clock source from the watchdog peripheral, you must enable the watchdog before using this peripheral. - adafruit/Adafruit_SleepyDog Aug 31, 2021 · You can probably use the watchdog timer for this. I suspect that this might not be enough on a RP2040 device since it has 2 cores so the Watchdog is used instead. Jul 5, 2021 · I would like to call watchdog_reboot, which is defined in ArduinoCore-mbed/cores/arduino/mbed/targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/rp2_common/hardware // Note, we have x2 here as the watchdog HW currently decrements twice per tick (errata RP2040-E1) Timer Peripheral The Timer peripheral on RP2040 consists of a 64-bit counter and 4 alarms. Note that on the RP2040, once this function has called, the hardware watchdog can _not_ be disabled. Set the watchdog counter back to its load value, making sure that the watchdog reboot will not be triggered for the configured period. When the watchdog timeout occurs the Power-On State Machine does not re-initialize it. Oct 2, 2023 · Your code needs to set up the watchdog, and continually reset it within the timeout interval. In the Raspberry Pi Pico or more precisely the RP2040, the watchdog has a 24-bit counter that decrements from a user defined value. When the device hangs for that period of time, it will reboot. TO THE MAXIMUM EXTENT PERMITTED BY Dec 24, 2023 · Hi All I have been using the Arduino Nano Rp2040 Connect for a project for a Solar Monitor / Home Automation System. Aug 19, 2025 · Below is a list of GPIO pins corresponding to SPI0 bus on the rp2040: SI : 0, 4, 17 a. 8 of the datasheet). Feb 24, 2023 · A RP2040 Library for controler-specific functions like setting up GPIOs, setting up and trigering a Watchdog Timer and rebooting. a RX and MISO (if rp2040 is master) SO : 3, 7, 19 a. Jan 14, 2025 · I am trying to determine the "reset reason" of RP2350 via register interrogation or some SDK function. See machine. Had a few bits of code that caused the Pico to freeze completely, will do some testing also. 1. Example usage: Nov 23, 2025 · Rp2040 A list of the 130 libraries in the architecture rp2040. func (*SPI This project was born to solve the low-power-sleep with watchdog and interrupt-awake problem on the RP2040 with a Raspberry Pi Pico. Arduino library to use the watchdog timer for system reset and low power sleep. 3 seconds before it reaches zero and reboots our device. readthedocs. ) However, this tick is also used by the watchdog hardware, and much of the SDK, so changing it from 1MHz might be "fraught. * * The RP-series microcontrollers have a built in HW watchdog Timer. Sets up an interrupt that can wake the microcontroller from a low-power-sleep mode. 7. Legal disclaimer notice TECHNICAL AND RELIABILITY DATA FOR RASPBERRY PI PRODUCTS (INCLUDING DATASHEETS) AS MODIFIED FROM TIME TO TIME ("RESOURCES") ARE PROVIDED BY RASPBERRY PI LTD ("RPL") "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. Disable the watchdog timer. For example, this can be used to restart the processor if the software running on it gets stuck in an infinite loop or similar. LOAD Load the watchdog timer. Platform and board information are passed to the CMake build via the PICO_PLATFORM and PICO_BOARD variables Aug 19, 2025 · Below is a list of GPIO pins corresponding to SPI0 bus on the rp2040: SI : 0, 4, 17 a. See section 4. After enabling, the application must “feed” the watchdog periodically to prevent it from expiring and resetting the system. Contribute to jnogues/RP2040nanoConnect development by creating an account on GitHub. 4. Define actions to perform at watchdog timeout By default the SDK assumes a 12MHz XOSC and sets the watchdog_start_ti See references, calls below. an individual read has taken place but the corresponding write has not), the ABORT status bit will clear prematurely, and subsequently the in-flight transfers will trigger a completion interrupt once they complete. Code of Conduct Yes, I agree Oct 20, 2023 · Arduino library to use the watchdog timer for system reset and low power sleep. Note that the doc needs a minor ediot, the parameter really is milli seconds, not microseconds. * For example, this can be used to restart the processor if the software running on it gets stuck in an infinite loop * or similar. A watchdog is a special timer which needs to be ‘kicked’ in a special way, otherwise the timer will run out and reset the system. Once started it cannot be stopped or reconfigured in any way. I have found that adding Feb 24, 2023 · A RP2040 Library for controler-specific functions like setting up GPIOs, Watchdog Timer and other hardware specific functions. Information persists through soft reset of the chip. The majority of examples are applicable to both RP2040 and RP2350 based boards, however certain examples that use chip-specific functionality will only build on that platform. Start the watchdog. This application utilises the RP2040 watchdog to perform the actual reset so that we can benefit from two-stage rebooting. This is useful to ensure the board has not crashed or locked up. This occurs because the PICO-SDK function _watchdog_enable () zero's sm_hw->wdsel bits for the ROSC and XOSC. The reset time is irregular (the best I have recorded is only 726 seconds). So far I have everything in place: 0-256b used for standard, unmodified Boot2. e. reason Logs the reason for the last reset. Presumably the 'for forever' loop holds it where it is until the watchdog does timeout. Apr 6, 2022 · The watchdog module has two modes, RAISE and RESET. The Counter is incremented once per microsecond. Triggers the watchdog. The maximum delay_ms allowed in this call is 8300, corresponding to 8. Some hook up additional hardware to try to force a reset signal and so on and so forth. html#hardware-watchdog has the built in calls. Aug 18, 2012 · On Cortex-M* devices, a local reset can be accomplished by setting the SYSRESETREQ bit in the Application Interrupt and Reset Control Register (AIRCR). 5. The maximum setting is 0xffffff which corresponds to 0xffffff / 2 ticks before triggering a watchdog reset (see errata RP2040 Dec 14, 2024 · Re: rp2040: fixing GPIO state during watchdog reset Sun Dec 15, 2024 1:54 pm Not sure how dynamic analysis would be really helpful here, as hardware watchpoints on the relevant peripheral register addresses apparently don't trigger (I assume they only work for ram) and the debugger doesn't survive the watchdog reset: Code: Select all (gdb) c RP2040 only: Note that due to errata RP2040-E13, aborting a channel which has transfers in-flight (i. Puts the microcontroller into a low-power-sleep mode. This uploads and works just like a normal application, with no custom linker script. Similarly, Wi-Fi and Bluetooth examples will only build on a board that includes Wi-Fi and Bluetooth support. 256b-1M for custom bootloader space. Is this possible? There is a way to do it using python using machine. May 9, 2025 · The RP2040 bootrom follows a carefully structured boot sequence to initialize the system and determine the appropriate boot source (flash or USB). 2: Code Nov 24, 2023 · The RP2040 doco suggests that the debug port reset causes the Pico to reboot to the bootloader (untested), so the next reset will be a software reset. Any higher values will be truncated by the hardware. Enable the watchdog and enter an infinite loop and it should generate a reset. Read documentation on course website, and the RP2040 C SDK guide Read the RP2040 datasheet, and the RP2040 C SDK guide Read documentation on course website, and the RP2040 datasheet ProtoThreads A lightweight threading library, written in C, which facilitates concurrent programming of software that contains function calls from the C SDK Mar 26, 2023 · When something goes wrong in an embedded system, a watchdog timer is the last line of defense against a blocked or malfunctioning system. The maximum setting is 0xffffff which corresponds to 0xffffff / 2 ticks before triggering a watchdog reset (see errata RP2040-E1).