Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to flash esp32. the port doesn't exist

Tags:

esp32

I've been trying to flash esp-wroom-32 for a long time, but I can't seem to get it. idf.py throws this error:

Serial port /dev/ttyUSB0
A fatal error occurred: Could not open /dev/ttyUSB0, the port doesn't exist
CMake Error at run_serial_tool.cmake:55 (message):
  /home/matvey/.espressif/python_env/idf5.1_py3.9_env/bin/python;;/home/matvey/esp/esp-idf/components/esptool_py/esptool/esptool.py;--chip;esp32
  failed
FAILED: CMakeFiles/flash /home/matvey/esp/esp-idf/examples/get-started/hello_world/build/CMakeFiles/flash
cd /home/matvey/esp/esp-idf/components/esptool_py && /usr/bin/cmake -D IDF_PATH=/home/matvey/esp/esp-idf -D "SERIAL_TOOL=/home/matvey/.espressif/python_env /idf5.1_py3.9_env/bin/python;;/home/matvey/esp/esp-idf/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=/home/matvey/esp/esp-idf/examples/get-started/hello_world/build -P /home/matvey/esp/esp-idf/components/ esptool_py/run_serial_tool.cmake
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the /home/matvey/esp/esp-idf/examples/get-started/hello_world/build/log/idf_py_stderr_output_27303 and /home/matvey/esp/esp-idf/ examples/get-started/hello_world/build/log/idf_py_stdout_output_27303`

I have no idea what could be the problem, I changed the udev settings, but maybe it did not work for me.

like image 493
Матвей павлов Avatar asked Nov 24 '25 21:11

Матвей павлов


2 Answers

add yourself to dialout and change permissions on it

$ sudo adduser <username> dialout
$ sudo chmod a+rw /dev/ttyUSB0

It worked for me

like image 66
Cosme Urdaibay Avatar answered Nov 26 '25 11:11

Cosme Urdaibay


this is mostly because you do not have the necessary permission to connect though uart drivers

could solve it by granting permissions everytime you connect a device by $ sudo chmod a+rw /dev/ttyUSB0 but will again fail on reboot

to grant permissions do this instead

$ lsusb to identify the uart device your working with

$ sudo usermod -aG dialout $USER to add user to the dialout group

sudo nano /etc/udev/rules.d/99-usb-serial.rules

set the rules here

SUBSYSTEMS=="usb", ATTRS{idVendor}=="xxxx", ATTRS{idProduct}=="yyyy", GROUP="dialout", MODE="0666"

in this replace the xxxx and yyyy with ur deviceid and productid that you found after running lsusb

for example for this Bus 001 Device 012: ID 10c4:ea60 Silicon Labs CP210x UART Bridge

do this SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="dialout", MODE="0666"

then reload sudo udevadm control --reload-rules

and All set

like image 33
Vinay Chandra Avatar answered Nov 26 '25 11:11

Vinay Chandra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!