Dear,
I use VS Code + esp-idf extension on a Windows 11 PC.
I start the VS Code. Then I run "idf.py fullclean", "idf.py build" and "idf.py flash monitor". This is successful and the last line on the terminal shows the project has completed and returned from app_main(). COM5 was used.
Then I edit the project and save it. I run again "idf.py fullclean" and "idf.py build" successfully. The I run "idf.py flash monitor" which fails. The output on the terminal is:
===
Executing action: flash
Serial port COM5
COM5 failed to connect: Could not open COM5, the port is busy or doesn't exist.
(could not open port 'COM5': PermissionError(13, 'Access is denied.', None, 5))
Hint: Check if the port is not used by another task
No serial ports found. Connect a device, or use '-p PORT' option to set a specific port.
===
Why is COM5 not available?
I believe, I by accident have made a key combination, that has set something such that COM5 is not freed at the end of the execution. Shortly after installing VS Code and esp-idf extension, the COM port was freed at the end of the execution of a project. The COM port is freed when I close VS-Code and re-start it, but that is a clumsy way of working.
How do I get the development environment to free the COM port at the end of execution of a project?
Regards,
Jorgen
Main task ended - COM port not available
-
- Posts: 229
- Joined: Wed May 02, 2018 12:12 pm
Re: Main task ended - COM port not available
Probably because you are not ending the monitor session properly and COM5 is still in use. Make sure to close the monitor before (like running ) for example.
Code: Select all
CTRL + ]
-
- Posts: 188
- Joined: Wed Jul 17, 2019 5:26 pm
Re: Main task ended - COM port not available
Hi Jorgen,
As `idf.py flash monitor `command will flash it to the target and run the serial monitor. Please make sure you to close the processs/terminal before you run again
Thanks
As `idf.py flash monitor `command will flash it to the target and run the serial monitor. Please make sure you to close the processs/terminal before you run again
Thanks
Re: Main task ended - COM port not available
Thanks for the suggestions.
I have tried Ctrl + ] and also Ctrl+T and Ctrl+X, but the COM is still occupied.
I use a Scandinavian keyboard on which the ] is the key combination Alt gr+9.
How can I stop the monitor except for Ctrl+] ?
How can I verify that the monitor is not running?
Regards,
Jorgen
I have tried Ctrl + ] and also Ctrl+T and Ctrl+X, but the COM is still occupied.
I use a Scandinavian keyboard on which the ] is the key combination Alt gr+9.
How can I stop the monitor except for Ctrl+] ?
How can I verify that the monitor is not running?
Regards,
Jorgen
Re: Main task ended - COM port not available
You didnt say anything about hardware.
Is it devkit or custom PCB, is it esp32 or esp32S2/S3?
If S2/S3, is it connected to UART or USB port on devkit (assuming its devkit)?
Is it devkit or custom PCB, is it esp32 or esp32S2/S3?
If S2/S3, is it connected to UART or USB port on devkit (assuming its devkit)?
Re: Main task ended - COM port not available
It is an ESP32-S3-DevKitC-1. I use the USB - UART port on the DevKitC.
Re: Main task ended - COM port not available
I have found a workable solution.
When the project completes execution, then as the first thing press Ctrl+T followed by Ctrl+X. The word Done appears in the terminal window.
Still, the esp-idf closed down the monitor automatically earlier. A setting or something has changed its behavior such that the monitor keeps on running after the project completes execution.
What, where and how?
Regards,
Jorgen
When the project completes execution, then as the first thing press Ctrl+T followed by Ctrl+X. The word Done appears in the terminal window.
Still, the esp-idf closed down the monitor automatically earlier. A setting or something has changed its behavior such that the monitor keeps on running after the project completes execution.
What, where and how?
Regards,
Jorgen
Re: Main task ended - COM port not available
With S3 i would say it is USB port, which disappears after flashing or at least change COMx, but you are using UART port, so its not the case.
Maybe try CTRL+T and CTRL+R after flashing, which should reboots esp32 and start fresh new logs.
Maybe try CTRL+T and CTRL+R after flashing, which should reboots esp32 and start fresh new logs.
Who is online
Users browsing this forum: No registered users and 20 guests