Skip to content

Commit

Permalink
Disable RTC watchdog when not using the stub
Browse files Browse the repository at this point in the history
- Re add explicit RTC watchdog disable when **not** using the stub
- Add support for disabling esp32c6 RTC watchdog
  • Loading branch information
MabezDev committed Mar 2, 2023
1 parent 9341376 commit 52cb766
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions espflash/src/targets/flash_target/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,63 @@ impl FlashTarget for Esp32Target {
connection.command(command)
})?;

if !self.use_stub && connection.get_usb_pid()? == USB_SERIAL_JTAG_PID {
match self.chip {
Chip::Esp32c3 => {
connection.command(Command::WriteReg {
address: 0x6000_80a8,
value: 0x50D8_3AA1,
mask: None,
})?; // WP disable
connection.command(Command::WriteReg {
address: 0x6000_8090,
value: 0x0,
mask: None,
})?; // turn off RTC WDT
connection.command(Command::WriteReg {
address: 0x6000_80a8,
value: 0x0,
mask: None,
})?; // WP enable
}
Chip::Esp32s3 => {
connection.command(Command::WriteReg {
address: 0x6000_80B0,
value: 0x50D8_3AA1,
mask: None,
})?; // WP disable
connection.command(Command::WriteReg {
address: 0x6000_8098,
value: 0x0,
mask: None,
})?; // turn off RTC WDT
connection.command(Command::WriteReg {
address: 0x6000_80B0,
value: 0x0,
mask: None,
})?; // WP enable
}
Chip::Esp32c6 => {
connection.command(Command::WriteReg {
address: 0x600B_1C18,
value: 0x50D8_3AA1,
mask: None,
})?; // WP disable
connection.command(Command::WriteReg {
address: 0x600B_1C00,
value: 0x0,
mask: None,
})?; // turn off RTC WDT
connection.command(Command::WriteReg {
address: 0x600B_1C18,
value: 0x0,
mask: None,
})?; // WP enable
}
_ => {}
}
}

Ok(())
}

Expand Down

0 comments on commit 52cb766

Please sign in to comment.