I would like to use console uart pins which is 26 and 27 as GPIO.
what changes should i follow for that
Greetings @kishanjoshi
In general you’ll need to make changes to the device tree. For Torizon we provide a tool (Device Tree Overlays on Torizon | Toradex Developer Center) that lets you apply overlays onto the live device tree without having to recompile the entire kernel source.
However I see that you are using the i.MX6ULL. Just so your clear Torizon support for the i.MX6ULL is experimental at best and we make no long term commitments to supporting this platform with Torizon. Meaning any issues you find may or may not be fixed in a timely manner.
But anyways in short you’ll need to disable the uart1 interface in the device tree this will free up the pins that are allocated to this interface. Then you’ll need to reassign these pins in the device tree as GPIOs. Though it’s a different module the community post here shows an example of this process: https://www.toradex.com/community/questions/47979/how-to-enable-pins-as-gpio.html?smartspace=torizon
Best Regards,
Jeremias
We also have imx7d also . But the same thing i need to apply on that. Because we don’t need uart console. We are running torizon core only
The same general steps apply no matter the module. However for the i.MX7D the device tree overlay tool should work which will save some hassle of recompiling the entire source kernel and device tree.
As a small note there may be some issues that occur when disabling UART1 as this also disables the /dev/console
we have identified several issues that occur and have fixed or in the process of fixing them. But please report any issues you run into.
can you guide me through this? it will be appreciated.
This is an example device tree overlay:
/dts-v1/;
/plugin/;
#include <imx7d-pinfunc.h>
/ {
compatible = "toradex";
fragment@0 {
target = <&uart1>;
__overlay__ { status = "disabled"; };
};
fragment@1 {
target = <&iomuxc>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_test>;
pinctrl_test: gpiomuxgrp {
fsl,pins = <
MX7D_PAD_UART1_TX_DATA__GPIO4_IO1 0x14
MX7D_PAD_UART1_RX_DATA__GPIO4_IO0 0x14
MX7D_PAD_SAI2_TX_BCLK__GPIO6_IO20 0x14
MX7D_PAD_SAI2_TX_SYNC__GPIO6_IO19 0x14
>;
};
};
};
};
The first fragment disables the uart1 interface so that you can re-purpose the pins used by uart1 for GPIOs or other purposes. The second fragment reassigns the now freed pins as GPIOs which can be used by the OS. Please don’t just copy and paste the above it’s just an example overlay I threw together.
You’ll need to reference the kernel source to figure out the exact pin muxings and names. For the i.MX7 all pin muxing assignments are defined by this file: imx7d-pinfunc.h « dts « boot « arm « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
To see how the pins are assigned by default you can see the pinmux settings towards the bottom of this file: imx7-colibri.dtsi « dts « boot « arm « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules
Please make sure to note that GPIO numbers in userspace are different than how they are labeled in the device tree source and our hardware datasheet for the translation between the names see here: GPIO Alphanumeric to GPIO Numeric Assignment | Toradex Developer Center
Best Regards,
Jeremias