Skip to content

Commit 0e3adae

Browse files
committed
fix(usb_mode_detection): Fix USB mode detection on ESP32-C5 and ESP32-C61
Closes #1140
1 parent 5781ed2 commit 0e3adae

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
@@ -55,7 +55,7 @@ class ESP32C5ROM(ESP32C6ROM):
5555
PCR_SYSCLK_XTAL_FREQ_V = 0x7F << 24
5656
PCR_SYSCLK_XTAL_FREQ_S = 24
5757

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

6060
FLASH_FREQUENCY = {
6161
"80m": 0xF,

esptool/targets/esp32c61.py

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

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

0 commit comments

Comments
 (0)