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

RS485 for Modbus RTU #5

Closed
Hubieg opened this issue Nov 25, 2017 · 8 comments
Closed

RS485 for Modbus RTU #5

Hubieg opened this issue Nov 25, 2017 · 8 comments
Assignees
Labels

Comments

@Hubieg
Copy link

Hubieg commented Nov 25, 2017

Greetings,

I now have my Monarco hat and everything up and running. One Wire works perfectly from inside codesys. I do however seem to be having some issues with the compilation of some libraries. I will wait a bit for that though. My "issue" is I am wondering if I can use the native Codesys RS-485 Modbus RTU support with your system and without external libraries and calls? I see in the example you have separate calls for RS-485.

I ran a "dmesg" and it is showing /dev/ttyAMA0 (which I assume from your documentation may be the "terminal". I also see /dev/ttyS0. What I am wondering is if either of these may be a direct line to the RS485 that can be used directly from the Codesys Modbus RTU drivers? Looking at the Codesys forum I found that when a USB - RS485 adapter is used, it is added as follows:

""so you need to add in /etc/CODESYSControl.cfg
(Attention you need to remove the 0 from USB0)

[SysCom]
Linux.Devicefile=/dev/ttyUSB
portnum := COM.SysCom.SYS_COMPORT1;""

Assuming that ttyS0 is a direct line to the RS485 port, would you agree that adding "Linux.Devicefile=/dev/ttyS" would bring me directly to the RS485? I am a bit worried by this as we already have the Linux.Devicefile=/dev/ttyAMA and the portnum command doesnt seem to attach to a particular tty (unless it attaches only to the preceeding devicefile call).

What is your take on all of this?

@Aliazzzz Aliazzzz self-assigned this Nov 27, 2017
@Aliazzzz
Copy link
Owner

Dear Hubieg,

Sorry for the late anwser.

For RS485 You cannot go without external libraries! The only direct interaction with the HAT is needed to set some RS485 settings, like baudrate, bits per byte, parity and stopbits, also to check some faulkt counters. The rest is done via the external library.
Fortunatly, you can pick your own flavour of library, which in my opinion is a big plus. So, I deliberatly chose a CAA type library ( Uniformity (standard behaviour model, more platform independendant)

Also, My advice would be to carefully read the Monarco documentation on the RS485 interface, found here: https://github.com/monarco/monarco-hat-documentation.

A personal note:
I included RS485 for completeness, but I personally do not have any use for it. Maybe you can hook up a Heater via the thermostat wiring, as this an RS485 connection (Opentherm talks via 2 wire RS485) so that can be a nice home automation project. Personally, I'd choose a CAN interface on that place, but that's life.

@Hubieg
Copy link
Author

Hubieg commented Nov 27, 2017 via email

@Aliazzzz
Copy link
Owner

Aliazzzz commented Nov 27, 2017

Dear Hubieg,

I would like to let you know that I am planning to release a new version within a month from now (I hope).

This version will not be entirely backward compatible with v0.9.0.3 but it will bring you more comfort with using the HAT's IO. So, using RS485, 1w, and RTC should not be affected by this update, but all other IO will.

So, stay tuned for it.

@Aliazzzz Aliazzzz reopened this Nov 27, 2017
@Hubieg
Copy link
Author

Hubieg commented Nov 27, 2017 via email

@Aliazzzz
Copy link
Owner

Aliazzzz commented Nov 28, 2017

PS let me know how you test RS485!

I am curious on how you are testing this, because I suspect the problem is Linux/ hardwaredriver related.

@Aliazzzz Aliazzzz reopened this Nov 28, 2017
@Hubieg
Copy link
Author

Hubieg commented Nov 28, 2017 via email

@Hubieg
Copy link
Author

Hubieg commented Nov 28, 2017 via email

@Aliazzzz
Copy link
Owner

As I too have a dayjob, I will wait until you have tested this point on your own system.
Until then I will concentrate on implementation of v0.9.1.1

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

No branches or pull requests

2 participants