Skip to content

Commit 81bdb76

Browse files
committed
fix(usb_mode_detection): Fix USB mode detection on ESP32-C5 and ESP32-C61
Closes #1140
1 parent 9286189 commit 81bdb76

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

esptool/targets/esp32c5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class ESP32C5ROM(ESP32C6ROM):
6060
PCR_SYSCLK_XTAL_FREQ_V = 0x7F << 24
6161
PCR_SYSCLK_XTAL_FREQ_S = 24
6262

63-
UARTDEV_BUF_NO = 0x4085F51C # Variable in ROM .bss which indicates the port in use
63+
UARTDEV_BUF_NO = 0x4085F514 # Variable in ROM .bss which indicates the port in use
6464

6565
FLASH_FREQUENCY = {
6666
"80m": 0xF,

esptool/targets/esp32c61.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ class ESP32C61ROM(ESP32C6ROM):
4444
EFUSE_SECURE_BOOT_EN_REG = EFUSE_BASE + 0x034
4545
EFUSE_SECURE_BOOT_EN_MASK = 1 << 26
4646

47+
# Variable in ROM .bss which indicates the port in use
48+
@property
49+
def UARTDEV_BUF_NO(self):
50+
"""Variable .bss.UartDev.buff_uart_no in ROM .bss
51+
which indicates the port in use.
52+
"""
53+
return 0x4084F5EC if self.get_chip_revision() <= 2 else 0x4084F5E4
54+
55+
@property
56+
def UARTDEV_BUF_NO_USB_JTAG_SERIAL(self):
57+
"""The above var when USB-JTAG/Serial is used."""
58+
return 3 if self.get_chip_revision() <= 2 else 4
59+
4760
FLASH_FREQUENCY = {
4861
"80m": 0xF,
4962
"40m": 0x0,

0 commit comments

Comments
 (0)