espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.84k stars 7.32k forks source link

Cannot open UART1,open: No such file or directory (IDFGH-13970) #14800

Closed lujiex closed 1 week ago

lujiex commented 4 weeks ago

Answers checklist.

IDF version.

v5.3

Espressif SoC revision.

ESP32-S3

Operating System used.

Linux

How did you build your project?

Command line with CMake

If you are using Windows, please specify command line type.

None

Development Kit.

ESP32-S3

Power Supply used.

USB

What is the expected behavior?

Open the UART1 normally

What is the actual behavior?

E (00:04:36.496) uartManager: Cannot open UART1 open: No such file or directory

Steps to reproduce.

image Set "Channel for console output" to "USB Serial/JTAG Controller" and UART1 will fail to open with the error "Cannot open UART1 open: No such file or directory"

image Set Channel for console output to Default: UART0 ", UART1 can be successfully opened, but my serial port console program will be abnormal, "Writing to serial is timing out. Please make sure that your application supports an interactive console and that you have picked the correct console for serial communication.”

image

The source code in question is as follows: image

Debug Logs.

UART1 is open normally, but the console LOG is abnormal:
--- esp-idf-monitor 1.4.0 on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
I (133) esp_image: segment 0: paddr=00010020 vaddr=3c130020 size=92d98h (601496) map
I (250) esp_image: segment 1: paddr=000a2dc0 vaddr=3fc98600 size=04e10h ( 19984) load
I (255) esp_image: segment 2: paddr=000a7bd8 vaddr=40374000 size=08440h ( 33856) load
I (264) esp_image: segment 3: paddr=000b0020 vaddr=42000020 size=1219dch (1186268) map
I (477) esp_image: segment 4: paddr=001d1a04 vaddr=4037c440 size=0c0f4h ( 49396) load
I (499) boot: Loaded app from partition at offset 0x10000
I (499) boot: Disabling RNG early entropy source...
I (511) cpu_start: Multicore app
I (520) cpu_start: Pro cpu start user code
I (520) cpu_start: cpu freq: 240000000 Hz
I (520) app_init: Application information:
I (523) app_init: Project name:     yfbao
I (528) app_init: App version:      0.0.1
 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037a4f2
0x4037a4f2: esp_cpu_wait_for_intr at /home/donnel/esp/esp-idf/components/esp_hw_support/cpu.c:64

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x18ac
load:0x403c8700,len:0x4
load:0x403c8704,len:0xdd8
load:0x403cb700,len:0x3460
entry 0x403c89bc
I (32) boot: ESP-IDF v5.3-dirty 2nd stage bootloader
I (32) boot: compile time Oct 29 2024 15:50:14
I (32) boot: Multicore bootloader
I (35) boot: chip revision: v0.2
I (39) boot.esp32s3: Boot SPI Speed : 80MHz
I (44) boot.esp32s3: SPI Mode       : DIO
I (48) boot.esp32s3: SPI Flash Size : 16MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (70) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (77) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (85) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (92) boot:  3 factory          factory app      00 00 00010000 00300000
I (99) boot:  4 ota_0            OTA app          00 10 00310000 00500000
I (107) boot:  5 ota_1            OTA app          00 11 00810000 00500000
I (114) boot:  6 nvs_key          NVS keys         01 04 00d10000 00001000
I (122) boot:  7 storage          Unknown data     01 81 00d11000 00100000
I (130) boot: End of partition table
I (134) boot: Defaulting to factory image
I (139) esp_image: segment 0: paddr=00010020 vaddr=3c130020 size=92d98h (601496) map
I (255) esp_image: segment 1: paddr=000a2dc0 vaddr=3fc98600 size=04e10h ( 19984) load
I (260) esp_image: segment 2: paddr=000a7bd8 vaddr=40374000 size=08440h ( 33856) load
I (269) esp_image: segment 3: paddr=000b0020 vaddr=42000020 size=1219dch (1186268) map
I (482) esp_image: segment 4: paddr=001d1a04 vaddr=4037c440 size=0c0f4h ( 49396) load
I (504) boot: Loaded app from partition at offset 0x10000
I (504) boot: Disabling RNG early entropy source...
I (516) cpu_start: Multicore app
I (525) cpu_start: Pro cpu start user code
I (525) cpu_start: cpu freq: 240000000 Hz
I (526) app_init: Application information:
I (528) app_init: Project name:     yfbao
I (533) app_init: App version:      0.0.1
I (538) app_init: Compile time:     Oct 29 2024 15:50:12
I (544) app_init: ELF file SHA256:  32a6e5908...
I (549) app_init: ESP-IDF:          v5.3-dirty
I (554) efuse_init: Min chip rev:     v0.0
I (559) efuse_init: Max chip rev:     v0.99 
I (564) efuse_init: Chip rev:         v0.2
I (569) heap_init: Initializing. RAM available for dynamic allocation:
I (576) heap_init: At 3FCA7700 len 00042010 (264 KiB): RAM
I (582) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (588) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (594) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM
I (602) spi_flash: detected chip: generic
I (605) spi_flash: flash io: dio
I (612) sleep: Configure to isolate all GPIO pins in sleep state
I (616) sleep: Enable automatic switching of GPIO sleep configuration
I (00:00:34.542) main_task: Started on CPU0
I (00:00:34.552) main_task: Calling app_main()
I (00:00:34.553) appMain: Starting
I (00:00:34.556) fatFS: registerFatfs
I (00:00:34.561) console: registerConsole
I (00:00:34.565) forwardManager: registerForwardManager
I (00:00:34.571) wifiManager: registerWifiManager
I (00:00:34.576) http_server: registerHttpServer
I (00:00:34.582) uartManager: registerUartManager
I (00:00:34.587) Select: registerSelectManager
I (00:00:34.592) Select: select_task
I (00:00:34.597) esp_https_server: Starting server
E (00:00:34.604) httpd: Failed to post esp_http_server event: ESP_ERR_INVALID_STATE
I (00:00:34.610) esp_https_server: Server listening on port 3001
E (00:00:34.617) esp_https_server: Failed to post http_client event: 1, error: ESP_ERR_INVALID_STATE
I (00:00:34.626) Select: Registering URI handlers
I (00:00:34.633) OTA: registerOtaClient
I (00:00:34.637) fatFS: Start mount...
I (00:00:34.643) fatFS: Mounted FATFS, mount point: /storage
I (00:00:34.648) console: history file: /storage/history
I (00:00:34.653) console: Command history enabled
I (00:00:34.659) CMD_WIFI: register_wifi_cmd
I (00:00:34.678) main_task: Returned from app_main()
Writing to serial is timing out. Please make sure that your application supports an interactive console and that you have picked the correct console for serial communication.

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (00:00:35.178) forwardManager: Forward Manager config: /storage/forward.json

Your terminal application does not support escape sequences.

Line editing and history features are disabled.

