Skip to content

drivers: watchdog: stm32: add IWDG standby mode configuration - #4

Merged
ringlej merged 1 commit into
gridpoint-4.3.0from
feature/iwdg-standby-option-byte
May 12, 2026
Merged

ringlej merged 1 commit into
gridpoint-4.3.0from
feature/iwdg-standby-option-byte

Conversation

@ringlej

@ringlej ringlej commented May 7, 2026

Copy link
Copy Markdown

Summary

  • Add tri-state Kconfig choice (IWDG_STM32_STANDBY) to control the IWDG_STDBY option byte
  • Uses the public flash_ex_op API (FLASH_STM32_EX_OP_OPTB_READ/WRITE) to manage option bytes
  • Runs at SYS_INIT(APPLICATION, 0) to avoid flash semaphore ordering issues at POST_KERNEL
  • Only writes (and triggers OBL_LAUNCH reset) when the option byte differs from desired value
  • No code pulled in when "No change" (default) is selected

@ringlej ringlej self-assigned this May 7, 2026
@ringlej
ringlej requested a review from abelino May 7, 2026 00:27
@ringlej
ringlej force-pushed the feature/iwdg-standby-option-byte branch from 0f0ca2d to 6df4340 Compare May 7, 2026 01:54
Comment thread drivers/watchdog/wdt_iwdg_stm32.c Resolved
Comment thread drivers/watchdog/wdt_iwdg_stm32.c Resolved
Comment thread drivers/watchdog/wdt_iwdg_stm32.c Resolved
@ringlej
ringlej force-pushed the feature/iwdg-standby-option-byte branch 2 times, most recently from 21518de to 7c70b8f Compare May 11, 2026 21:37
@ringlej
ringlej requested a review from abelino May 11, 2026 21:39
Add Kconfig choice to control the IWDG_STDBY option byte, allowing
users to configure whether the independent watchdog runs or is frozen
during standby mode. Uses the public flash_ex_op API to read/write
option bytes at APPLICATION init level (flash device must be ready).

Three options:
- No change (default): leave option byte as-is, no extra code
- Freeze: clear IWDG_STDBY so IWDG is frozen in standby
- Active: set IWDG_STDBY so IWDG continues running in standby

The write triggers OBL_LAUNCH (system reset) only when the option byte
differs from the desired value. On subsequent boots, no write occurs.

Signed-off-by: Jon Ringle <jringle@gridpoint.com>
@ringlej
ringlej force-pushed the feature/iwdg-standby-option-byte branch from 7c70b8f to 8226f34 Compare May 12, 2026 17:48
@ringlej
ringlej merged commit 12bd5cd into gridpoint-4.3.0 May 12, 2026
7 of 9 checks passed
@ringlej
ringlej deleted the feature/iwdg-standby-option-byte branch May 12, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants