How to program my ESP32 using WSL2?
Posted: Wed Feb 19, 2020 3:57 pm
Hello everyone, I need some help figuring out how to program ESP devices using WSL2.
I'm can compile the code on Ubuntu running on top of WSL2 but I'm still having difficulties flashing and monitoring the builds to my peripherals because as we all know, serial devices are not currently recognized.
Just to clarify, I know that it is possible to flash ESP devices directly through Windows, nevertheless, being Ubuntu my first choice when it comes to development, I would love to get it working on WSL2 (which happens to be way faster at compiling source code compared to WSL1)
I heard that there are some "hacks" that allow us to flash ESP devices by tunneling the COM connection to a TCP one. I tried to do that using "socat" on WSL1 which can interact with ttySX ports quite easily but that doesn't seem to work.
I tried to issue on my WSL1 distro:
and then on WSL2:
but I get:
At this point, I started to become more skeptical about this tunneling strategy, but when I issued everything worked. So, at this point, it looks like I'm unable to write the data to the ESP but I can read it without any problem.
___
Maybe I'm missing something but I'm not sure. I cannot find much documentation on the web and I don't know if this is the way to go. Some help would be appreciated.
I'm can compile the code on Ubuntu running on top of WSL2 but I'm still having difficulties flashing and monitoring the builds to my peripherals because as we all know, serial devices are not currently recognized.
Just to clarify, I know that it is possible to flash ESP devices directly through Windows, nevertheless, being Ubuntu my first choice when it comes to development, I would love to get it working on WSL2 (which happens to be way faster at compiling source code compared to WSL1)
I heard that there are some "hacks" that allow us to flash ESP devices by tunneling the COM connection to a TCP one. I tried to do that using "socat" on WSL1 which can interact with ttySX ports quite easily but that doesn't seem to work.
I tried to issue on my WSL1 distro:
Code: Select all
socat -d TCP4-LISTEN:1367,reuseaddr,fork /dev/ttyS3,raw
Code: Select all
idf.py flash --port socket://<ip_of_my_machine>:1367
Code: Select all
A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x30)
Code: Select all
idf.py monitor --port socket://<ip_of_my_machine>:1367
___
Maybe I'm missing something but I'm not sure. I cannot find much documentation on the web and I don't know if this is the way to go. Some help would be appreciated.