GPIOs in Colibri iMX6

Dear Community;

I have recently installed Linux 2.7 BSP in the iMX6 using legacy scripts. In order to use GPIOs from sys I have modified imx6dl-colibri-eval-v3.dtb file and added “status = “disabled”;” in gpio_keys. However I can’t use GPIO 54 SODIMM pin 45 that it was set as wake up. But this GPIO doesn’t appear more as wake up button, so what is failing? This is my cat /sys/kernel/debug/gpio" output:

root@colibri-imx6:~# cat /sys/kernel/debug/gpio                                                                                                 
GPIOs 0-31, platform/209c000.gpio, 209c000.gpio:                                                                                                
GPIOs 32-63, platform/20a0000.gpio, 20a0000.gpio:                                                                                               
 gpio-37  (cd                  ) in  hi                                                                                                         
GPIOs 64-95, platform/20a4000.gpio, 20a4000.gpio:                                                                                               
 gpio-90  (enable              ) out lo                                                                                                         
 gpio-95  (usb_host_vbus       ) out lo                                                                                                         
GPIOs 96-127, platform/20a8000.gpio, 20a8000.gpio:                                                                                              
 gpio-108 (scl                 ) in  hi                                                                                                         
 gpio-109 (sda                 ) in  hi                                                                                                         
GPIOs 128-159, platform/20ac000.gpio, 20ac000.gpio:                                                                                             
 gpio-130 (spi_imx             ) out lo                                                                                                         
GPIOs 160-191, platform/20b0000.gpio, 20b0000.gpio:                                                                                             
GPIOs 192-223, platform/20b4000.gpio, 20b4000.gpio:                                                                                             
 gpio-204 (id                  ) in  lo

But now I also have problems other GPIO. The GPIOs I use to read digital inputs are GPIO 15, 52, 50, and 51, SODIMM pins 98, 103, 97 and 79 respectively. The problem is that when I read that Gpios they are set to 1 when the digital inputs are OFF or ON. They are always set to 1 without changes…

With the Colibri iMX7 I have followed the same procedure and everything works perfectly.

I wonder if the imx6dl-colibri-eval-v3.dtb change could have triggered this failure…

Thanks in advance;


I have been looking at GPIO (Linux) post of the developer site and I have read this:

For i.MX 6 based modules you need to make sure that the pin is actually muxed as a GPIO in the device-tree or platform data. Failing to do so will not give any error. The pin will simply report 0 if configured as an input and not react to any state change if configured as an output.

I understand that this might be the problem, if anyone can give me any steps to solve that…

Dear @Andermutu

Sorry for the late answer, I first wanted to test it on my own. As far as I understand you want to disable the wake up functionality on pin GPIO 45 and still use the GPIOs 15, 52, 50 and 51. Could you confirm my understanding?

Did you do the export of the GPIOs properly as described in this article? Because in your output it doesn’t even show the exported GPIO ports…

Yes, the hint you saw on the page is important. You need to make sure that you can use your selected ports as GPIO. Did you do any changes on the device tree? Could you provide the device tree, so we can have a look? Did you also check with the pinout-designer?

I tried to disable the gpio_keys driver in the device tree as you did and was still able to use the GPIO 15 as an input.

Kind regards,

Dear @diego.tx ;

Yes, I want to disable wake up functionality of the SODIMM PIN 45 GPIO 54 (not GPIO 45) to use it via sys as output. (Note that I am using GPIOs 35, 53 and 166 SODIMM pins 133, 101, 85 without problem to control some relays). To disable wake up function you recommended me to disable GPIO keys on device tree in an iMX7, so I have tried the same with iMX6, but it doesn’t work although with cat /sys/kernel/debug/gpio does not appear as wake up.

Then I want to use GPIOs 15, 52, 50 and 51 as inputs, to read digital inputs. The problem is that when I read the value I always always get “1” value regardless the digital input is activated or not.

The GPIOs are exported properly, the output above was capture before being exported to show that GPIO 54 is not set as wake up function…

I install and have a look to Gpio designer as soon as I can…

I will also share the imx6dl-colibri-eval-v3.dts and imx6dl-colibri.dtsi files. I suppose that the problem is that I don’t exactly know how to configure this files properly to set select ports as GPIOs.

If you require more information ask please.

Thanks in advance;


Hi @diego.tx ;

I have been looking for a solution and I have made this test:

I downloaded Toradex BSP for Colibri VF61. I didn’t make any changes in device tree or other file, it was just pure Toradex provided BSP. When installed I try to read the digital inputs, and I always get “1” value again!!!

