RTS is set / asserted periodically on ConnectEZ 4i

I have a Connect EZ4i and I would like to use the RS232 RTS pin to control the state of a device (i.e. the device has a pin that acts as a digital switch >2V is ‘on’ and <⅔V is ‘off’). I have had success toggling the state of the RTS pin when the device is in RealPort or Application mode via controls in e.g. RealTerm and an interactive python shell with serial.Serial.setRTS(1 or 0), respectively.

What’s odd is that after the pin is ‘cleared’ within 30 seconds (sometimes less than a second) the pin once again has positive voltage on it. If I close the port (confirmed by port indicator light going out) when RTS is clear then the pin stays ‘cleared’.

As an RS232 device of course the pin voltage is +/- ~5-6V depending on exactly how much current draw there is so I have a diode forward-biased in series with the pin and a 10kOhm pulldown resistor after the diode with its other side connected to ground effectively clamping the voltage between diode & resistor to ~5V & 0V.

If I remove this diode & pulldown circuit the behavior persists but the voltages are the expected open-circuit +6V, -5.9V.

I’ve observed this behavior in Application mode via shell via SSH as well as via shell via direct microUSB console connection.

I could of course setRTS to whatever state I need it to be in periodically and ignore the potential ‘hiccup’ states where RTS manages to end up in the positive voltage state momentarily but it’s a patch on something that I don’t think should be happening in the first place.

Anyone have any ideas what’s going on and how to address it?

Firmware versions observed on are: 21.5.56.108 & 22.8.33.50, settings for ease of reproducibility are serial set to Application mode, RTS toggle off, opening shell accesss, and interactive python with:

s = serial.Serial("/dev/serial/port1", 19200)
s.setRTS(0)
Immediately see negative/zero voltage on RTS pin.
Wait up to ~30 seconds, observe positive voltage on RTS pin.
s.setRTS(0)
Immediately see negative/zero voltage again.
s.close()
Note that RTS state stays in negative/zero voltage; RTS state when opened doesn’t matter.

It looks like Linux (of which I assume the Connect EZ is running some Yocto flavor) tends to set RTS & DTR at every open of the /dev/serial/* devices which could explain why the RTS line goes high periodically if there is something going around every ~30s checking on the port statuses.

Good discussions at:

(1/2 as I’m too new to post enough links)

(2/2) The other links:

DTR and RTS control lines toggle unintentionally when opening port · Issue #124 · pyserial/pyserial · GitHub covers the topic from a pyserial focus.

1 Like