Difference between revisions of "Transclusion: IOT-GATE-iMX8: RS485 / RS232"
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...") |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | IOT-GATE-iMX8 / SBC-IOT-iMX8 features a half-duplex RS485 | + | 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 | + | The RS485 / RS232 interface is routed to rear panel terminal block connector [[IOT-GATE-iMX8: Getting Started#Front_and_Rear_panels|see drawing]].<br> |
− | RS485 / RS232 connector pin-out | + | 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 environment commands are used to set/get the UART mode. | ||
+ | === Set RS485 mode === | ||
+ | <pre> | ||
+ | root@iot-gate-imx8:~# fw_setenv uart_mode rs485 | ||
+ | root@iot-gate-imx8:~# reboot | ||
+ | </pre> | ||
+ | === Set RS232 mode === | ||
+ | <pre> | ||
+ | root@iot-gate-imx8:~# fw_setenv uart_mode rs232 | ||
+ | root@iot-gate-imx8:~# reboot | ||
+ | </pre> | ||
+ | === Get UART mode === | ||
+ | <pre> | ||
+ | root@iot-gate-imx8:~# fw_printenv uart_mode | ||
+ | </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 32: | 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 |
Contents
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