You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "daniel-p-carvalho (via GitHub)" <gi...@apache.org> on 2026/10/18 13:53:37 UTC

[PR] arch/mips/pic32mz: add a watchdog timer driver for the PIC32MZ-W1. [nuttx]

daniel-p-carvalho opened a new pull request, #20776:
URL: https://github.com/apache/nuttx/pull/20776

   ## Summary
   
   Add a watchdog lower half (`watchdog_ops_s`) for the PIC32MZ-W1 WDT and register it as `/dev/watchdog0` on the ev49n51a board.
   
   * `arch/mips/pic32mz`: new `pic32mz_wdt.c`, registered with `pic32mz_wdt_initialize()`. The time-out is selected by the device configuration (WDTPS), so it cannot change at run time: `settimeout()` accepts a time-out up to the hardware one and kicks the watchdog. When WDTEN is set in the device configuration the watchdog runs from reset and `stop()` fails; otherwise `start()` enables it by software. The reset cause flag RCON.WDTO is logged and cleared at initialization.
   * The WDTPS field of the W1 device configuration now always follows `BOARD_WD_PRESCALER`; it was only programmed when `PIC32MZ_WDTENABLE` was set, which left a software-enabled watchdog at the shortest time-out.
   * The run-mode watchdog base period is not documented in the datasheet, so it is a Kconfig value (`PIC32MZ_WDT_BASE_US`, 1 ms by default).
   * `boards/ev49n51a`: register the watchdog from the board bring-up when `PIC32MZ_WDT` is enabled (time-out of 8192 base periods).
   * `Documentation/ev49n51a`: add the watchdog to the peripheral table and describe its setup.
   
   ## Impact
   
   New feature, off by default (`CONFIG_PIC32MZ_WDT`); no defconfig enables it. The only change for existing configs is the WDTPS programming described above, which has no effect while the watchdog is disabled. A W1 board that enables `PIC32MZ_WDT` must define `BOARD_WD_PRESCALER`, otherwise the build stops with an `#error` instead of silently using the longest time-out (about 17 minutes).
   
   ## Testing
   
   Host: Ubuntu Linux x86_64, XC32 v6.00 and Pinguino p32-gcc 4.9.2.
   
   Build (ev49n51a:nsh plus `WATCHDOG`, `PIC32MZ_WDT`, `EXAMPLES_WATCHDOG`): OK with XC32 (software-enabled and `PIC32MZ_WDTENABLE=y`) and with Pinguino; `ev49n51a:nsh`, `:netnsh` and `:wlan` without the watchdog still build. `checkpatch.sh -c -u -m -g` passes.
   
   Hardware: EV49N51A (PIC32MZ1025W104132), console on UART1 at 115200, `ev49n51a:nsh` + `WATCHDOG`, `PIC32MZ_WDT`, `EXAMPLES_WATCHDOG`.
   
   Software-enabled watchdog (`PIC32MZ_WDTENABLE=n`): `wdog -d 1000 -p 200 -t 2000` kicks for 1 s and then stops. The board resets 8.0-8.2 s after the last kick (8192 x 1 ms, so the default `PIC32MZ_WDT_BASE_US=1000` holds) and logs the cause on the next boot, repeated twice with the same timing:
   
   ```
   nsh> wdog -d 1000 -p 200 -t 2000
     ping elapsed=800
     NO ping elapsed=1000
     ...
     NO ping elapsed=8800
   Last reset was caused by the watchdog
   
   NuttShell (NSH) NuttX-13.1.0
   ```
   
   A normal power-on or `-OK` reset prints no such message. `wdog -t 20000` (longer than the hardware time-out) fails with `WDIOC_SETTIMEOUT failed: 34` (ERANGE).
   
   Hardware-enabled watchdog (`PIC32MZ_WDTENABLE=y`): with nothing kicking it the board resets every ~8 s (4 resets in 30 s). `wdog -d 20000 -p 500` takes over the running watchdog and keeps the board alive for 20 s, which is more than the hardware time-out; the reset comes 8 s after the kicks stop (28.1 s after the command).
   
   The documentation page was not rendered (Sphinx is not installed on the test host); it follows the structure of the neighbouring sections.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01C9UQw1otfrR9yrct69vH74
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] arch/mips/pic32mz: add a watchdog timer driver for the PIC32MZ-W1. [nuttx]

Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis merged PR #20776:
URL: https://github.com/apache/nuttx/pull/20776


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] arch/mips/pic32mz: add a watchdog timer driver for the PIC32MZ-W1. [nuttx]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20776:
URL: https://github.com/apache/nuttx/pull/20776#issuecomment-6250795484

   <!-- membrowse-pr-comment -->
   ## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report
   
   *No memory changes detected for:*
   - [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   - [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=1d952a552b0fb66c2f43583424fc48c17a94b41d&base=6bdd71565ad4d0095b73f09ab81c4f570b2aeec5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org