You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have observed odd behavior with the Serial Monitor port auto-detection. Some background details:
Build Environment:
WIN10 Pro/64
Platformio IDE 1.10.0 installed on VSCode
Platform is espressif32 V1.11.1
lolin_d32_pro board
USB is assigned to COM4
PIO Home=>Devices:
COM1 Communications Port (COM1) ACPI\PNP0501\0
COM2 High-Speed USB Serial Port (COM2) QUADPORT\QUAD_SERIAL_INTERFACE\7&29C3DB4D&0&0000
COM3 High-Speed USB Serial Port (COM3) QUADPORT\QUAD_SERIAL_INTERFACE\7&29C3DB4D&0&0001
COM4 USB-SERIAL CH340 (COM4) USB VID:PID=1A86:7523 SER=5 LOCATION=1-9
COM5 USB Serial Port (COM5) USB VID:PID=0403:6001 SER=PXF3PKCPA
Problem Summary
Board flashing’s Upload auto-detect is working correctly. But the serial monitor does not auto-detect. Instead it lists the available ports and waits for me to enter the COMx port name. As expected, typing "COM4" (or "4") launches the serial monitor. But I want the serial monitor to be auto-detected and not require any user intervention.
This is the list I see in the terminal window when Serial Monitor is launched from the IDE:
--- Available ports:
--- 1: COM1 'Communications Port (COM1)'
--- 2: COM2 'High-Speed USB Serial Port (COM2)'
--- 3: COM3 'High-Speed USB Serial Port (COM3)'
--- 4: COM4 'USB-SERIAL CH340 (COM4)'
--- 5: COM5 'USB Serial Port (COM5)'
--- Enter port index or full name:
Solution Attempt No. 1
I tried specifying the COM port with a wildcard in platformio.ini. Like this: monitor_port = COM*
The good news is that this automatically launches the monitor terminal after the flash Upload, but it chooses the wrong port for the serial monitor. For example, the ESP32 board is on COM4, but the monitor_port wildcard is picking COM5.
Solution Attempt No. 2
I found that specifying the monitor_port COM4 value in platformio.ini works correctly. Like this: monitor_port = COM4
After a flash Upload this automatically opens the serial monitor for my serial debugging. But specifying a fixed COMx is problematic since port usage can vary with the other project members.
Solution Attempt No. 3
I removed the COM5 USB adapter and everything works perfectly; Both upload and serial monitor are correctly auto-detected. I wondered if it could it be a bad USB device.
So I installed a randomly chosen FT232RL USB adapter. It was assigned COM10. I rebooted the PC and got back into the Platformio IDE. As before, when I launched the Serial Monitor it did not auto-detect. The available COM ports list appeared, like this:
--- Available ports:
--- 1: COM1 'Communications Port (COM1)'
--- 2: COM2 'High-Speed USB Serial Port (COM2)'
--- 3: COM3 'High-Speed USB Serial Port (COM3)'
--- 4: COM4 'USB-SERIAL CH340 (COM4)'
--- 5: COM10 'USB Serial Port (COM10)'
--- Enter port index or full name:
Choosing COM4 enables the ESP32’s serial monitor. So at this point the behavior follows what I saw when the COM5 device was present.
But now when I do a flash upload it auto-detects COM10! I removed the COM10 USB device and flash Upload correctly auto-detects COM4.
Solution Attempt No. 4
I suspect (best guess) that port auto detection relies on the USB chip's VID and PID values. The Lolin D32 Pro uses a CH340 that has VID=1A86 and PID=7523.
As an experiment, I edited the build section of the d32_pro board.json file and added the USB ID's as follows:
I have observed odd behavior with the Serial Monitor port auto-detection. Some background details:
Problem Summary
Board flashing’s Upload auto-detect is working correctly. But the serial monitor does not auto-detect. Instead it lists the available ports and waits for me to enter the COMx port name. As expected, typing "COM4" (or "4") launches the serial monitor. But I want the serial monitor to be auto-detected and not require any user intervention.
This is the list I see in the terminal window when Serial Monitor is launched from the IDE:
Solution Attempt No. 1
I tried specifying the COM port with a wildcard in platformio.ini. Like this: monitor_port = COM*
The good news is that this automatically launches the monitor terminal after the flash Upload, but it chooses the wrong port for the serial monitor. For example, the ESP32 board is on COM4, but the monitor_port wildcard is picking COM5.
Solution Attempt No. 2
I found that specifying the monitor_port COM4 value in platformio.ini works correctly. Like this: monitor_port = COM4
After a flash Upload this automatically opens the serial monitor for my serial debugging. But specifying a fixed COMx is problematic since port usage can vary with the other project members.
Solution Attempt No. 3
I removed the COM5 USB adapter and everything works perfectly; Both upload and serial monitor are correctly auto-detected. I wondered if it could it be a bad USB device.
So I installed a randomly chosen FT232RL USB adapter. It was assigned COM10. I rebooted the PC and got back into the Platformio IDE. As before, when I launched the Serial Monitor it did not auto-detect. The available COM ports list appeared, like this:
--- Available ports:
--- 1: COM1 'Communications Port (COM1)'
--- 2: COM2 'High-Speed USB Serial Port (COM2)'
--- 3: COM3 'High-Speed USB Serial Port (COM3)'
--- 4: COM4 'USB-SERIAL CH340 (COM4)'
--- 5: COM10 'USB Serial Port (COM10)'
--- Enter port index or full name:
Choosing COM4 enables the ESP32’s serial monitor. So at this point the behavior follows what I saw when the COM5 device was present.
But now when I do a flash upload it auto-detects COM10! I removed the COM10 USB device and flash Upload correctly auto-detects COM4.
Solution Attempt No. 4
I suspect (best guess) that port auto detection relies on the USB chip's VID and PID values. The Lolin D32 Pro uses a CH340 that has VID=1A86 and PID=7523.
As an experiment, I edited the build section of the d32_pro board.json file and added the USB ID's as follows:
This did not change anything, all observed symptoms remained the same.
To summarize the issue, upload and monitor port auto-detection is unreliable.
The text was updated successfully, but these errors were encountered: