I need to use iMX6 uart 4 (in apalis signal nomenclature, uart 3) with RTS to control an RS485 transceiver. Specifically I need pin 179 for RTS and 177 for CTS. (I’m not actually using CTS but assume I need it enabled anyways.) I’ve built the following into my device tree (named “imx6q-apalis-gpio-custom.dts”):
/dts-v1/;
/plugin/;
#include <dt-bindings/gpio/gpio.h>
//#include <dt-bindings/leds/common.h>
#include "imx6q-pinfunc.h"
/ {
compatible = "toradex,apalis-imx6q";
};
&{/} {
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_my_gpio>;
mygpio_sodimm_1 {
label = "my_gpio_sodimm_1";
gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_3 {
label = "my_gpio_sodimm_3";
gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_5 {
label = "my_gpio_sodimm_5";
gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_7 {
label = "my_gpio_sodimm_7";
gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_9 {
label = "my_gpio_sodimm_9";
gpios = <&gpio6 10 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_11 {
label = "my_gpio_sodimm_11";
gpios = <&gpio6 9 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_13 {
label = "my_gpio_sodimm_13";
gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
mygpio_sodimm_15 {
label = "my_gpio_sodimm_15";
gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "heartbeat";
default-state = "off";
};
};
};
&uart4 { // This is Apalis UART3
status = "okay"; // need to enable mxm pin 179 for RTS. Might also enable 177 for CTS, though don't plan on using
linux,rs485-enabled-at-boot-time;
rs485-rts-active-low;
rs485-rx-during-tx;
};
&uart2 { // mxm pin 128 should be enabled for RTS, pin 130 for CTS. This is Apalis UART2
status = "okay";
linux,rs485-enabled-at-boot-time;
rs485-rts-active-low;
rs485-rx-during-tx;
};
&iomuxc {
/*pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_gpio2>,
<&pinctrl_gpio3>, <&pinctrl_gpio4>,
<&pinctrl_gpio7>, <&pinctrl_gpio8>,
<&pinctrl_gpio_hog1>, <&pinctrl_gpio_hog2>, <&pinctrl_gpio_hog3>,
<&pinctrl_pmic_tpm_ena>, <&pinctrl_my_gpio>;*/
pinctrl_my_gpio: mygpiogrp {
fsl,pins =
<MX6QDL_PAD_NANDF_D4__GPIO2_IO04 0x104>, // SODIMM 1 // pull-down enabled and drive strength X2
<MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x104>, // SODIMM 3 // pull-down enabled and drive strength X2
<MX6QDL_PAD_NANDF_D6__GPIO2_IO06 0x104>, // SODIMM 5 // pull-down enabled and drive strength X2
<MX6QDL_PAD_NANDF_D7__GPIO2_IO07 0x104>, // SODIMM 7 // pull-down enabled and drive strength X2
<MX6QDL_PAD_NANDF_RB0__GPIO6_IO10 0x104>, // SODIMM 9 // pull-down enabled and drive strength X2
<MX6QDL_PAD_NANDF_WP_B__GPIO6_IO09 0x104>, // SODIMM 11 // pull-down enabled and drive strength X2
<MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x104>, // SODIMM 13 // pull-down enabled and drive strength X2
<MX6QDL_PAD_GPIO_6__GPIO1_IO06 0x104>; // SODIMM 15 // pull-down enabled and drive strength X2
};
// from inspecting imx6qdl-apalis.dtsi, seems like I probably need to overwrite pinctrl_uart4_dte: uart4dtegrp with additional RTS and CTS pins
// Might also need to disable camera usage? I don't think this is enabled currently
pinctrl_uart4_dte: uart4dtegrp {
fsl,pins = <
MX6QDL_PAD_KEY_COL0__UART4_RX_DATA 0x1b0b1
MX6QDL_PAD_KEY_ROW0__UART4_TX_DATA 0x1b0b1
MX6QDL_PAD_CSI0_DAT16__UART4_RTS_B 0x1b0b1
MX6QDL_PAD_CSI0_DAT16__UART4_CTS_B 0x1b0b1
>;
};
Using this tcbuild.yaml:
# >> NOTES:
# >> Lines containing ">>" are simply comments explaining the properties that
# >> follow; if you don't like these comments run:
# >> $ grep -v '>>' tcbuild.yaml > tcbuild-clean.yaml
# >> A line not containing ">>" can be uncommented (by removing the hash mark
# >> plus a space from its beginning); also set the corresponding property to
# >> appropriate values.
# >> When uncommenting a line having a property, remember to uncomment all its
# >> parent properties as well; for example: if you uncomment the
# >> 'splash-screen' property, also uncomment its parent property called
# >> 'customization'.
# >> The input section specifies the image to be taken as the base for the
# >> customization.
input:
easy-installer:
# >> Choose one of the options (REQUIRED):
# >> (1) Image as local folder or tarball.
local: images/torizon-core-docker-apalis-imx6-Tezi_6.5.0+build.8.tar
# >> (2) Remote file (optionally with a filename and or a sha256 checksum):
# remote: "https://artifacts.toradex.com/.../torizon-core-docker-apalis-imx6-Tezi_6.5.0%2Bbuild.8.tar"
# remote: "https://artifacts.toradex.com/.../torizon-core-docker-colibri-imx6-Tezi_5.0.0-devel-202009%2Bbuild.2.tar;filename=torizon-core-docker-colibri-imx6-Tezi_5.0.0-devel-202009+build.2.tar;sha256sum=368595fa3fb00af9604e70311de3b04df6b30b280deec2f8918c46f479026ddb"
# >> (3) Image specification (URL will be generated by the tool)
# toradex-feed:
# version: "5.1.0"
# release: quarterly
# machine: colibri-imx7-emmc
# distro: torizon-upstream
# variant: torizon-core-docker
# build-number: "1"
# # build-date: "20210408"
# >> The customization section defines the modifications to be applied to get
# >> the desired output image.
customization:
# >> Splash screen:
# splash-screen: custom-splash-screen.png
# >> Directories overlayed to the base OSTree
# filesystem:
# - changes/
device-tree:
# >> Directories where to look for include files.
include-dirs:
# - device-trees/include/
- images/linux/include
# >> Custom device tree source:
custom: images/linux/arch/arm/boot/dts/imx6q-apalis-ixora-v1.2.dts
# >> Device-tree overlays configuration:
overlays:
# >> Whether to ignore all overlays from the base image (or ostree
# >> archive in the future).
# clear: false
# >> Specific overlays not to use from base image (useful only when
# >> clear is false and not DT has been selected).
# remove:
# - apalis-imx8_hdmi_overlay.dtbo
# >> Overlays to add to output image.
add:
- images/device-trees/overlays/apalis-imx6_panel-cap-touch-10inch_overlay.dts
- images/custom/imx6q-apalis-gpio-custom.dts
# kernel:
# >> Custom kernel arguments.
# arguments:
# - key1=val1
# - key2=val2
# >> Modules to build and possibly load automatically.
# modules:
# - source-dir: virtual_touchscreen/
# autoload: false
# >> The output section defines properties of the output image.
output:
# >> OSTree deployment configuration (relevant also for Easy Installer output).
# ostree:
# branch: my-dev-branch
# commit-subject: "OSTree commit subject"
# commit-body: "OSTree commit body"
# >> Parameters for deploying to an Easy Installer image.
easy-installer:
# >> Output directory of the customized image (REQUIRED):
# local: images/torizon-core-docker-apalis-imx6-Tezi_6.5.0+build.CUSTOM # this was my first build to get GPIO and uart access
local: images/torizon-core-docker-apalis-imx6-Tezi_6.5.0+build.CUSTOM2 # this build is to enable RTS on Apalis UART3 (for RS485) and RS232 on UART2
# >> Information used by Toradex Easy Installer:
# name: "My customized image"
# description: "My customized image (description)"
# licence: files/custom-licence.html
# release-notes: files/custom-release-notes.html
# accept-licence: true
# autoinstall: true
# autoreboot: true
# bundle:
# >> Choose one of the options:
# >> (1) Specify a docker-compose file whose referenced images will be downloaded.
# >> Properties platform, username, password and registry are optional.
# compose-file: files/docker-compose.yml
# platform: linux/arm/v7
# username: "${USERNAME}"
# password: "${PASSWORD}"
# registry: hub.docker.com
# >> (2) Specify a local directory containing the bundled images (previously
# >> obtained by 'torizoncore-builder bundle' command).
# dir: bundle/
# >> Provisioning configuration:
# provisioning:
# >> For "online" mode, properties "shared-data" and "online-data" must be specified.
# >> For "offline" mode, property "shared-data" must be specified alone.
# mode: "online"
# shared-data: "shared-data.tar.gz"
# online-data: "${ONLINE_PROVISIONING_DATA:?online provisioning data not supplied}"
This builds an image without errors, but the image does not have an apalis-uart3 in /dev. What am I doing wrong?
One theory I have is that I need to disable the camera interface, since I’m stealing the RTS and CTS pins from there. But I don’t see that enabled in any of the other device tree or device tree overlay files…
Setup:
Apalis iMX6 Quad 2GB IT V1.1Y
Ixora Carrier Board V1.3A
Torizon, using Qt C++/QML Template
Host Machine: Windows, VS Code w/ Torizon IDE Extension 2