On Windows, try using Putty instead.
{"bufferSize":1024,"port":3000}
I (00:00:35.207) wifiManager: Wifi Manager config: /storage/wifi.json
yfbao> {"ap":{"authmode":"WPA2","channel":1,"dns":"223.5.5.5","gateway":"192.168.9.1","hidden":false,"ip":"192.168.9.1","maxConnection":1,"netmask":"255.255.255.0","password":"Aa123456","ssid":"ESP32-AP"},"mode":"APSTA","sta":{"authmode":"WPA2","history":[{"authmode":"WPA2","password":"password","ssid":"ssid"}],"password":"Aa123456","ssid":"idc_2.4G"}}
I (00:00:35.256) uartManager: Uart Manager config: /storage/uart.json
{"baudRate":"115200","dataBits":8,"flowControl":"NONE","parity":"NONE","stopBits":1}
I (00:00:35.267) Select: Listening on port 3000
I (00:00:35.269) wifiManager: Wifi start...
I (00:00:35.298) pp: pp rom version: e7ae62f
I (00:00:35.300) net80211: net80211 rom version: e7ae62f
I (1448) wifi:wifi driver task: 3fccf01c, prio:23, stack:6656, core=0
I (1458) wifi:wifi firmware version: 0caa81945
I (1458) wifi:wifi certification version: v7.0
I (1458) wifi:config NVS flash: enabled
I (1458) wifi:config nano formating: disabled
I (1468) wifi:Init data frame dynamic rx buffer num: 32
I (1468) wifi:Init static rx mgmt buffer num: 5
I (1468) wifi:Init management short buffer num: 32
I (1478) wifi:Init dynamic tx buffer num: 32
I (1478) wifi:Init static tx FG buffer num: 2
I (1488) wifi:Init static rx buffer size: 1600
I (1488) wifi:Init static rx buffer num: 10
I (1498) wifi:Init dynamic rx buffer num: 32
I (00:00:35.359) wifi_init: rx ba win: 6
I (00:00:35.370) wifi_init: accept mbox: 6
I (00:00:35.371) wifi_init: tcpip mbox: 32
I (00:00:35.382) wifi_init: udp mbox: 6
I (00:00:35.383) wifi_init: tcp mbox: 6
I (00:00:35.384) wifi_init: tcp tx win: 5760
I (00:00:35.395) wifi_init: tcp rx win: 5760
I (00:00:35.396) wifi_init: tcp mss: 1440
I (00:00:35.397) wifi_init: WiFi IRAM OP enabled
I (00:00:35.408) wifi_init: WiFi RX IRAM OP enabled
I (1548) wifi:set country: cc=CN schan=1 nchan=13 policy=0

I (00:00:35.423) wifiManager: Setting WiFi configuration SSID ESP32-AP
I (00:00:35.424) wifiManager: Setting WiFi configuration password Aa123456
I (00:00:35.436) wifiManager: Channel 1
I (00:00:35.436) wifiManager: Hidden 0
I (00:00:35.437) wifiManager: Max connections 1
I (00:00:35.448) wifiManager: IP 192.168.9.1
I (00:00:35.449) wifiManager: Gateway 192.168.9.1
I (00:00:35.460) wifiManager: NETMASK 255.255.255.0
I (00:00:35.461) wifiManager: DNS 223.5.5.5
I (00:00:35.466) wifiManager: Sta automode 3
I (00:00:35.467) wifiManager: Setting WiFi configuration SSID idc_2.4G
I (00:00:35.478) wifiManager: Setting WiFi configuration password Aa123456
I (00:00:35.491) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
I (1678) wifi:mode : sta (24:58:7c:ce:39:b0) + softAP (24:58:7c:ce:39:b1)
I (1678) wifi:enable tsf
I (1678) wifi:Total power save buffer number: 16
I (1678) wifi:Init max length of beacon: 752/752
I (1678) wifi:Init max length of beacon: 752/752
I (00:00:35.559) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.9.1
Writing to serial is timing out. Please make sure that your application supports an interactive console and that you have picked the correct console for serial communication.

