DART-MX8M UART: Difference between revisions
(Add 'Configuring RS485 Half-Duplex') |
(Add Debian_Platform_Customization) |
||
(19 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<!-- Set release according to "release" parameter in URL and use RELEASE_SUMO_V1.0_DART-MX8M as default | <!-- Set release according to "release" parameter in URL and use RELEASE_SUMO_V1.0_DART-MX8M as default | ||
--> {{ | --> {{INIT_RELEASE_PARAM|RELEASE_SUMO_V1.0_DART-MX8M}}<!-- | ||
--> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | --> {{#lst:Yocto_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | ||
--> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | --> {{#lst:B2QT_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | ||
--> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | --> {{#lst:Android_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | ||
--> {{#lst:Debian_Platform_Customization|{{#var:RELEASE_PARAM}}}} <!-- | |||
--> {{PageHeader|{{#var:HARDWARE_NAME}} UART}} {{DocImage|category1=Yocto|category2=Android}}[[Category:Debian]][[Category:{{#var:HARDWARE_NAME}}]] __toc__ | --> {{PageHeader|{{#var:HARDWARE_NAME}} UART}} {{DocImage|category1=Yocto|category2=Android}}[[Category:Debian]][[Category:{{#var:HARDWARE_NAME}}]] __toc__ | ||
<!-- Set local variables | <!-- Set local variables | ||
--> {{#vardefine:SHOW_DART_SECTION | <!-- | --> {{#vardefine:SHOW_DART_SECTION | <!-- | ||
--> {{#switch:{{#var:HARDWARE_NAME}} | <!-- | --> {{#switch:{{#var:HARDWARE_NAME}} | <!-- | ||
Line 56: | Line 56: | ||
{{#ifeq: {{#var:SHOW_SYMPHONY_SECTION}}|true| | {{#ifeq: {{#var:SHOW_SYMPHONY_SECTION}}|true| | ||
On '''{{#var:SYMPHONY_SOM_NAME}}''' all 4 UARTs are enabled by default.<br> | On '''{{#var:SYMPHONY_SOM_NAME}}''' all 4 UARTs are enabled by default.<br> | ||
{{#ifeq: {{#var: | {{#ifeq: {{#var:SYMPHONY_SOM_NAME}}|VAR-SOM-MX8M-PLUS| | ||
UART1 is connected to | UART1 is connected to J18 header.<br> | ||
UART2 is connected to to debug console.<br> | UART2 is connected to to debug console.<br> | ||
UART3 is connected to Bluetooth module.<br> | UART3 is connected to Bluetooth module.<br> | ||
Line 141: | Line 141: | ||
= Configuring RS485 Half-Duplex = | = Configuring RS485 Half-Duplex = | ||
{{#lst:Yocto_Platform_Customization|RS485_HALF_DUPLEX}} | |||
Latest revision as of 15:58, 7 February 2023
This page is using the default release RELEASE_SUMO_V1.0_DART-MX8M.
To view this page for a specific Variscite SoM and software release, please follow these steps:
- Visit variwiki.com
- Select your SoM
- Select the software release
UART Overview
On DART-MX8M all 4 UARTs are enabled by default.
UART1 is connected to debug console.
UART2 and UART3 are connected to J12 header on VAR-DT8MCustomBoard.
UART4 is connected to Bluetooth module.
On DART-MX8M SoMs without WIFI/BT module UART4 is also connected to J12 header.
See the carrier board datasheet for the exact pinout.
Only UART4 has RTS and CTS lines.
UART naming under Linux
The Linux devices corresponding to UART1 - UART4 are /dev/ttymxc0 - /dev/ttymxc3 respectively.
Testing UART2 on DART-MX8M
Short J12.4 and J12.6 pins and run the following commands:
stty -F /dev/ttymxc1 -echo -onlcr 115200 cat /dev/ttymxc1 & echo hello > /dev/ttymxc1
For each time you run this echo command the "hello" string should appear on the terminal.
Testing UART3 on DART-MX8M
Short J12.11 and J12.13 pins and run the following commands:
stty -F /dev/ttymxc2 -echo -onlcr 115200 cat /dev/ttymxc2 & echo hello > /dev/ttymxc2
For each invocation of echo command the "hello" string should appear on the terminal.
Disabling UART2
To disable UART2 on DART-MX8M edit arch/arm64/boot/dts/freescale/fsl-imx8mq-var-dart-common.dtsi under kernel source directory and modify
&uart2 { ... status = "okay"; };
to
&uart2 { ... status = "disabled"; };
Other UARTs can be disabled in the same manner.
Configuring RS485 Half-Duplex
Each UART can be configured for RS485 Half-Duplex mode by using a GPIO pin to drive the receive and transmit enable inputs. This can be configured in the device tree by making the following changes to the uart node and replacing X, Y & Z with the proper values:
&uartX { /* Add RS485 properties to uartX */ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uartX>, <&pinctrl_uartX_rs485>; /* Add RS485 GPIO pinctrl */ rts-gpios = <&gpioY Z GPIO_ACTIVE_LOW>; /* Add rts-gpios property */ linux,rs485-enabled-at-boot-time; /* Enable RS485 at boot time to skip using TIOCSRS485 ioctl */ status = "okay"; };
Next, configure the RS485 GPIO pin by adding pinctrl_uartX_rs485
to iomuxc
. Replace X, GPIO_PIN_FUNCTION, and GPIO_PIN_SETTINGS with the proper values:
&iomuxc { pinctrl_uartX_rs485: uartXrs485 { fsl,pins = < GPIO_PIN_FUNCTION GPIO_PIN_SETTINGS >; }; };
Note: For more information about configuring pins, please see i.MX Device Tree Pinmux Settings Guide
After making these changes, RS485 mode will be enabled by default and can be verified from the console by running the commands below. Replace N with the proper value, which is typically X-1 relative to the device tree node uartX
:
# stty -F /dev/ttymxcN -echo -onlcr 115200 # echo hello > /dev/ttymxcN
The below logic analyzer capture shows the RS485 RX/TX enable line toggling when writing to the UART:
Please refer to the Linux device tree bindings for more RS485 configuration options.