IMX6ULL Unable to toggle GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX6ULL Unable to toggle GPIO

574 Views
Almaz
Contributor I

Hi. Have issue with simple GPIO toggling.

Here what I have at power up: 

 

 

# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio:
 gpio-19  (                    |cd                  ) in  hi
 gpio-20  (                    |spi_imx             ) out hi

gpiochip1: GPIOs 32-63, parent: platform/20a0000.gpio, 20a0000.gpio:

gpiochip2: GPIOs 64-95, parent: platform/20a4000.gpio, 20a4000.gpio:
 gpio-77  (                    |wakeup              ) out lo
 gpio-83  (                    |reset               ) out hi

gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:

gpiochip4: GPIOs 128-159, parent: platform/20ac000.gpio, 20ac000.gpio:

 

 

 

Then I configure GPIO4.IO[16]:

 

 

echo "112" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio112/direction
echo "1" > /sys/class/gpio/gpio112/value

 

 

And see that it configured:

 

 

gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
 gpio-112 (                    |sysfs               ) out hi

 

 

when I toggle it from `1` to `0`:

 

 

echo "0" > /sys/class/gpio/gpio112/value

 

 

I see that it changes in `/debug/gpio`:

 

 

gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
 gpio-112 (                    |sysfs               ) out lo

 

 

Oscilloscope shoes that it is toggles really.

 

But when I try to do same with `GPIO4.IO[11]`:

 

 

echo "107" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio107/direction
echo "1" > /sys/class/gpio/gpio107/value

 

 

I see that it initialized:

 

 

gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
 gpio-107 (                    |sysfs               ) out hi
 gpio-112 (                    |sysfs               ) out lo

 

 

and toggles:

 

 

echo "0" > /sys/class/gpio/gpio107/value

 

 

in SW:

 

 

gpiochip3: GPIOs 96-127, parent: platform/20a8000.gpio, 20a8000.gpio:
 gpio-107 (                    |sysfs               ) out lo
 gpio-112 (                    |sysfs               ) out lo

 

 

But not in reality. Oscilloscope shows that it is remains constantly HIGH and not reacts anything on togling using `/sys/class/gpio/gpio107`

Same trouble with GPIO 109, 111, 108, 101 and 106 while 78, 112 and 110 toggles as expected.

Here is my DTS.

 


Here what I see in debug info:

 

 

root@OpenWrt:/# cat /sys/kernel/debug/pinctrl/pinctrl-maps
Pinctrl maps:
device 20e0000.iomuxc
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group hoggrp-1
function imx6ul-evk

device 20e0000.iomuxc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART1_RTS_B
config 00017059

device 208c000.pwm
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group pwm4grp
function imx6ul-evk

device 208c000.pwm
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_GPIO1_IO05
config 000110b0

device 2020000.serial
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group uart1grp
function imx6ul-evk

device 2020000.serial
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART1_TX_DATA
config 0001b0b1

device 2020000.serial
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART1_RX_DATA
config 0001b0b1

device 2010000.ecspi
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group ecspi3grp-0
function imx6ul-evk

device 2010000.ecspi
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART2_CTS_B
config 000110b1

device 2010000.ecspi
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART2_RTS_B
config 000110b1

device 2010000.ecspi
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART2_RX_DATA
config 000110b1

device 2010000.ecspi
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART2_TX_DATA
config 000010b0

device 2188000.ethernet
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group enet1grp
function imx6ul-evk

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_RX_EN
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_RX_ER
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_RX_DATA0
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_RX_DATA1
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_TX_EN
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_TX_DATA0
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_TX_DATA1
config 0001b0b0

device 2188000.ethernet
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_ENET1_TX_CLK
config 0001b031

device 20bc000.wdog
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group wdoggrp
function imx6ul-evk

device 20bc000.wdog
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_RESET
config 000030b0

device 2200000.aips-bus:wfx_pwrseq
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group wfx_reset_grp
function imx6ul-evk

device 2200000.aips-bus:wfx_pwrseq
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA14
config 0001b0b0

device 2190000.usdhc
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group usdhc1grp
function imx6ul-evk

device 2190000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_SD1_CMD
config 00017059

device 2190000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_SD1_CLK
config 00010071

device 2190000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_SD1_DATA0
config 00017059

device 2190000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_SD1_DATA1
config 00017059

device 2190000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_SD1_DATA2
config 00017059

device 2190000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_SD1_DATA3
config 00017059

device 2194000.usdhc
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group usdhc2grp
function imx6ul-evk

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA18
config 0001b0b0

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA19
config 000100b0

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA20
config 0001b0b0

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA21
config 0001b0b0

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA22
config 0001b0b0

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA23
config 0001b0b0

device 2194000.usdhc
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA06
config 0001b0b0

device 202c000.sai
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group sai2grp
function imx6ul-evk

device 202c000.sai
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_JTAG_TDI
config 00017088

device 202c000.sai
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_JTAG_TDO
config 00017088

device 202c000.sai
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_JTAG_TRST_B
config 00011088

device 202c000.sai
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_JTAG_TCK
config 00011088

device 202c000.sai
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_JTAG_TMS
config 00017088

device 2090000.flexcan
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group flexcan0grp
function imx6ul-evk

device 2090000.flexcan
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART3_RTS_B
config 0001b020

device 2090000.flexcan
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_UART3_CTS_B
config 0001b020

device 2094000.flexcan
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group flexcan1grp
function imx6ul-evk

device 2094000.flexcan
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA11
config 0001b020

device 2094000.flexcan
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA10
config 0001b020