UART1 failed to open, but the console is normal LOG:
--- esp-idf-monitor 1.4.0 on /dev/ttyACM0 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
I (389) boot: Disabling RNG early entropy source...
I (390) cpu_start: Multicore app
I (400) cpu_start: Pro cpu start user code
I (400) cpu_start: cpu freq: 240000000 Hz
I (400) app_init: Application information:
I (400) app_init: Project name:     yfbao
I (400) app_init: App version:      0.0.1
I (400) app_init: Compile time:     Oct 29 2024 15:52:44
I (401) app_init: ELF file SHA256:  2d7f50cac...
I (401) app_init: ESP-IDF:          v5.3-dirty
I (401) efuse_init: Min chip rev:     v0.0
I (401) efuse_init: Max chip rev:     v0.99 
I (401) efuse_init: Chip rev:         v0.2
I (401) heap_init: Initializing. RAM available for dynamiSPIWP:0xee
mode:DIO, clock div:1
load:0x3fce2810,len:0x18ac
load:0x403c8700,len:0x4
load:0x403c8704,len:0xd30
load:0x403cb700,len:0x3470
entry 0x403c89ac
I (32) boot: ESP-IDF v5.3-dirty 2nd stage bootloader
I (32) boot: compile time Oct 29 2024 15:52:46
I (32) boot: Multicore bootloader
I (33) boot: chip revision: v0.2
I (33) boot.esp32s3: Boot SPI Speed : 80MHz
I (33) boot.esp32s3: SPI Mode       : DIO
I (33) boot.esp32s3: SPI Flash Size : 16MB
I (33) boot: Enabling RNG early entropy source...
I (34) boot: Partition Table:
I (34) boot: ## Label            Usage          Type ST Offset   Length
I (34) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (35) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (35) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (35) boot:  3 factory          factory app      00 00 00010000 00300000
I (36) boot:  4 ota_0            OTA app          00 10 00310000 00500000
I (36) boot:  5 ota_1            OTA app          00 11 00810000 00500000
I (37) boot:  6 nvs_key          NVS keys         01 04 00d10000 00001000
I (37) boot:  7 storage          Unknown data     01 81 00d11000 00100000
I (38) boot: End of partition table
I (38) boot: Defaulting to factory image
I (38) esp_image: segment 0: paddr=00010020 vaddr=3c130020 size=92cb8h (601272) map
I (147) esp_image: segment 1: paddr=000a2ce0 vaddr=3fc98600 size=04e00h ( 19968) load
I (152) esp_image: segment 2: paddr=000a7ae8 vaddr=40374000 size=08530h ( 34096) load
I (160) esp_image: segment 3: paddr=000b0020 vaddr=42000020 size=120608h (1181192) map
I (373) esp_image: segment 4: paddr=001d0630 vaddr=4037c530 size=0bfdch ( 49116) load
I (394) boot: Loaded app from partition at offset 0x10000
I (394) boot: Disabling RNG early entropy source...
I (395) cpu_start: Multicore app
I (405) cpu_start: Pro cpu start user code
I (405) cpu_start: cpu freq: 240000000 Hz
I (405) app_init: Application information:
I (405) app_init: Project name:     yfbao
I (405) app_init: App version:      0.0.1
I (405) app_init: Compile time:     Oct 29 2024 15:52:44
I (406) app_init: ELF file SHA256:  2d7f50cac...
I (406) app_init: ESP-IDF:          v5.3-dirty
I (406) efuse_init: Min chip rev:     v0.0
I (406) efuse_init: Max chip rev:     v0.99 
I (406) efuse_init: Chip rev:         v0.2
I (406) heap_init: Initializing. RAM available for dynamic allocation:
I (407) heap_init: At 3FCA76E0 len 00042030 (264 KiB): RAM
I (407) heap_init: At 3FCE9710 len 00005724 (21 KiB): RAM
I (407) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (407) heap_init: At 600FE100 len 00001EE8 (7 KiB): RTCRAM
I (409) spi_flash: detected chip: generic
I (409) spi_flash: flash io: dio
I (412) sleep: Configure to isolate all GPIO pins in sleep state
I (412) sleep: Enable automatic switching of GPIO sleep configuration
I (00:00:44.044) main_task: Started on CPU0
I (00:00:44.055) main_task: Calling app_main()
I (00:00:44.055) appMain: Starting
I (00:00:44.056) fatFS: registerFatfs
I (00:00:44.057) console: registerConsole
I (00:00:44.058) forwardManager: registerForwardManager
I (00:00:44.059) wifiManager: registerWifiManager
I (00:00:44.060) http_server: registerHttpServer
I (00:00:44.062) uartManager: registerUartManager
I (00:00:44.063) Select: registerSelectManager
I (00:00:44.063) Select: select_task
I (00:00:44.065) esp_https_server: Starting server
E (00:00:44.067) httpd: Failed to post esp_http_server event: ESP_ERR_INVALID_STATE
I (00:00:44.068) esp_https_server: Server listening on port 3001
E (00:00:44.069) esp_https_server: Failed to post http_client event: 1, error: ESP_ERR_INVALID_STATE
I (00:00:44.070) Select: Registering URI handlers
I (00:00:44.071) OTA: registerOtaClient
I (00:00:44.072) fatFS: Start mount...
I (00:00:44.075) fatFS: Mounted FATFS, mount point: /storage
I (00:00:44.076) console: history file: /storage/history
I (00:00:44.077) console: Command history enabled
I (00:00:44.078) CMD_WIFI: register_wifi_cmd
I (00:00:44.083) main_task: Returned from app_main()

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (00:00:44.160) forwardManager: Forward Manager config: /storage/forward.json
{"bufferSize":1024,"port":3000}
I (00:00:44.171) wifiManager: Wifi Manager config: /storage/wifi.json
{"ap":{"authmode":"WPA2","channel":1,"dns":"223.5.5.5","gateway":"192.168.9.1","hidden":false,"ip":"192.168.9.1","maxConnection":1,"netmask":"255.255.255.0","password":"Aa123456","ssid":"ESP32-AP"},"mode":"APSTA","sta":{"authmode":"WPA2","history":[{"authmode":"WPA2","password":"password","ssid":"ssid"}],"password":"Aa123456","ssid":"idc_2.4G"}}
I (00:00:44.187) uartManager: Uart Manager config: /storage/uart.json
                                                                                                                  {"baudRate":"115200","dataBits":8,"flowControl":"NONE","parity":"NONE","stopBits":1}
