Sierra Wireless FX30S User Guide
Rev 2 Mar.18
32
41110485
Set the Serial Port Mode
You can configure the serial port in either RS232 or RS-485 mode using Linux
commands.
Note: Before executing these commands, ensure that the UART is set correctly. If the
UART is not set correctly, you will not see serial data. To configure the UART for a
particular service, see
You can configure the serial port in either RS232 or RS-485 mode. To change the
serial port mode, use the following Linux command:
./rs485.py /sys/devices/platform/msm_serial_hsl.0/rs_mode
<NEW MODE>
where
<NEW MODE>
is either:
·
0—RS232 (default)
·
1—RS485
For example, to change the mode to RS-485:
./rs485.py /sys/
devices/platform/msm_serial_hsl.0/rs_mode 1
Note: The rs_mode setting is not persistent, and will return to the default setting (RS232)
when the gateway is reset.
Note: In release R14.0.2.001 and newer, the rs485.py script is available by default in the
root file system in /usr/bin.
For your reference, the contents of the rs485.py script appear below.
#!/usr/bin/env python
import sys
fn = sys.argv[1]
if len(sys.argv) > 2:
value = sys.argv[2]
else:
value = None
ttyFile=open('/dev/ttyHSL0')
if value is None:
sysfsFile = open(fn, 'r')
print sysfsFile.read().strip()
else:
sysfsFile = open(fn, 'w')
sysfsFile.write(value)
To query the serial mode status, use:
./rs485.py /sys/devices/platform/msm_serial_hsl.0/rs_mode
which will return either
RS232
or
RS485
.