Auto Flow Control RS-485 on IGT-20
Due to the fact that RS-485 is half-duplexed, it can either send or receive messages in any single moment. This fact results in some cumberson work to switch the direction of messages of the RS-485. When this RS-485 plays as the role of a master in a communication scenario, it sometimes becomes an issue if the RS-485 consumes too much time to switch from sending back to receiving messages. In that case, this master might lose the response message from the slave it had sent the request.
The RS-485 on IGT-20 features its auto flow control. This functionality enabled users to use RS-485 on IGT-20 without manually controlling the direction of message. That is, the program for RS-232 is also applicable on RS-485 on IGT-20. It’s very convenient and friendly since the serial ports on IGT-20 is configurable among RS-232, RS-422 and RS-485. Once different sensors or devices are required in different applications, users need not to modify their existing program dramatically. Switching the mode of serial port on IGT-20 is described in another article.
Send Message over RS-485 on IGT-20 in CLI
Before we start the evaluation, we need a proper fixture. And the most easy one is a simple loopback. What you need is only two wires, and here’s what I did:
Data+ of ttyS1 and ttyS2 are connected (purple wire), and Data- of ttyS1 and ttyS2 are connected (yellow wire). Plug this fixture into CN3 of IGT-20, and preparation is done.
In this configuration, messages sent from ttyS1 is received by ttyS2, while message sent from ttyS2 is received by ttyS1. To perform the quick loopback test of serial ports on IGT-20, it’s very easy to do it in the CLI. Just type the following command in CLI:
echo "message from ttyS1" > /dev/ttyS1
And the message is sent. However, you can see nothing about it. If you’d like to see to believe, let’s now try to catch the messages on ttyS2.
Receive Message over RS-485 on IGT-20 in CLI
To make it simple for the test, just create another SSH connection to the same IGT-20. And type the following command in CLI:
After that, once you send message from ttyS1 as mentioned above, you can see the message shown in this SSH client. Here’s my screen snap-shot.
In this figure, text in green rectangular is the command, while the red ones are the messages. the “message from ttyS1” in the bottom window is sent to the top one.
During the test, nothing has been done to change the direction of RS-485, thanks to the auto flow control feature of IGT-20. And actually, this can be duplicated with RS-232 and RS-422 on IGT-20. What you need is another fixture. Here’s, by the way, my fixture of RS-232.
Rx of ttyS1 and Tx of ttyS2 are connected (orange wire), while Tx of ttyS1 and Rx of ttyS2 are connected (white wire). With this wiring, messages from ttyS1 is sent to ttyS2 over RS-232, while message from ttyS2 is sent to ttyS1.
The most important thing is that don’t forget to switch the modes of the serial ports to that matches your fixture.