Main task ended - COM port not available
Posted: Tue Mar 26, 2024 2:21 pm
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
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