GPIO Configuration for Colibri iMX6DL

Hi,
We are using Colibri iMX6DL 512MB with Embedded Linux V2.8 modified with yocto and we are using using it on a Colibri Evaluation board V3.2.
For our application, we are using 16 GPIO pins as inputs. Out of these 16 pins 13 pins were already exported as GPIO by default so there is no problem with these pins for using with libsoc. In the remaining three pins, two of them (SODIMM_99 and SODIMM_105) are already exported as GPIO input by default but i cannot control them with libsoc from my code.
The remaining last pin (SODIMM_67) is configured as GPIO with Linux number 1 and as PWM out with Linux number 49. So i am confused on how to change the muxing of this pin . Do i need to change this in the device tree to control these pins with libsoc from my code or is there any-other way to make this pins work with libsoc?

HI @nishanth1829

So what is your question?

Best regards,
Jaski

HI @jaski.tx ,
As you asked, i have attached my code and dmesg log as text file below.

Code:

#define pin1  1       //  SODI_MM_67
#define pin2  12     //  SODI_MM_99
#define pin3  55     //  SODI_MM_105

#include<stdio.h>
#include "libsoc_gpio.h"
#include "libsoc_debug.h"

int main()
{
     gpio *ip[3];
     ip[0]=libsoc_gpio_request(pin1,LS_GPIO_SHARED);
     ip[1]=libsoc_gpio_request(pin2,LS_GPIO_SHARED);
     ip[2]=libsoc_gpio_request(pin3,LS_GPIO_SHARED);
     if(ip[0]==NULL || ip[1]==NULL || ip[2]==NULL)
     {
           printf("GPIO FAILED\n");
           return 0;
      }
      for(int  i=0;i<3;i++)
      {
          libsoc_gpio_set_direction(ip[i],INPUT);
          if(libsoc_gpio_get_direction(ip[i])!=INPUT)
          {
               printf("Set as ip failed\n");   return 0;
          }
      }
      while(1)
      {
           for(int i=0;i<3;i++)
           {
           if(libsoc_gpio_get_level(ip[i])==LOW) {prinf("pin %d is LOW\n",i);}
           else         {printf("pin %d is HIGH\n",i);}
            }
        }
   return 0;
   }

While running this code, I am always getting HIGH even when these pins are grounded. ie) the pins are always high irrespective of my input.

And I just found a dmesg file in the folder /usr/lib/opkg/alternatives/dmesg and i have attached file that file which contains only two lines. Is this the same file you were asking for?

Also sorry that by misclick i clicked on delete in my previous comment which also deleted your reply in which you asked for the code and dmesg file. As you said the SODIMM_105 is exported as eim.EIM_CS0 and how to change it to GPIO? Is altering Device tree the only way?

Thanks and Regards,
Nishanth

HI @nishanth1829

Also sorry that by misclick i clicked on delete in my previous comment which also deleted your reply in which you asked for the code and dmesg file.

Thats ok.

As you said the SODIMM_105 is exported as eim.EIM_CS0 and how to change it to GPIO? Is altering Device tree the only way?

Yes, you need to change the device-tree files.

Best regards,
Jaski