Difference between revisions of "Transclusion: IOT-GATE-iMX8: RS485 / RS232"

From Compulab Mediawiki
Jump to: navigation, search
imported>Uri.mashiach
(Created page with "IOT-GATE-iMX8 / SBC-IOT-iMX8 features a half-duplex RS485 port.<br> The RS485 interface is routed to rear panel terminal block connector ([http://192.168.10.106/mediawiki/inde...")
 
imported>Igor.vaisbein
(RS485 / RS232 Selection)
Line 1: Line 1:
IOT-GATE-iMX8 / SBC-IOT-iMX8 features a half-duplex RS485 port.<br>
+
IOT-GATE-iMX8 / SBC-IOT-iMX8 features a RS485 / RS232 port. Only half-duplex mode is supported for the RS485.<br>
The RS485 interface is routed to rear panel terminal block connector ([http://192.168.10.106/mediawiki/index.php/IOT-GATE-iMX8:_Getting_Started#Front_and_Rear_panels see drawing]).<br>
+
The RS485 / RS232 interface is routed to rear panel terminal block connector ([http://192.168.10.106/mediawiki/index.php/IOT-GATE-iMX8:_Getting_Started#Front_and_Rear_panels see drawing]).<br>
RS485 / RS232 connector pin-out in RS485 mode:
+
RS485 / RS232 connector pin-out:
  
 
{| width="40%" cellspacing="1" cellpadding="1" border="1"
 
{| width="40%" cellspacing="1" cellpadding="1" border="1"
Line 7: Line 7:
 
| align="center" | '''Pin Number'''
 
| align="center" | '''Pin Number'''
 
| align="center" | '''RS485 Functionality'''
 
| align="center" | '''RS485 Functionality'''
 +
| align="center" | '''RS232 Functionality'''
 
|- valign="top"
 
|- valign="top"
 
| 1
 
| 1
 
| NEG A/-
 
| NEG A/-
 +
| TXD
 
|-
 
|-
 
| 2
 
| 2
 
| NEG B/+
 
| NEG B/+
 +
| RTS
 
|-
 
|-
 
| 3
 
| 3
 +
| Ground
 
| Ground
 
| Ground
 +
|-
 +
| 4
 +
| NC
 +
| CTS
 +
|-
 +
| 5
 +
| NC
 +
| RXD
 
|-
 
|-
 
| 6
 
| 6
 +
| Ground
 
| Ground
 
| Ground
 
|-
 
|-
 
|}
 
|}
 +
 +
== RS485 / RS232 Mode Selection ==
 +
The UART mode is stored in the U-Boot environment.<br>
 +
U-Boot environmnet commands are used to set/get the UART mode.
 +
=== Set RS485 mode ===
 +
<pre>
 +
root@iot-gate-imx8:~# cl_setenv uart_mode rs485
 +
root@iot-gate-imx8:~# reboot
 +
</pre>
 +
=== Set RS232 mode ===
 +
<pre>
 +
root@iot-gate-imx8:~# cl_setenv uart_mode rs232
 +
root@iot-gate-imx8:~# reboot
 +
</pre>
 +
=== Get UART mode ===
 +
<pre>
 +
root@iot-gate-imx8:~# fw_printenv uart_mode
 +
</pre>
  
 
== Example ==
 
== Example ==

Revision as of 11:05, 23 December 2020

IOT-GATE-iMX8 / SBC-IOT-iMX8 features a RS485 / RS232 port. Only half-duplex mode is supported for the RS485.
The RS485 / RS232 interface is routed to rear panel terminal block connector (see drawing).
RS485 / RS232 connector pin-out:

Pin Number RS485 Functionality RS232 Functionality
1 NEG A/- TXD
2 NEG B/+ RTS
3 Ground Ground
4 NC CTS
5 NC RXD
6 Ground Ground

RS485 / RS232 Mode Selection

The UART mode is stored in the U-Boot environment.
U-Boot environmnet commands are used to set/get the UART mode.

Set RS485 mode

root@iot-gate-imx8:~# cl_setenv uart_mode rs485
root@iot-gate-imx8:~# reboot

Set RS232 mode

root@iot-gate-imx8:~# cl_setenv uart_mode rs232
root@iot-gate-imx8:~# reboot

Get UART mode

root@iot-gate-imx8:~# fw_printenv uart_mode

Example

Serial terminal emulator application can be used to test the RS485 port.

  • Use the following command to start Minicom with the user space device of the RS485 (/dev/ttymxc0).
root@iot-gate-imx8:~# minicom -D /dev/ttymxc0
  • Follow the following steps to disable hardware flow control
    • Open the menu "Configure Minicom" with CTRL-a followed by the letter 'o'.
    • Select "Serial port setup"
    • Press the letter 'f'.
    • Press the Esc key twice.
  • The characters that are typed in the terminal are transmitted to the RS485 port.
  • The characters that are received from the RS485 port are displayed in the terminal.
  • Press CTRL-a followed by the letter 'x' to exit from Minicom