Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set RTS option and explain its effect #580

Merged

Conversation

michaelosthege
Copy link
Contributor

I struggled with unreliable connection initialization with my ESP32-based panel.
The command line was sometimes all garbled up and sometimes not.

My ESP32 was restarting every time the COM port was opened/closed, and since it takes ~10 seconds to initialize, it wouldn't reliably establish the connection.

I found that DTS and RTS are both misused as a reset signal, and after setting RTS=off the restarts disappeared and the connection not initializes reliably.

To help other people I would propose to set the RTS option explicitly.

The `RTS=on` was the default so far,
but `RTS=off` is needed to prevent ESP32
controllers from restarting.
@charliefoxtwo
Copy link
Member

Could you elaborate more on what the RTS option does? I'm not familiar with most of the arduino and COM stuff, but I haven't heard any reports about any other users experiencing the issue you've described so I'd be hesitant to merge something which - while it may fix an issue for one individual - may cause issues for many others.

I'm assuming based on your description that the RTS value is set to on by default so this PR doesn't actually change anything other than expose a new option which may help people, but if that's the case I'd appreciate it if you could link to additional documentation. Thanks!

@michaelosthege
Copy link
Contributor Author

This thread explains the original purpose of these flags: https://stackoverflow.com/questions/957337/what-is-the-difference-between-dtr-dsr-and-rts-cts-flow-control

This thread shows a wiring diagram for ESP-8266 boards (https://arduino.stackexchange.com/a/52175) and explained that it's used to reset the microcontroller. Apparently that's the same for my ESP-32.

The mode command in the script sets the COM device setting, and for me it always printed RTS=on until I set the option. It's help shows:

mode /?
Configures system devices.

Serial port:       MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s]
                                [to=on|off] [xon=on|off] [odsr=on|off]
                                [octs=on|off] [dtr=on|off|hs]
                                [rts=on|off|hs|tg] [idsr=on|off]

Unfortunately the documentation does not clarify the defaults either.

@charliefoxtwo
Copy link
Member

I'm really hesitant to merge this without knowing what the default is.

It doesn't help that it's like impossible to look up anything for the command because it's named mode lol

@michaelosthege
Copy link
Contributor Author

Could be that the default is whatever was previously set for that COM port.

Let's just keep the comment then, and not actually set the option.

michaelosthege

This comment was marked as duplicate.

@charliefoxtwo
Copy link
Member

I'm all for improved documentation. The docs you linked also said hs | tg were valid options - did you want to add those as well (or maybe they just don't work in this context, I wouldn't know)?

@michaelosthege
Copy link
Contributor Author

I understand that DCS-BIOS does not implement the interpretation of these signals, there fore I don't expect them to be useful at this point.

@charliefoxtwo charliefoxtwo added this pull request to the merge queue May 18, 2024
Merged via the queue into DCS-Skunkworks:master with commit 59442b8 May 18, 2024
2 checks passed
@michaelosthege michaelosthege deleted the connect-rts-setting branch May 19, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants