Transclusion: IOT-GATE-iMX8: RS485 / RS232

From Compulab Mediawiki
Revision as of 12:45, 5 December 2022 by Igor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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