Page 1 of 1

Flashing procedure not able to open port

Posted: Mon May 08, 2023 9:03 am
by column
Trying to build LVGL port to ESP32 demo project and flash to WT32-SC01 PLUS With 3.5 inch 320X480 module with ESP32-S2-WROVER chip. Build was done with ESP-IDF v4.4.4 version without problems. But flashing command idf.py -p 9 flash generates error:

Code: Select all

Executing action: flash
Running ninja in directory c:\cpp_test\!esp32\lv_port_esp32\build
Executing "ninja flash"...
[1/5] cmd.exe /C "cd /D C:\cpp_test\!esp32\lv_port_esp32\b....bin C:/cpp_test/!esp32/lv_port_esp32/build/lvgl-demo.bin"
lvgl-demo.bin binary size 0x67210 bytes. Smallest app partition is 0x100000 bytes. 0x98df0 bytes (60%) free.
[2/5] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D C:\cpp_test\!esp32\lv_port_esp32\build\bootloader\esp-idf\esptool_py && C:\Espressif\python_env\idf4.4_py3.11_env\Scripts\python.exe C:/espressif/frameworks/esp-idf-v4.4.4/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/cpp_test/!esp32/lv_port_esp32/build/bootloader/bootloader.bin"
Bootloader binary size 0x63b0 bytes. 0xc50 bytes (11%) free.
[2/3] cmd.exe /C "cd /D C:\espressif\frameworks\esp-idf-v4...sp-idf-v4.4.4/components/esptool_py/run_serial_tool.cmake"
esptool.py esp32 -p 9 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 lvgl-demo.bin 0x8000 partition_table/partition-table.bin
Traceback (most recent call last):
esptool.py v3.3.2
Serial port 9
  File "C:\espressif\frameworks\esp-idf-v4.4.4\components\esptool_py\esptool\esptool.py", line 5482, in <module>
    _main()
  File "C:\espressif\frameworks\esp-idf-v4.4.4\components\esptool_py\esptool\esptool.py", line 5475, in _main
    main()
  File "C:\espressif\frameworks\esp-idf-v4.4.4\components\esptool_py\esptool\esptool.py", line 4782, in main
    esp = esp or get_default_connected_device(ser_list, port=args.port, connect_attempts=args.connect_attempts,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\espressif\frameworks\esp-idf-v4.4.4\components\esptool_py\esptool\esptool.py", line 115, in get_default_connected_device
    _esp = chip_class(each_port, initial_baud, trace)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\espressif\frameworks\esp-idf-v4.4.4\components\esptool_py\esptool\esptool.py", line 345, in __init__
    self._port = serial.serial_for_url(port)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Espressif\python_env\idf4.4_py3.11_env\Lib\site-packages\serial\__init__.py", line 90, in serial_for_url
    instance.open()
  File "C:\Espressif\python_env\idf4.4_py3.11_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 '9': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)
CMake Error at run_serial_tool.cmake:56 (message):
  C:/Espressif/python_env/idf4.4_py3.11_env/Scripts/python.exe
  C:/espressif/frameworks/esp-idf-v4.4.4/components/esptool_py/esptool/esptool.py
  --chip esp32 failed


FAILED: CMakeFiles/flash C:/cpp_test/!esp32/lv_port_esp32/build/CMakeFiles/flash
cmd.exe /C "cd /D C:\espressif\frameworks\esp-idf-v4.4.4\components\esptool_py && C:\espressif\tools\cmake\3.23.1\bin\cmake.exe -D IDF_PATH="C:/espressif/frameworks/esp-idf-v4.4.4" -D SERIAL_TOOL="C:/Espressif/python_env/idf4.4_py3.11_env/Scripts/python.exe C:/espressif/frameworks/esp-idf-v4.4.4/components/esptool_py/esptool/esptool.py --chip esp32" -D SERIAL_TOOL_ARGS="--before=default_reset --after=hard_reset write_flash @flash_args" -D WORKING_DIRECTORY="C:/cpp_test/!esp32/lv_port_esp32/build" -P C:/espressif/frameworks/esp-idf-v4.4.4/components/esptool_py/run_serial_tool.cmake"
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

How to solve this problem?

Re: Flashing procedure not able to open port

Posted: Mon May 08, 2023 9:37 am
by ESP_Roland
"9" is not a proper port name. Ports start with "COM" on Windows. So it should be something like COM9, but most probably COM3 or COM4. You can check this in your Device manager and see which one appears when you connect your device.

Re: Flashing procedure not able to open port

Posted: Mon May 08, 2023 10:09 pm
by corz.org
And on Linux it will be..

Code: Select all

/dev/tty<Something>
Definitely something wrong with the hardware setup there.