device mmc1:0001:1
state default
type MUX_GROUP (2)
controlling device 20e0000.iomuxc
group wfx_wakeup_grp
function imx6ul-evk

device mmc1:0001:1
state default
type CONFIGS_PIN (3)
controlling device 20e0000.iomuxc
pin MX6UL_PAD_LCD_DATA08
config 000130b0

 

 

 

 

 

root@OpenWrt:/# cat /sys/kernel/debug/pinctrl/pinctrl-handles
Requested pin control handlers their pinmux maps:
device: 20e0000.iomuxc current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: hoggrp-1 (0) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART1_RTS_B (36)config 00017059
device: 208c000.pwm current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: pwm4grp (8) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_GPIO1_IO05 (28)config 000110b0
device: 2020000.serial current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: uart1grp (10) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART1_TX_DATA (33)config 0001b0b1
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART1_RX_DATA (34)config 0001b0b1
device: 2010000.ecspi current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: ecspi3grp-0 (2) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART2_CTS_B (39)config 000110b1
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART2_RTS_B (40)config 000110b1
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART2_RX_DATA (38)config 000110b1
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART2_TX_DATA (37)config 000010b0
device: 2188000.ethernet current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: enet1grp (5) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_RX_EN (51)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_RX_ER (56)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_RX_DATA0 (49)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_RX_DATA1 (50)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_TX_EN (54)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_TX_DATA0 (52)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_TX_DATA1 (53)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_ENET1_TX_CLK (55)config 0001b031
device: 20bc000.wdog current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: wdoggrp (17) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_RESET (69)config 000030b0
device: 2200000.aips-bus:wfx_pwrseq current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: wfx_reset_grp (15) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA14 (84)config 0001b0b0
device: 2190000.usdhc current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: usdhc1grp (11) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_SD1_CMD (111)config 00017059
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_SD1_CLK (112)config 00010071
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_SD1_DATA0 (113)config 00017059
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_SD1_DATA1 (114)config 00017059
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_SD1_DATA2 (115)config 00017059
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_SD1_DATA3 (116)config 00017059
device: 2194000.usdhc current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: usdhc2grp (14) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA18 (88)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA19 (89)config 000100b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA20 (90)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA21 (91)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA22 (92)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA23 (93)config 0001b0b0
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA06 (76)config 0001b0b0
device: 202c000.sai current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: sai2grp (9) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_JTAG_TDI (20)config 00017088
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_JTAG_TDO (19)config 00017088
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_JTAG_TRST_B (22)config 00011088
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_JTAG_TCK (21)config 00011088
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_JTAG_TMS (18)config 00017088
device: 2090000.flexcan current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: flexcan0grp (6) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART3_RTS_B (44)config 0001b020
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_UART3_CTS_B (43)config 0001b020
device: 2094000.flexcan current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: flexcan1grp (7) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA11 (81)config 0001b020
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA10 (80)config 0001b020
device: mmc1:0001:1 current state: default
  state: default
    type: MUX_GROUP controller 20e0000.iomuxc group: wfx_wakeup_grp (16) function: imx6ul-evk (0)
    type: CONFIGS_PIN controller 20e0000.iomuxc pin MX6UL_PAD_LCD_DATA08 (78)config 000130b0

 

 

 

I am trying to toggle at custom hardware so is it some SW issue affects such behaviour or it is only HW issue? I tested my HW and I don't get any shortings between that GPIO pads (tested using multimeter).

Any idea what might be wrong? Thank you.

 

 

EDIT.

So after reading this: https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295981

Added following to dts's `pinctr_hog_1:

MX6UL_PAD_NAND_ALE__GPIO4_IO10          0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_DATA03__GPIO4_IO05       0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_READY_B__GPIO4_IO12      0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_CLE__GPIO4_IO15          0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_CE0_B__GPIO4_IO13        0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_CE1_B__GPIO4_IO14        0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_WP_B__GPIO4_IO11         0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_DQS__GPIO4_IO16          0x000010B0 /* General GPIO */
MX6UL_PAD_LCD_DATA09__GPIO3_IO14        0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_DATA00__GPIO4_IO02       0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_RE_B__GPIO4_IO00         0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_WE_B__GPIO4_IO01         0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_DATA01__GPIO4_IO03       0x000010B0 /* General GPIO */
MX6UL_PAD_NAND_DATA02__GPIO4_IO04       0x000010B0 /* General GPIO */

After that gpio started to work as expected.

Now I need to do same for 4 more tamper gpios. So using Config Tools for i.MX Version 8.0 got following node for dts:

&iomuxc_snvs {
   pinctrl-names = "default_snvs";
   pinctrl-0 = <&pinctrl_hog_2>;
   imx6ul-evk {
      pinctrl_hog_2: hoggrp-2 {
         fsl,pins = <
            MX6ULL_PAD_SNVS_TAMPER1__GPIO5_IO01        0x000110A0
            MX6ULL_PAD_SNVS_TAMPER4__GPIO5_IO04        0x000110A0
            MX6ULL_PAD_SNVS_TAMPER5__GPIO5_IO05        0x000110A0
            MX6ULL_PAD_SNVS_TAMPER9__GPIO5_IO09        0x000110A0
         >;
      };
   };
};

But it throws me syntax error during dts compilation on MX6ULL_PAD_SNVS_TAMPER1__GPIO5_IO01 row.

If I replace gpio names from MX6ULL..  to MX6UL.. it compiles but stucks on kernel loading. How could I fix this?

0 Kudos
Reply
0 Replies