AnsweredAssumed Answered

Using GPIO's on IMX6 SLEVK

Question asked by praveen dosapati on Sep 25, 2014
Latest reply on Oct 4, 2014 by Fabio Estevam

Hi,

     I need two GPIO's on IMX6 SLEVK board. I have Identified one GPIO (LCD_DAT0) (GPIO_2_20). But When I am trying to toggle this GPIO  I didn't observe any change in the output on Analyser. I have written the following code for toggling GPIO. Could some help me in toggling GPIO.

 

#define MX6_PAD_EIM_ADDR18_GPIO_2_20   IOMUX_PAD(0x04B8, 0x01B0,5, 0x0000, 0, NO_PAD_CTRL)
 
#define MX6SL_PAD_I2C1_SCL_GPIO_3_12   IOMUX_PAD(0x044C, 0x015C,5, 0x0000, 0, NO_PAD_CTRL)

#define GPIO2_20  (unsigned int)((1*32)+20)

#define GPIO3_12  (unsigned int)((2*32)+12)


int setup_imx_gpio(void);

 

int setup_imx_gpio()

{

//  uint32 pad_gpio;

   iomux_v3_cfg_t pad_gpio;

 

  signed int res = 1;

 

// gpio code  for  I2C1_SCL  U1 IC  AC13

  gpio_free(GPIO3_12);

  res = gpio_request(GPIO3_12, "GPIO3_12");

  if (res)

  {

    printk("Failed in Setup the GPIO3_12, error=%d\n", res);

    return res;

  }

  pad_gpio = (iomux_v3_cfg_t) MX6SL_PAD_I2C1_SCL_GPIO_3_12;

  mxc_iomux_v3_setup_pad(pad_gpio);

 

res = gpio_direction_output(GPIO3_12, 0);

//    res = gpio_direction_input(GPIO3_12);

 

  if (res)

  {

   printk("Failed in Setup Direction for the GPIO3_12, error=%d\n", res);

    return res;

  }

 

// gpio code  for  LCD_DAT0  J13-62

  gpio_free(GPIO2_20);

  res = gpio_request(GPIO2_20, "GPIO2_20");

  if (res)

  {

    printk("Failed in Setup the GPIO2_20, error=%d\n", res);

    return res;

  }

  pad_gpio = (iomux_v3_cfg_t) MX6_PAD_EIM_ADDR18_GPIO_2_20;

  mxc_iomux_v3_setup_pad(pad_gpio);

 

 

//  res = gpio_direction_input(GPIO2_20);

  res = gpio_direction_output(GPIO2_20, 1); /* I need to Make this GPIO High by default*/

  if (res)

  {

    printk("Failed in Setup Direction for the GPIO2_20, error=%d\n", res);

    return res;

  }

  return 0;

}

#endif

Outcomes