Using GPIO's on IMX6 SLEVK

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Using GPIO's on IMX6 SLEVK

2,439件の閲覧回数
praveendosapati
Contributor I

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

ラベル(3)
0 件の賞賛
返信
2 返答(返信)

1,203件の閲覧回数
fabio_estevam
NXP Employee
NXP Employee

I found one issue that prevented GPIO usage on mx6slevk board and I fixed it with this commit:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/arch/arm/boot/dts/imx6sl-evk....

0 件の賞賛
返信

1,203件の閲覧回数
CarlosCasillas
NXP Employee
NXP Employee

Hi,

Could you please specify which BSP are you using?

Have you checked/compared your configurations with the provided on the i.MX6 IOMUX_TOOL? It could be downloaded from here.

Additionally, you could check the solutions provided on the following threads:

Re: I.MX6 Multiplexer GPIO

Re: imx.6 GPIO


Hope this will be useful for you.
Best regards!
/Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信