Could not flash after flashing successfully the first time in VS Code
Posted: Mon Jul 05, 2021 1:12 am
Hi,
I was trying the blink example project with the Youtube video about the Espressif extensions using VS Code. I was able to build the project, selected the com port then flash with UART.
However, then second time I followed the exact same sequence, I got error saying "Failed to flash because of some unusual error". Here is the output:
> Executing task: C:\Users\.espressif\python_env\idf4.3_py3.8_env\Scripts\python.exe C:\Users\chenjo5\esp\esp-idf\components\esptool_py\esptool\esptool.py -p COM12 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 blink.bin 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin <
esptool.py v3.1-dev
Serial port COM12
Traceback (most recent call last):
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 4535, in <module>
_main()
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 4528, in _main
main()
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 4027, in main
esp = esp or get_default_connected_device(ser_list, port=args.port, connect_attempts=args.connect_attempts,
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 120, in get_default_connected_device
_esp = chip_class(each_port, initial_baud, trace)
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 310, in __init__
self._port = serial.serial_for_url(port)
File "C:\Users\.espressif\python_env\idf4.3_py3.8_env\lib\site-packages\serial\__init__.py", line 90, in serial_for_url
instance.open()
File "C:\Users\.espressif\python_env\idf4.3_py3.8_env\lib\site-packages\serial\serialwin32.py", line 64, in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM12': PermissionError(13, 'Access is denied.', None, 5)
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command C:\Users\.espressif\python_env\idf4.3_py3.8_env\Scripts\python.exe C:\Users\chenjo5\esp\esp-idf\components\esptool_py\esptool\esptool.py -p COM12 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 blink.bin 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin" terminated with exit code: 1.
Can you help me to solve this problem?
If I close VS Code, open again and repeated the same sequence, it was ok to flash. But the second time still failed.
Thanks!
I was trying the blink example project with the Youtube video about the Espressif extensions using VS Code. I was able to build the project, selected the com port then flash with UART.
However, then second time I followed the exact same sequence, I got error saying "Failed to flash because of some unusual error". Here is the output:
> Executing task: C:\Users\.espressif\python_env\idf4.3_py3.8_env\Scripts\python.exe C:\Users\chenjo5\esp\esp-idf\components\esptool_py\esptool\esptool.py -p COM12 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 blink.bin 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin <
esptool.py v3.1-dev
Serial port COM12
Traceback (most recent call last):
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 4535, in <module>
_main()
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 4528, in _main
main()
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 4027, in main
esp = esp or get_default_connected_device(ser_list, port=args.port, connect_attempts=args.connect_attempts,
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 120, in get_default_connected_device
_esp = chip_class(each_port, initial_baud, trace)
File "C:\Users\esp\esp-idf\components\esptool_py\esptool\esptool.py", line 310, in __init__
self._port = serial.serial_for_url(port)
File "C:\Users\.espressif\python_env\idf4.3_py3.8_env\lib\site-packages\serial\__init__.py", line 90, in serial_for_url
instance.open()
File "C:\Users\.espressif\python_env\idf4.3_py3.8_env\lib\site-packages\serial\serialwin32.py", line 64, in open
raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM12': PermissionError(13, 'Access is denied.', None, 5)
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command C:\Users\.espressif\python_env\idf4.3_py3.8_env\Scripts\python.exe C:\Users\chenjo5\esp\esp-idf\components\esptool_py\esptool\esptool.py -p COM12 -b 460800 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_freq 40m --flash_size detect 0x10000 blink.bin 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin" terminated with exit code: 1.
Can you help me to solve this problem?
If I close VS Code, open again and repeated the same sequence, it was ok to flash. But the second time still failed.
Thanks!