Using GRV-CSERI ports from a program

We are integrating a device using a RS-485 connection, and we have installed a GRV-CSERI to do this.

I have some questions:

There are some operations that we want to perform on this device when the strategy is not running.

From the shell account, I can see the that devices /dev/ttySerMod0.0 – /dev/ttySerMod0.3 have been defined.

  1. Can I write a linux program to directly write to these devices?

  2. If a strategy has been loaded, are that strategy’s I/O settings used to specify the # wires, termination, and bias settings for the device. If not, how can this be done? (I have looked at this forum post: Configure Epic Serial Module GRV-CSERI-4 but I do not see this question addressed in that post).

  3. Also, the GRV-CSERI requires that a termination mode and a bias setting by specified as part of the configuration. I have read this blog post:
    https://blog.opto22.com/optoblog/rs-485-to-terminate-bias-or-both
    that describe what termination and bias are. It is somewhat helpful. If we selected the “Termination” option, is this the equivalent of adding a 120 ohm resistor to the communication lines?

  1. Great question. I don’t know. Will try and see what I can find out.

  2. If a strategy has been loaded, the module will use those config settings. If a strategy has not been loaded, then you can configure the port type via groov Manage.

  3. https://documents.opto22.com/2296_groov_Serial_Modules_Data_Sheet.pdf
    It mentions in there that the termination option is 120 ohms.

I found a few things out and from that have inferred the answer is ‘should be possible’.

Here you can see the shell program ‘minicom’ receiving data from a GPS receiver sitting on my desk (it was the only serial device I could quickly put my hands on).

You can see I have set the baud rate to 9600, 8 data bits, No parity and 1 stop bit.
I did this from within Minicom. Since I can do it there, I am inferring that you should be able to set the comm port parameters from the Linux program.
Note that I still used groov Manage to set the serial port type (in my GPS case, RS-232).

Note also that /dev/ttySerModx.x is symbolically linked to ttyUSBx
If you do an ‘ls -la’ on the /dev directory, you can see that link. (This took me a hot minute to figure out why the ‘SerMod’ device was not working as expected. EDIT-Found out it was a typo, it works as expected using either the module or the mapped device).

(Note that my groov Serial I/O module is in position 3 on the rack).

EDIT. Found the ‘stty’ command.
http://man7.org/linux/man-pages/man1/stty.1.html
This would be the way to change via a program the serial port settings.

IMPORTANT EDIT. I have found that if you run Node-RED and PAC Control with serial commands addressing the same serial port, you get undesired results. I would expect the same would happen if you tried to use another program to access the serial port at the same time as either of these two methods… In short, pick one method and use it exclusively.

1 Like

Thank you – I will try this out.