Skip to content

feat: reset ESP32-S2 via RTC watchdog on USB-OTG (DTR/RTS latch is a no-op there)#45

Open
jgangemi wants to merge 1 commit into
tinygo-org:mainfrom
jgangemi:jae/upstream-s2-watchdog
Open

feat: reset ESP32-S2 via RTC watchdog on USB-OTG (DTR/RTS latch is a no-op there)#45
jgangemi wants to merge 1 commit into
tinygo-org:mainfrom
jgangemi:jae/upstream-s2-watchdog

Conversation

@jgangemi

@jgangemi jgangemi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
  • distinguish native USB-OTG (ESP32-S2, no USB-Serial-JTAG bridge) from
    USB-Serial-JTAG (S3/C3/C6/H2/C5) via a new chipDef.HardResetOTG hook,
    instead of conflating both under usesUSB
  • add esp32s2HardReset/esp32s2WatchdogReset mirroring esptool's
    ESP32S2ROM.hard_reset()/watchdog_reset(): gate on GPIO_STRAP_REG and
    RTC_CNTL_OPTION1_REG, then arm the RTC WDT (unlock, set timeout,
    enable stage-0 system reset, relock) instead of toggling DTR/RTS
  • falls back to the existing hardResetUSB DTR/RTS path when the gate
    indicates a watchdog reset wouldn't reliably exit download mode, or
    when the gate registers are unreadable (e.g. secure download mode)
  • preserves all existing behavior for S3/C3/C6/H2/C5 (HardResetOTG is
    nil for those chipDefs) and the non-USB path

…no-op there)

- distinguish native USB-OTG (ESP32-S2, no USB-Serial-JTAG bridge) from
  USB-Serial-JTAG (S3/C3/C6/H2/C5) via a new chipDef.HardResetOTG hook,
  instead of conflating both under usesUSB
- add esp32s2HardReset/esp32s2WatchdogReset mirroring esptool's
  ESP32S2ROM.hard_reset()/watchdog_reset(): gate on GPIO_STRAP_REG and
  RTC_CNTL_OPTION1_REG, then arm the RTC WDT (unlock, set timeout,
  enable stage-0 system reset, relock) instead of toggling DTR/RTS
- falls back to the existing hardResetUSB DTR/RTS path when the gate
  indicates a watchdog reset wouldn't reliably exit download mode, or
  when the gate registers are unreadable (e.g. secure download mode)
- preserves all existing behavior for S3/C3/C6/H2/C5 (HardResetOTG is
  nil for those chipDefs) and the non-USB path
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.

1 participant