liam-geotab opened a new pull request, #19892:
URL: https://github.com/apache/nuttx/pull/19892
## Summary
Add the IWDG implementation for stm32h5.
By doing `git diff -C --find-copies-harder HEAD~3` you will see that this is
a copy of the common m3m4 v1 implementation. It's the same except for a debug
log of the LSI enable bit which is in RCC_CSR in the common implementation, but
in a register called RCC_BDCR on stm32h5.
I looked into using the common implementation on STM32H5 but it's behind
CONFIG_STM32_COMMON_LEGACY in arch/arm/src/common/stm32/Make.defs which stm32h5
currently is not. Therefore, the approach taken to adding IWDG is similar to
stm32l4 which selects STM32_HAVE_IP_WDG_M3M4_V1 in its Kconfig but provides its
own implementation file.
The IWDG is initialized in nucleo-h563zi bringup at /dev/watchdog0.
## Impact
It's an additive change that defines `stm32_iwdginitialize` when
`CONFIG_STM32_IWDG` is enabled.
It initializes IWDG at /dev/watchdog0 on nucleo-h563zi. The path name is
typical and consistent. It may clash with divergent forks.
## Testing
Validated with the watchdog example app. This implementation has also been
in service for some months.
`nucleo-h563zi:nsh` with the following enabled:
```
CONFIG_DEBUG_WATCHDOG=y
CONFIG_DEBUG_WATCHDOG_ERROR=y
CONFIG_DEBUG_WATCHDOG_INFO=y
CONFIG_DEBUG_WATCHDOG_WARN=y
CONFIG_EXAMPLES_WATCHDOG=y
CONFIG_STM32_IWDG=y
```
```
ABCG
stm32_iwdginitialize: Entry: devpath=/dev/watchdog0 lsifreq=32000
stm32_iwdginitialize: RCC BDCR: 0c000003
stm32_settimeout: Entry: timeout=32760
stm32_settimeout: prescaler=6 fiwdg=125 reload=4095
watchdog_register: Entry: path=/dev/watchdog0
NuttShell (NSH) NuttX-13.0.1-RC0
nsh> wdog
wdog_open: crefs: 0
wdog_ioctl: cmd: 516 arg: 2000
stm32_settimeout: Entry: timeout=2000
stm32_settimeout: prescaler=2 fiwdg=2000 reload=4000
wdog_ioctl: cmd: 513 arg: 0
stm32_start: Entry: started
wdog_ioctl: cmd: 515 arg: 536891056
stm32_getstatus: Entry
stm32_getstatus: Status :
stm32_getstatus: flags : 00000003
stm32_getstatus: timeout : 2000
stm32_getstatus: timeleft : 1500
wdowdog_ioctl: cmd: 518 arg: 0
stm32_keepalive: Entry
g_main: flags=00000003 timeout=2000 timeleft=1500
ping elapsed=0
wdog_ioctl: cmd: 515 arg: 536891056
stm32_getstatus: Entry
stm32_getstatus: Status :
stm32_getstatus: flags : 00000003
stm32_getstatus: timeout : 2000
stm32_getstatus: timeleft : 1500
wdowdog_ioctl: cmd: 518 arg: 0
stm32_keepalive: Entry
...shortened...
wdog_ioctl: cmd: 515 arg: 536891056
stm32_getstatus: Entry
stm32_getstatus: Status :
stm32_getstatus: flags : 00000003
stm32_getstatus: timeout : 2000
stm32_getstatus: timeleft : 980
wdog_main: flags=00000003 timeout=2000 timeleft=980
NO ping elapsed=5720
wdog_ioctl: cmd: 515 arg: 536891056
stm32_getstatus: Entry
stm32_getstatus: Status :
stm32_getstatus: flags : 00000003
stm32_getstatus: timeout : 2000
stm32_getstatus: timeleft : 460
wdog_main: flags=00000003 timeout=2000 timeleft=460
NO ping elapsed=6240
ABCG
stm32_iwdginitialize: Entry: devpath=/dev/watchdog0 lsifreq=32000
stm32_iwdginitialize: RCC BDCR: 0c000003
stm32_settimeout: Entry: timeout=32760
stm32_settimeout: prescaler=6 fiwdg=125 reload=4095
watchdog_register: Entry: path=/dev/watchdog0
NuttShell (NSH) NuttX-13.0.1-RC0
nsh>
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]