How to Use RS-485 Ports
This section describes the RS-485 communication requirements for the following platforms:
-
ReliaGATE 50-21
-
ReliaGATE 10-10
-
DynaCOR 10-10
ReliaGATE 50-21
The current Wind River Linux (WRL) version, 2.6.34.12-WR4.3.0.0_standard, does not support native RS-485. To provide this capability for the ReliaGATE 50-21, it is first necessary to install the latest WRL build that includes the Vizzini driver options for setting RS-485 related flags.
The WRL version 2.6.34.13-WR4.3.0.0_standard can be downloaded from this link: http://eurotechcloud.transfer.eurotech-inc.com/~virginia/reliagate-eval/.
Upon system reboot, open the setup and select RS-485 for the desired serial port.
Then, add the following parameters to the kernel parameters in menu.lst:
- For ttyUSB0 (Serial 1):
kernel /boot/eurotech_vector-bzImage-WR4.3.0.0_standard root=/dev/sda1 rootwait vizzini.gpio_mode=0x01 vizzini.gpio_regs=0xb,0,0,0 vizzini.flow_ctrl=0x01 vizzini.flow_regs=0x09,0,0,0
- For ttyUSB1 (Serial 2):
kernel /boot/eurotech_vector-bzImage-WR4.3.0.0_standard root=/dev/sda1 rootwait vizzini.gpio_mode=0x02 vizzini.gpio_regs=0,0xb,0,0 vizzini.flow_ctrl=0x02 vizzini.flow_regs=0,0x09,0,0
To update the BIOS only, use this link: http://support.eurotech-inc.com/developers/temp/PCN1001-Kernel.zip.
It is recommended to update menu.lst manually and not to use the script.
Once this release is correctly installed and configured, the RS-485 serial ports may be used transparently in the same way as RS-232.
ReliaGATE 10-10
The ReliaGATE 10-10 exposes two RS-232/RS-485 serial ports on the terminals. The UARTs working mode is set by activating a GPIO digital output. The transceiver auto-direction is managed at the driver level and is activated by a call to ioctl after the port has been opened.
Available ports on the terminals are ttyO3 and ttyO4 as shown in the table below:
Port | File | UART TX/RX switch GPIO Pin (active=TX) | UART RS232/RS485 switch GPIO Pin (active=RS485) |
---|---|---|---|
UART_3 | /dev/ttyO3 | GPIO3_21 (117) | GPIO1_30 (62) |
UART_4 | /dev/ttyO4 | GPIO0_19 (19) | GPIO1_31 (63) |
To use the desired serial port, perform the following steps:
-
Activate the RS-232/RS-485 switch GPIO
-
Open the port with fopen
-
Set the ioctl as per https://www.kernel.org/doc/Documentation/serial/serial-rs485.txt
Refer to the following example that shows how ttyO3 is managed at the driver level:
fd = open( "/dev/ttyO3", O_RDWR|O_NONBLOCK );
rs485conf.flags = (1<<0); //SER_RS485_ENABLED;
rs485conf.flags |= (1<<5);
rs485conf.delay_rts_before_send = 0;
rs485conf.gpio_pin = 117; //TELL THE DRIVER WHICH GPIO IS USED TO CONTROL TX/RX DIRECTION
rv = ioctl (fd, 0x542F, &rs485conf);
The org.eclipse.kura.protocol.serial.rs485 bundle is installed with the ReliaGATE 10-10 distribution simplifying the use of RS-485 ports. This bundle exposes a Configurable Component to the web UI allowing you to choose the serial ports and the GPIOs used to activate RS-485 communication through the ESF Gateway Administration Console. Once the RS-485 ports have been configured, they may be used as generic SerialPorts from ESF.
The RS-485 ports will work as soon as the ioctl is properly set, even if the resource is being used by another running bundle, provided that the port is not opened in exclusive mode.
DynaCOR 10-10
For the DynaCOR 10-10 platform, only BIOS settings are needed to enable transceiver auto-direction. These settings are as follows:
Serial Port 3 <Enabled>
Base I/O Address <2F8>
Interrupt <IRQ3>
Mode <RS485>
Control Signal <DTR#>
Termination <Enabled>
Updated less than a minute ago