I (00:00:44.198) Select: Listening on port 3000
I (00:00:44.199) wifiManager: Wifi start...
I (00:00:44.217) pp: pp rom version: e7ae62f
I (00:00:44.218) net80211: net80211 rom version: e7ae62f
I (622) wifi:wifi driver task: 3fcceb2c, prio:23, stack:6656, core=0
I (632) wifi:wifi firmware version: 0caa81945
I (632) wifi:wifi certification version: v7.0
I (632) wifi:config NVS flash: enabled
I (632) wifi:config nano formating: disabled
I (632) wifi:Init data frame dynamic rx buffer num: 32
I (632) wifi:Init static rx mgmt buffer num: 5
I (642) wifi:Init management short buffer num: 32
yfbao> I (642) wifi:Init dynamic tx buffer num: 32
I (642) wifi:Init static tx FG buffer num: 2
I (642) wifi:Init static rx buffer size: 1600
I (642) wifi:Init static rx buffer num: 10
I (642) wifi:Init dynamic rx buffer num: 32
I (00:00:44.257) wifi_init: rx ba win: 6
I (00:00:44.258) wifi_init: accept mbox: 6
I (00:00:44.267) wifi_init: tcpip mbox: 32
I (00:00:44.268) wifi_init: udp mbox: 6
I (00:00:44.268) wifi_init: tcp mbox: 6
I (00:00:44.269) wifi_init: tcp tx win: 5760
I (00:00:44.269) wifi_init: tcp rx win: 5760
I (00:00:44.269) wifi_init: tcp mss: 1440
I (00:00:44.278) wifi_init: WiFi IRAM OP enabled
I (00:00:44.279) wifi_init: WiFi RX IRAM OP enabled
I (672) wifi:set country: cc=CN schan=1 nchan=13 policy=0

