Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add watchdog reset experiment #779

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

JurajSadel
Copy link
Contributor

This is mostly experimental, so opening as a draft.

I've been playing with (cc cc #691) and I was able to reproduce the issue with espflash AND esptool as well, following the same steps as mentioned here
I looked into esptool and specifically to this commit. esptool not using this fix as default for SERIAL_JTAG, it can be used manually with:
--after reset_watchdog

The reasons (from esptool perspective) it's not on by default are:

  1. The RTC WDT hack is not available on all devices (e.g., the H2 doesn't have it).
  2. On Linux, it causes the port to re-enumerate, meaning that instead of /dev/ttyUSB0, a new /dev/ttyUSB1 appears. This can cause the monitor to disconnect and not reconnect automatically.
  3. On the C6 and H2 USB-Serial/JTAG controller, there is a bug that causes the port to disappear after a system reset and not reappear until a power cycle is performed. The RTC WDT reset is a system reset, so this issue occurs. So they left it by default only for USB-OTG and is optional for SERIAL_JTAG. On C6 it is NOT SUPPORTTED at all in esptool.

@JurajSadel JurajSadel marked this pull request as ready for review February 24, 2025 10:21
@JurajSadel
Copy link
Contributor Author

Should I add a P4 here as well?

fn wdt_config1(&self) -> u32;
}

impl RtcWdtReset for crate::targets::esp32c3::Esp32c3 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really like to avoid leaking chip-specific details like these into other modules, this all probably belongs in the targets module.


#[cfg(feature = "serialport")]
/// Check if the connection is USB OTG
pub(crate) fn connection_is_usb_otg(&self, connection: &mut Connection) -> Result<bool, Error> {
Copy link
Member

@jessebraham jessebraham Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function feels like it belongs on the Connection struct, so we should probably expose the necessary details from the targets module which can then be referenced there.

This applies to the other functions in the targets module below as well.

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