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

Added Hardware Up and Down RTS Setting for RS485. #594

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

embeddedmz
Copy link
Contributor

@embeddedmz embeddedmz commented Jul 20, 2021

Hello,

Actually, in libmodbus, there's only RTS up or down setting via software and its accuracy depends on RTS delay value.

In this pull request, I added the possibility to use hardware RTS up or down setting (using the serial driver).

I made my tests with ModRSim2 (Modbus slave simulator running on Windows 10) and the Trizeps 7 board running Ubuntu 18.04 (i.MX6 CPU, the serial driver/UART is related to that CPU).

If this is good for you, I will add the proper documentation before you accept my changes.

Best regards.

@cla-bot
Copy link

cla-bot bot commented Jul 20, 2021

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Mohamed Amine Mzoughi.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@embeddedmz embeddedmz changed the title Added Hardware Up and Down RTS Setting. Added Hardware Up and Down RTS Setting for RS485. Jul 20, 2021
@cla-bot
Copy link

cla-bot bot commented Jul 4, 2022

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

@embeddedmz
Copy link
Contributor Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jul 4, 2022

We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient...

@cla-bot
Copy link

cla-bot bot commented Jul 4, 2022

The cla-bot has been summoned, and re-checked this pull request!

@stephane
Copy link
Owner

This part was already complex but with the splitting between software and hardware, it's even more complex but I think you need it so it makes sense to add this code.

As you proposed, proper documentation would be nice.

@cla-bot cla-bot bot added the cla-signed label Aug 4, 2022
@embeddedmz
Copy link
Contributor Author

embeddedmz commented Aug 4, 2022

@stephane When you merge my other PR, let me know so I can update my master branch so you can merge this if everything is good for you.

On the other hand, if anyone needs this feature on Windows (I did it on Windows CE 7 in quick and dirty mode https://github.com/embeddedmz/libmodbus_trizeps_vii_arm_wince), in static int _modbus_rtu_connect(modbus_t *ctx), just use this statement somewhere:

/* Specifies that the RTS line will be high if bytes are available for transmission. After all buffered bytes have been sent, the RTS line will be low. */
dcb.fRtsControl = RTS_CONTROL_TOGGLE;

Maybe, I will work on that issue one day (making modbus_rtu_set_rts function also works on Windows platform).

@embeddedmz
Copy link
Contributor Author

@stephane the branch is now up to date and ready to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants