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

From Compulab Mediawiki
Jump to: navigation, search
imported>Uri.mashiach
 
(One intermediate revision by one other user not shown)
Line 37: Line 37:
 
== RS485 / RS232 Mode Selection ==
 
== RS485 / RS232 Mode Selection ==
 
The UART mode is stored in the U-Boot environment.<br>
 
The UART mode is stored in the U-Boot environment.<br>
U-Boot environmnet commands are used to set/get the UART mode.
+
U-Boot environment commands are used to set/get the UART mode.
 
=== Set RS485 mode ===
 
=== Set RS485 mode ===
 
<pre>
 
<pre>
root@iot-gate-imx8:~# cl_setenv uart_mode rs485
+
root@iot-gate-imx8:~# fw_setenv uart_mode rs485
 
root@iot-gate-imx8:~# reboot
 
root@iot-gate-imx8:~# reboot
 
</pre>
 
</pre>
 
=== Set RS232 mode ===
 
=== Set RS232 mode ===
 
<pre>
 
<pre>
root@iot-gate-imx8:~# cl_setenv uart_mode rs232
+
root@iot-gate-imx8:~# fw_setenv uart_mode rs232
 
root@iot-gate-imx8:~# reboot
 
root@iot-gate-imx8:~# reboot
 
</pre>
 
</pre>
Line 52: Line 52:
 
root@iot-gate-imx8:~# fw_printenv uart_mode
 
root@iot-gate-imx8:~# fw_printenv uart_mode
 
</pre>
 
</pre>
 +
'''Note:''' The default port mode is RS485. The port operates in this mode in case of the variable ''uart_mode'' is assigned to an incorrect value or unset.
  
 
== Example ==
 
== Example ==
Line 63: Line 64:
 
** Select "Serial port setup"
 
** Select "Serial port setup"
 
** Press the letter 'f'.
 
** Press the letter 'f'.
 +
** Press the letter 'h'.
 +
** Press the letter 'i'.
 
** Press the Esc key twice.
 
** Press the Esc key twice.
 
* The characters that are typed in the terminal are transmitted to the RS485 port.
 
* 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.
 
* 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
 
* Press CTRL-a followed by the letter 'x' to exit from Minicom

Latest revision as of 12:45, 5 December 2022

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 environment commands are used to set/get the UART mode.

Set RS485 mode

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

Set RS232 mode

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

Get UART mode

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

Note: The default port mode is RS485. The port operates in this mode in case of the variable uart_mode is assigned to an incorrect value or unset.

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 letter 'h'.
    • Press the letter 'i'.
    • 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