I don’t exactly know what is happening but I don’t understand this situation, because with iMX7 works perfectly. I read this “1” values in the evaluation board as well as in the Colibri board. The GPIOs I use to read digital inputs on VF61 are 46, 48, 50, 49.

Thanks in adavance.

Dear @Andermutu

We have now two different issues I see. First the GPIO 54 on the Colibri iMX6: If you disable the gpio-keys in the device tree as you did, you need to ensure that the GPIO 54 is still initialized somewhere. For this, add the pin to the GPIOs in the imx6qdl-colibri.dtsi file (line 12 in following extract):

gpio {
                pinctrl_gpio_1: gpio-1 {
                        fsl,pins = <
                                MX6QDL_PAD_EIM_D27__GPIO3_IO27      PAD_CTRL_HYS_PU
                                MX6QDL_PAD_NANDF_D6__GPIO2_IO06     PAD_CTRL_HYS_PU
                                MX6QDL_PAD_NANDF_D3__GPIO2_IO03     PAD_CTRL_HYS_PU
                                MX6QDL_PAD_ENET_REF_CLK__GPIO1_IO23 PAD_CTRL_HYS_PU
                                MX6QDL_PAD_DI0_PIN4__GPIO4_IO20     PAD_CTRL_HYS_PU
                                MX6QDL_PAD_SD4_DAT3__GPIO2_IO11     PAD_CTRL_HYS_PU
                                MX6QDL_PAD_NANDF_D4__GPIO2_IO04     PAD_CTRL_HYS_PU
                                MX6QDL_PAD_SD4_DAT0__GPIO2_IO08     PAD_CTRL_HYS_PU
       /*this line is new*/     MX6QDL_PAD_EIM_A16__GPIO2_IO22      PAD_CTRL_HYS_PU 

Then you can use the GPIO as usual.

The second problem is the use of the other GPIOs (GPIOs 15, 52, 50 and 51). Please remember that the GPIOs can be different for every module, so please check this article. I tested these GPIOs with the default BSP 2.7 on the Colibri iMX6 and just with the changes in the device tree for the GPIO 54 above and it did work. Did you use the pins on the X22 connector on the eval board to connect the GPIOs (18, 8, 10 and 9)? Can you provide me the code you used to export the pins in Linux? I think it could be possible that you mixed up the number somewhere.

Thank you and best regards, Diego

Thank you @diego.tx ;

The first problem it is solved.

Regarding the second problem I don’t really understand what you want to say. I know that for each board GPIOs are different, but SODIMM pins connected to digital inputs are not. For example if I take SODIMM pin 98 I look in the Colibri iMX6 datasheet and I found that corresponds to GPIO1_IO15, that at the same time it is the GPIO 15. The other are 52, 50, 51. Digital inputs I am using the Colibri Board.

Here I share the Python program I use to read the state of digital inputs, and here my results.

iMX6 all DI OFF: [‘1’, ‘1’, ‘1’, ‘1’]
iMX6 all DI ON: [‘1’, ‘1’, ‘1’, ‘1’]

iMX7 all DI OFF:[‘0’, ‘0’, ‘0’, ‘0’]
iMX7 all DI ON:[‘1’, ‘1’, ‘1’, ‘1’]

Note that the program is run in the same Colibri Board.

Thanks in advance.

I also have the same problem with the VF61, I get this results:

VF61 all DI OFF:[‘1’, ‘0’, ‘1’, ‘1’]
VF61 all DI ON: [‘1’, ‘1’, ‘1’, ‘1’]

After turning off again all GPIO:

VF61 all DI OFF:[‘1’, ‘1’, ‘1’, ‘1’]
VF61 all DI ON: [‘1’, ‘1’, ‘1’, ‘1’]

Hi @Andermutu

I think you understood what @diego.tx wanted to say that the same SODIMM Pins corresponds to different GPIO Numbers in Linux for different type of modules.

Concerning your issue: In your python code, there is a typo. the first gpio should be 15 and not 12.

I tested your python script on the regular bsp 2.7 Colibri-iMX6_LXDE-Image 2.7b4 20171004 without any changes and the sodimm 98 was working as expected. It shows 1 without connecting to anything and 0 when it is connecting to GND, since the pins have a PULLUP.
How did you turn the PIN OFF/ON?

Hi @jaski.tx

You are right about the 15 GPIO, I wrote in a paper 15 and then in the program, I wrote 12…

In order to solve this, I have downloaded Colibri-iMX6_LXDE-Image_2.7-20180104.tar.bz2 image and installed it, without any modification.

Now I have that image on my iMX6. When I run the Python script I get this with all digital inputs turned off:

[‘1’, ‘1’, ‘1’, ‘1’]

Considering pullup everything seems good. Now if I change any of the digital inputs I can not notice any change:

[‘1’, ‘1’, ‘1’, ‘1’]

It appears that I can not read any change…

To turn off/on the digital inputs I use a switch. I will upload a picture of that switch. The switch works fine with the iMX7 processor.

@jaski.tx ;

I have made a proof removing that switch and using directly Iris Carrier Board connectors instead of using our Analog/Digital input/output board with the switch and it works as expected. So the mistake appears to be on our board. Now I wonder why our board works with the iMX7 and not with iMX6.

The only difference I know is that iMX7 has pulldown and iMX6 pullup. Is that easily changeable?

Thanks a lot and sorry for and sorry for the inconveniences.

EDIT: I have confirmed that our hardware only works with pulldown. So what’s the procedure to set pulldown instead of pullup?


Thank you @diego_b.tx ,

I have made the changes you have proposed. Now I am also getting [‘1’, ‘1’, ‘1’, ‘1’] values when sodimm pin is not connected to anything. And when I connect a pin to GND I get a “0” value.

Is normal to get [‘1’, ‘1’, ‘1’, ‘1’] values when is not connected to anything? It appears that changes have not made any effect.

Thank you.

Is any way to see that changes have made effect?

Thank you.

Hi @Andermutu

It seems that you didn’t apply the new device tree properly. Please check the registers directly, if you have a pulldown configured or not. For this, you can lookup the address of the register setting in the reference manual of the nxp i.MX6 Solo. On page 1690, chapter 29.4.341, you find the Pad Control Register of the GPIO1_IO15 (Linux GPIO 15). There you see the physical address of this register: 20E_0564h. With the following command on the target, you are then able to check the value in the register and to check if the pulldown is enabled or not:

devmem2 0x20E06E4

You should then get something like 0x000130B0, which is in binary format 0000 0000 0000 0001 0011 0000 1011 0000b. Important now are the bit number 15 and 14, which should both be 0 if you want to have a pulldown enabled.

Please check this and may start again with compiling and deploying the proper device tree if needed.

Best regards, Diego

Thank you @diego_b.tx ;

I have tried starting again with compiling and deploying everything and now it works. Thank you.

Perfect, that it works. Thanks for the feedback.

Hi @Andermutu

You need to configure the pulldown in the device tree. The Colibri iMX6 has a pullup configured on these GPIOs by default.

The device tree should look like this, if you want to use the pulldown:

&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_csi_gpio_1 &pinctrl_csi_gpio_2>;

        csi {
                /* CSI pins used as GPIO */
                pinctrl_csi_gpio_1: csi_gpio-1 {
                        fsl,pins = <
                                MX6QDL_PAD_SD2_CMD__GPIO1_IO11   PAD_CTRL_HYS_PU
                                MX6QDL_PAD_NANDF_CS2__GPIO6_IO15 PAD_CTRL_HYS_PU
                                MX6QDL_PAD_EIM_D18__GPIO3_IO18   PAD_CTRL_HYS_PU
                                MX6QDL_PAD_EIM_A19__GPIO2_IO19   PAD_CTRL_HYS_PD
                                MX6QDL_PAD_EIM_D29__GPIO3_IO29   PAD_CTRL_HYS_PD
                                MX6QDL_PAD_EIM_A23__GPIO6_IO06   PAD_CTRL_HYS_PU
                                MX6QDL_PAD_EIM_A20__GPIO2_IO18   PAD_CTRL_HYS_PD
                                MX6QDL_PAD_EIM_A17__GPIO2_IO21   PAD_CTRL_HYS_PU
                                MX6QDL_PAD_EIM_A18__GPIO2_IO20   PAD_CTRL_HYS_PD
                                MX6QDL_PAD_EIM_EB3__GPIO2_IO31   PAD_CTRL_HYS_PU
                                MX6QDL_PAD_EIM_D17__GPIO3_IO17   PAD_CTRL_HYS_PU
                                MX6QDL_PAD_SD2_DAT0__GPIO1_IO15  PAD_CTRL_HYS_PD

You can also apply this patch to configure the device tree like this. For me, it works like this on the Colibri iMX6 with the eval board.

Best regards, Diego