# RTS is set / asserted periodically on ConnectEZ 4i

**URL:** <https://forums.digi.com/t/rts-is-set-asserted-periodically-on-connectez-4i/23367>\
**Category:** Connect EZ\
**Tags:** serial\
**Created:** [December 18, 2022, 11:07pm UTC](https://forums.digi.com/t/rts-is-set-asserted-periodically-on-connectez-4i/23367 "2022-12-18T23:07:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![velosol](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@velosol](https://forums.digi.com/u/velosol)\
**Post date:** [December 18, 2022, 11:07pm UTC](https://forums.digi.com/t/rts-is-set-asserted-periodically-on-connectez-4i/23367/1 "2022-12-18T23:07:36Z")

</div>

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 `open`ed doesn’t matter.

---

<div class="post-metadata">

**Author:** ![velosol](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@velosol](https://forums.digi.com/u/velosol)\
**Post date:** [December 21, 2022, 12:16am UTC](https://forums.digi.com/t/rts-is-set-asserted-periodically-on-connectez-4i/23367/2 "2022-12-21T00:16:01Z")

</div>

It looks like Linux (of which I assume the Connect EZ is running some Yocto flavor) tends to set RTS & DTR at [every open](https://github.com/pyserial/pyserial/issues/124#issuecomment-392219489) 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:

> <https://unix.stackexchange.com/questions/446088/how-to-prevent-dtr-on-open-for-cdc-acm>

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

---

<div class="post-metadata">

**Author:** ![velosol](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@velosol](https://forums.digi.com/u/velosol)\
**Post date:** [December 21, 2022, 12:16am UTC](https://forums.digi.com/t/rts-is-set-asserted-periodically-on-connectez-4i/23367/3 "2022-12-21T00:16:43Z")

</div>

(2/2) The other links:

> <https://github.com/npat-efault/picocom/blob/master/lowerrts.md>

[DTR and RTS control lines toggle unintentionally when opening port · Issue #124 · pyserial/pyserial · GitHub](https://github.com/pyserial/pyserial/issues/124) covers the topic from a pyserial focus.

---

<div class="post-metadata">

**Author:** ![velosol](https://avatars.discourse-cdn.com/v4/letter/v/f05b48/32.png) [@velosol](https://forums.digi.com/u/velosol)\
**Post date:** [May 29, 2023, 3:08pm UTC](https://forums.digi.com/t/rts-is-set-asserted-periodically-on-connectez-4i/23367/4 "2023-05-29T15:08:01Z")

</div>

I happened across one other quirk recently where I was using this functionality wrapped in a class and a simple `s.rts = 0` caused RTS to only briefly flash off but an inefficient busy wait for a few seconds turned off RTS and kept it off after the timeout expires.

```auto
timeout = time.time() + 4
while time.time() < timeout:
    s.rts = 0

```

I didn’t spend any time debugging this further but wanted to share a fix in case anyone else needs it. If you need to set RTS back to 1 a single instance (no busy wait) is enough.
