mirror of
https://github.com/espressif/esptool.git
synced 2025-10-18 09:12:27 +08:00
fix(esp32-c5): Use a longer reset delay with usb-serial/jtag to stabilize boot-up
This commit is contained in:
@@ -148,13 +148,13 @@ class HardReset(ResetStrategy):
|
|||||||
Can be used to reset out of the bootloader or to restart a running app.
|
Can be used to reset out of the bootloader or to restart a running app.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, port, uses_usb_otg=False):
|
def __init__(self, port, uses_usb=False):
|
||||||
super().__init__(port)
|
super().__init__(port)
|
||||||
self.uses_usb_otg = uses_usb_otg
|
self.uses_usb = uses_usb
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self._setRTS(True) # EN->LOW
|
self._setRTS(True) # EN->LOW
|
||||||
if self.uses_usb_otg:
|
if self.uses_usb:
|
||||||
# Give the chip some time to come out of reset,
|
# Give the chip some time to come out of reset,
|
||||||
# to be able to handle further DTR/RTS transitions
|
# to be able to handle further DTR/RTS transitions
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
|
@@ -7,6 +7,7 @@ import time
|
|||||||
|
|
||||||
from .esp32c6 import ESP32C6ROM
|
from .esp32c6 import ESP32C6ROM
|
||||||
from ..loader import ESPLoader
|
from ..loader import ESPLoader
|
||||||
|
from ..reset import HardReset
|
||||||
|
|
||||||
|
|
||||||
class ESP32C5ROM(ESP32C6ROM):
|
class ESP32C5ROM(ESP32C6ROM):
|
||||||
@@ -24,6 +25,8 @@ class ESP32C5ROM(ESP32C6ROM):
|
|||||||
PCR_SYSCLK_XTAL_FREQ_V = 0x7F << 24
|
PCR_SYSCLK_XTAL_FREQ_V = 0x7F << 24
|
||||||
PCR_SYSCLK_XTAL_FREQ_S = 24
|
PCR_SYSCLK_XTAL_FREQ_S = 24
|
||||||
|
|
||||||
|
UARTDEV_BUF_NO = 0x4085F51C # Variable in ROM .bss which indicates the port in use
|
||||||
|
|
||||||
# Magic value for ESP32C5
|
# Magic value for ESP32C5
|
||||||
CHIP_DETECT_MAGIC_VALUE = [0x8082C5DC]
|
CHIP_DETECT_MAGIC_VALUE = [0x8082C5DC]
|
||||||
|
|
||||||
@@ -67,6 +70,10 @@ class ESP32C5ROM(ESP32C6ROM):
|
|||||||
self.read_reg(self.PCR_SYSCLK_CONF_REG) & self.PCR_SYSCLK_XTAL_FREQ_V
|
self.read_reg(self.PCR_SYSCLK_CONF_REG) & self.PCR_SYSCLK_XTAL_FREQ_V
|
||||||
) >> self.PCR_SYSCLK_XTAL_FREQ_S
|
) >> self.PCR_SYSCLK_XTAL_FREQ_S
|
||||||
|
|
||||||
|
def hard_reset(self):
|
||||||
|
print("Hard resetting via RTS pin...")
|
||||||
|
HardReset(self._port, self.uses_usb_jtag_serial())()
|
||||||
|
|
||||||
def change_baud(self, baud):
|
def change_baud(self, baud):
|
||||||
if not self.IS_STUB:
|
if not self.IS_STUB:
|
||||||
crystal_freq_rom_expect = self.get_crystal_freq_rom_expect()
|
crystal_freq_rom_expect = self.get_crystal_freq_rom_expect()
|
||||||
|
Reference in New Issue
Block a user