Page 1 of 1

Program remotely, rfc2217 not fully supported

Posted: Thu Apr 24, 2025 7:49 am
by HansW01
- I am using windows as host
- trying to program esp32c3
- I want to use the docker image as build system to easily change and prevent "works on my desk"/"works for me"
- found out docker on windows/mac does not support forwarding usb devices to containers. (very disappointed in Docker now)
- so I followed the using-remote-serial-port guide to start a telnet connection.
- I copied esp_rfc2217_server.exe and esp_tool into the project directory.

I start a Powershell for the server:

Code: Select all

cd <project dir>
.\esp_rfc2217_server.exe  -v -p 4000 COM4
I get as output:
INFO:root: RFC 2217 TCP/IP to Serial redirector - type Ctrl-C / BREAK to quit
INFO:root: Serving serial port: COM4
INFO:root: TCP/IP port: 4000

In another powershell I start the container:

Code: Select all

cd <project dir>
docker run -v ${PWD}:/project -w /project -e HOME=temp -it espressif/idf:release-v5.3
From within the container I try to build:

Code: Select all

idf.py -DIDF_TARGET=esp32c3 --port 'rfc2217://host.docker.internal:4000?ign_set_control' flash monitor
Everything builds fine but I get an error on the connection:
A fatal error occurred: Could not open rfc2217://host.docker.internal:4000?ign_set_control, the port is busy or doesn't exist.
(Remote does not seem to support RFC2217 or BINARY mode [we-BINARY:False(INACTIVE), we-RFC2217:False(REQUESTED)])
same result without monitor.

In the other window I actually see the rfc2217 server changing baudrates, so looks to be working but still a weird error.
INFO:root:Connected by 127.0.0.1:50664
INFO:rfc2217.server:client accepts RFC 2217
INFO:rfc2217.server:NOTIFY_MODEMSTATE: False
INFO:rfc2217.server:client accepts RFC 2217
INFO:rfc2217.server:NOTIFY_MODEMSTATE: False
INFO:rfc2217.server:set baud rate: 9600
INFO:rfc2217.server:set data size: 8
INFO:rfc2217.server:set parity: N
INFO:rfc2217.server:set stop bits: 1
INFO:rfc2217.server:changed flow control to None
INFO:rfc2217.server:Activating reset in thread
INFO:rfc2217.server:purge in
INFO:rfc2217.server:purge out
INFO:rfc2217.server:set baud rate: 115200
INFO:rfc2217.server:set data size: 8
INFO:rfc2217.server:set parity: N
INFO:rfc2217.server:set stop bits: 1
INFO:rfc2217.server:changed flow control to None
INFO:rfc2217.server:set baud rate: 115200
INFO:rfc2217.server:set data size: 8
INFO:rfc2217.server:set parity: N
INFO:rfc2217.server:set stop bits: 1
INFO:rfc2217.server:changed flow control to None
INFO:rfc2217.server:purge in
INFO:rfc2217.server:Activating reset in thread
INFO:rfc2217.server:purge in
INFO:rfc2217.server:purge out
INFO:rfc2217.server:set baud rate: 115200
INFO:rfc2217.server:set data size: 8
INFO:rfc2217.server:set parity: N
INFO:rfc2217.server:set stop bits: 1
INFO:rfc2217.server:changed flow control to None

Anyone a clue what could be the problem and why it points me to pySerial?

Re: Program remotely, rfc2217 not fully supported

Posted: Fri Apr 25, 2025 9:05 am
by HansW01
In the mean time I have also tried with idf 4.4 container and 4.4 example:

Code: Select all

Serial port rfc2217://host.docker.internal:4000?ign_set_control
Connecting...
Device PID identification is only supported on COM and /dev/ serial ports.
.
Traceback (most recent call last):
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 493, in command
    p = self.read()
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 438, in read
    return next(self._slip_reader)
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 3787, in slip_reader
    raise FatalError(msg)
__main__.FatalError: No serial data received.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
...
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 4955, in main
    esp = esp or get_default_connected_device(ser_list, port=args.port, connect_attempts=args.connect_attempts,
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 116, in get_default_connected_device
    _esp.connect(before, connect_attempts)
...
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 544, in sync
    val, _ = self.command(self.ESP_SYNC, b'\x07\x07\x12\x20' + 32 * b'\x55',
  File "/opt/esp/idf/components/esptool_py/esptool/esptool.py", line 509, in command
    self._port.timeout = saved_timeout
  File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/serial/serialutil.py", line 372, in timeout
    self._reconfigure_port()
  File "/opt/esp/python_env/idf4.4_py3.8_env/lib/python3.8/site-packages/serial/rfc2217.py", line 530, in _reconfigure_port
    raise SerialException("Remote does not accept parameter change (RFC2217): {!r}".format(items))
serial.serialutil.SerialException: Remote does not accept parameter change (RFC2217): dict_values([baudrate:REQUESTED, datasize:REQUESTED, parity:REQUESTED, stopsize:REQUESTED])
CMake Error at run_serial_tool.cmake:56 (message):
  /opt/esp/python_env/idf4.4_py3.8_env/bin/python
  /opt/esp/idf/components/esptool_py/esptool/esptool.py --chip esp32c3 failed
This gives me think it has something to do on the windows/esp_rfc2217_server side?
runing esptool.exe flash_id detects the chip:

Code: Select all

Found 1 serial ports
Serial port COM4
Connecting...
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (QFN32) (revision v0.4)
Features: WiFi, BLE, Embedded Flash 4MB (XMC)
Crystal is 40MHz
MAC: 70:04:1d:22:72:14
Uploading stub...
Running stub...
Stub running...
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...