I (00:00:44.282) wifiManager: Setting WiFi configuration SSID ESP32-AP
I (00:00:44.283) wifiManager: Setting WiFi configuration password Aa123456
I (00:00:44.283) wifiManager: Channel 1
I (00:00:44.284) wifiManager: Hidden 0
I (00:00:44.284) wifiManager: Max connections 1
I (00:00:44.284) wifiManager: IP 192.168.9.1
I (00:00:44.285) wifiManager: Gateway 192.168.9.1
I (00:00:44.285) wifiManager: NETMASK 255.255.255.0
I (00:00:44.285) wifiManager: DNS 223.5.5.5
I (00:00:44.289) wifiManager: Sta automode 3
I (00:00:44.295) wifiManager: Setting WiFi configuration SSID idc_2.4G
I (00:00:44.295) wifiManager: Setting WiFi configuration password Aa123456
I (00:00:44.297) phy_init: phy_version 680,a6008b2,Jun  4 2024,16:41:10
I (732) wifi:mode : sta (24:58:7c:ce:39:b0) + softAP (24:58:7c:ce:39:b1)
I (732) wifi:enable tsf
I (742) wifi:Total power save buffer number: 16
I (742) wifi:Init max length of beacon: 752/752
I (742) wifi:Init max length of beacon: 752/752
I (00:00:44.356) esp_netif_lwip: DHCP server started on interface WIFI_AP_DEF with IP: 192.168.9.1
I (762) wifi:ap channel adjust o:1,1 n:6,1
I (762) wifi:new:<6,1>, old:<1,1>, ap:<6,1>, sta:<6,1>, prof:1, snd_ch_cfg:0x0
I (762) wifi:state: init -> auth (0xb0)
I (762) wifi:state: auth -> assoc (0x0)
I (792) wifi:state: assoc -> run (0x10)
I (952) wifi:connected with idc_2.4G, aid = 19, channel 6, 40U, bssid = 24:cf:24:01:c1:dc
I (952) wifi:security: WPA2-PSK, phy: bgn, rssi: -19
I (962) wifi:pm start, type: 1

I (962) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (962) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (1052) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (00:00:45.570) wifiManager: got ip:192.168.8.139
I (00:00:45.571) esp_netif_handlers: sta ip: 192.168.8.139, mask: 255.255.255.0, gw: 192.168.8.1
I (00:00:45.571) wifiManager: apsta mode,set NAPT
W (00:00:45.574) esp_netif_lwip: napt disabled on esp_netif:0x3fcd4910
I (00:00:45.586) uartManager: Uart start...
E (00:00:45.588) uartManager: Cannot open UART1
open: No such file or directory
I (00:00:45.589) http_server: HTTP start...
I (00:00:45.592) http_server: Registering URI handlers
I (00:00:45.597) esp_https_server: Starting server
I (00:00:45.599) esp_https_server: Server listening on port 443
I (00:00:45.601) http_server: Registering URI handlers
yfbao> 
yfbao> version
IDF Version:v5.3-dirty
Chip info:
        model:ESP32-S3
        cores:2
        feature:/802.11bgn/BLE/External-Flash:16 MB
        revision number:2

More Information.

No response

igrr commented 4 weeks ago

You probably need to register UART VFS first. If UART is used as console output this is done automatically, but otherwise the VFS driver isn't registered to save resources.

https://github.com/espressif/esp-idf/blob/a0f798cfc4bbd624aab52b2c194d219e242d80c1/components/esp_driver_uart/include/driver/uart_vfs.h#L20

lujiex commented 4 weeks ago

You probably need to register UART VFS first. If UART is used as console output this is done automatically, but otherwise the VFS driver isn't registered to save resources.

https://github.com/espressif/esp-idf/blob/a0f798cfc4bbd624aab52b2c194d219e242d80c1/components/esp_driver_uart/include/driver/uart_vfs.h#L20

Thanks, you solved my problem. I called "uart_vfs_dev_register();" before initializing the serial port. After that, it can open normally. The following code is running normally: image

haberturdeur commented 1 week ago

Hi @lujiex, if the issue has been resolved, could you please close it as done? Thank you.