I am using an Apalis i.MX6Q 2GB IT SOC on a custom board and am trying to remap PWM 3 and 4 to be GPIO. I am read several posts on here and their solutions have not worked for me. What is really interesting is that one of the works but the other doesn’t. The two pins in question are as follows:
X1 Pin Default ALT5
6 PWM3_OUT GPIO2_IO09
8 PWM4_OUT GPIO2_IO10
I have made changes to my device tree file (imx6qdl-apalis-acu3.dts) as follows
&iomuxc {
/*
* Mux the Apalis GPIOs.
* Note:
* - GPIO7 is used for PCIe reset
* - GPIO5, 6 are used by optional capacitive touch controller
*/
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_apalis_gpio1 &pinctrl_apalis_gpio2
&pinctrl_apalis_gpio3 &pinctrl_apalis_gpio4
&pinctrl_apalis_gpio5 &pinctrl_apalis_gpio6
&pinctrl_apalis_gpio7 &pinctrl_apalis_gpio8
&pinctrl_additionalgpio>;
.....
pinctrl_additionalgpio: additionalgpios {
fsl,pins = <
MX6QDL_PAD_SD4_DAT1__GPIO2_IO09 0x14
MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x14
>;
};
};
Full device tree file attached here
I have removed all references to PWM 3 & 4. Linux will let me grab these GPIO’s either via sysfs or gpiod and I can set the values, however GPIO2_IO10 never changes value. It remains at 0. GPIO2_IO09 changes but not the other. So what needs to be done to fix this? A follow-up question is, what hex values or configuration needs to be done to set these two GPIO’s to be outputs and high from the device tree, is that possible?
Thanks
In general Device Tree looks OK except that 0x14. Hex values explained here.
Are you sure you are measuring GPIO2_IO10 on a right pin?
@alex.tx I have verified that I am scoping the correct pins. These two pins will function as two control pins for a switch. Both lines have 10k pull-ups on them in hardware. I need them to be both outputs and high at startup. I changed the HEX values to 0x0b008 per your guidance. I am attaching the other two files that make my device tree here in case there is something else I missed. I have scoped both pin lines and GPIO2_IO09 reads 3.3V as expected, however GPIO2_IO09 read ~1V regardless if it is an input or an output. I have checked with a clean new carrier board without an Apalis module installed and both lines read 3.3V. So the Apalis is doing something or it is damaged in some way. Any thoughts?
I’ll test your DT on Apalis iMX6 / Ixora board today.
I’ve made this changes to the Device Tree of 5.2 BSP
--- a/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
+++ b/arch/arm/boot/dts/imx6q-apalis-ixora-v1.1.dts
@@ -246,11 +246,11 @@
};
&pwm3 {
- status = "okay";
+ status = "disabled";
};
&pwm4 {
- status = "okay";
+ status = "disabled";
};
®_usb_host_vbus {
@@ -325,6 +325,7 @@
pinctrl-0 = <&pinctrl_apalis_gpio1 &pinctrl_apalis_gpio2
&pinctrl_apalis_gpio3 &pinctrl_apalis_gpio4
&pinctrl_apalis_gpio7 &pinctrl_apalis_gpio8
+ &pinctrl_apalis_gpio9 &pinctrl_apalis_gpio10
>;
pinctrl_leds_ixora: ledsixoragrp {
--- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
@@ -1030,6 +1030,19 @@
>;
};
+ pinctrl_apalis_gpio9: gpio2io09grp {
+ fsl,pins = <
+ MX6QDL_PAD_SD4_DAT1__GPIO2_IO09 0x130b0
+ >;
+ };
+
+ pinctrl_apalis_gpio10: gpio2io10grp {
+ fsl,pins = <
+ MX6QDL_PAD_SD4_DAT2__GPIO2_IO10 0x130b0
+ >;
+ };
+
+
pinctrl_audmux: audmuxgrp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT20__AUD4_TXC 0x130b0
And tested GPIO 41 and 42 on Ixora board (X27 pins 35 and 36) using sysfs . Everything works as expected. Could you double check if your device tree was applied properly? Have you changed U_Boot env variable fdtfile to imx6qdl-apalis-acu3.dtb ?
@alex.tx Thank you very much for your response. I have implemented you solution and it still did not work. However we did discover that apparently the switch IC that we were controlling with those two lines was faulty, probably shorted to ground internally, on only the board I was using caused the problem. I apologize for having you spend time on a problem that turned out to be a hardware issue on my end but I appreciate your efforts. I switched the boards and all is working as expected now.
Thanks
Glad your problem was solved. Thank you for the update.