Hello!
I'm trying to forward the ESP serial port for remote firmware.
ESP is connected to the Windows machine and the flashing port is com41, the port in normal mode (usb>serial) is com43. First I try the normal mode.
On this computer I start a connection to the Linux server:
socat /dev/ttyS42,raw,echo=0 TCP:serverip:1723 (com43 to remote)
The server is running: socat -d -d -d PTY,link=/dev/ttyS10,raw,echo=0 tcp-listen:1723 (remote to virtual ttyS10)
I uploaded a sketch to ESP that outputs the test line to the serial and it works on the server: cat /dev/ttyS10 shows the lines "test" from esp. Everything is working.
However, when I put the ESP into download mode and try to connect com41 for flashing remotelly:
socat -d -d -d /dev/ttyS40,raw,echo=0 TCP:serverip:1723
I get instantly:
2023/12/06 06:45:23 socat[4324] I interpreting address "/dev/ttyS40" as file name
2023/12/06 06:45:23 socat[4324] I setting option "raw"
2023/12/06 06:45:23 socat[4324] I setting option "echo" to 0
2023/12/06 06:45:23 socat[4324] I "/dev/ttyS40" is not a socket, open()'ing it
2023/12/06 06:45:23 socat[4324] N opening character device "/dev/ttyS40" for reading and writing
2023/12/06 06:45:23 socat[4324] I open("/dev/ttyS40", 012, 0666) -> 3
2023/12/06 06:45:23 socat[4324] W cannot query current terminal settings on fd 3: Invalid argument
2023/12/06 06:45:23 socat[4324] E tcgetattr(3, 0x28a844): Invalid argument
2023/12/06 06:45:23 socat[4324] N exit(1)
What's wrong?
esp32s2 flash remotely, socat
-
- Posts: 9749
- Joined: Thu Nov 26, 2015 4:08 am
Re: esp32s2 flash remotely, socat
Not sure why that doesn't work, but you may want to look at the functionality esptool has natively for this: see the comments here.
Re: esp32s2 flash remotely, socat
thanks, im using socat on windows side:ESP_Sprite wrote: ↑Wed Dec 06, 2023 7:23 amNot sure why that doesn't work, but you may want to look at the functionality esptool has natively for this: see the comments here.
Code: Select all
socat -d /dev/ttyS%COM-1% tcp:serverrip:port1
Code: Select all
socat -d TCP4-LISTEN:port1,reuseaddr TCP4-LISTEN:port2,reuseaddr,fork,bind=127.0.0.1
Code: Select all
esptool.py --chip esp32s2 --port socket://127.0.0.1:port2 write_flash ...
- ESP_krzychb
- Posts: 400
- Joined: Sat Oct 01, 2016 9:05 am
- Contact:
Re: esp32s2 flash remotely, socat
Great news you made it working!
For anybody exploring this topic, please refer to Esptool.py Documentation > Remote Serial Ports
For anybody exploring this topic, please refer to Esptool.py Documentation > Remote Serial Ports
Re: esp32s2 flash remotely, socat
I read this page, it was very helpful, thank you! The only thing I don’t like is that sometimes the firmware is only installed on the second attempt, as I noticed, after a reset with entering the bootloader. The esptool closes after the esp reset > enter bootloader and something like that. But I did the firmware via the website and PHP, so there may be some glitches there)ESP_krzychb wrote: ↑Wed Dec 06, 2023 11:29 amGreat news you made it working!
For anybody exploring this topic, please refer to Esptool.py Documentation > Remote Serial Ports
Who is online
Users browsing this forum: No registered users and 89 guests