天天乐棋牌

推荐产品
联系我们
北京立萨科技有限公司

咨询热线:天天乐棋牌010-82488292

公司电话:天天乐棋牌010-82488292

公司传真:010-82611646

企业邮箱:天天乐棋牌sales@regdept.com

地址:天天乐棋牌北京市海淀区中关村大街19号 新中关大厦B座南翼15层1509室

当前位置:立萨科技天天乐棋牌 » 新闻资讯 » 常见问题简答 » I.MX6 评估板 开发指导(GPIO)

I.MX6 评估板 开发指导(GPIO)

文章出处:立萨科技 人气:9
摘要 : I.MX6 GPIO的值计算方法是(所在的组 - 1) * 32 + 序号,所以GPIO_1_20的管脚值为 (1 – 1) * 32 + 20 = 20。

  I.MX6 PINGGUBAN KAIFAZHIDAO(GPIO)IF">[size=0.875em]

  MULU[size=12.502px] [YINZANG]

天天乐棋牌  1GPIOSHUCHUHESHURU

  1.1XIUGAI.hWENJIAN

  1.2PEIZHINEIHE

  1.3BIANYI

  1.4ZHONGXINSHAOXIEXITONGBINGQIDONG

  1.5SHEBEICAOZUO

  1.5.1CHAKANgpioMULU

  1.5.2XIANGXITONGZHUCEGPIO

  1.5.3GPIOSHUCHUKONGZHI

  1.5.4GPIOSHURUSHEZHI

天天乐棋牌  1.5.5ZHUXIAOGPIOJIEKOU

  2GPIO LED

  2.1JINRUNEIHEMULU

  2.2TIANJIADAIMA

  2.2.1XIUGAI.hWENJIAN

  2.2.2XIUGAI.cWENJIAN

  2.3NEIHEPEIZHI

  2.4BIANYI

天天乐棋牌  2.5ZHONGXINSHAOXIEXITONGBINGQIDONG

天天乐棋牌  2.6GPIO_LEDCAOZUO

天天乐棋牌  2.6.1SHEBEIWENJIANMULU

天天乐棋牌  2.6.2CAOZUOSHILI

  3GPIOANJIAN

天天乐棋牌  3.1XIUGAI.hWENJIAN

天天乐棋牌  3.2XIUGAI.cWENJIAN

  3.3NEIHEPEIZHI

  3.4BIANYI

  3.5ZHONGXINSHAOXIEXITONGBINGQIDONG

天天乐棋牌  3.6GPIOANJIANCAOZUO

天天乐棋牌  3.6.1GPIO_KEYSSHEBEI

  3.6.2CHAKANSHEBEIXINXI

  3.6.3SHEBEIWENJIAN

天天乐棋牌  3.6.4CAOZUOSHILI

  GPIOSHUCHUHESHURU

  GPIOSHURUSHUCHUYISD1_CLKGUANJIAOWEILI。

  XIUGAI.hWENJIAN

  1)JIANCHATOUWENJIANZHONGDUISD1_CLKDEPEIZHI

  SHILIRUXIA:

天天乐棋牌  $ sed -n "/PAD_SD1_CLK/p" arch/ARM/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  2)ZHUSHITOUWENJIANZHONGDUISD1_CLKDEPEIZHI

  SHILIRUXIA:

  $ sed -i "s/MX6Q_PAD_SD1_CLK/// &/g" arch/arm/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  3)ZAImx6q_sabresd_padsZHONGTIANJIADUISD1_CLKDEPEIZHI

  PEIZHISD1_CLKGONGNENGWEIMX6Q_PAD_SD1_CLK__GPIO_1_20

  SHILIRUXIA:

  $ sed -i "/mx6q_sabresd_pads/a\ MX6Q_PAD_SD1_CLK__GPIO_1_20,"

天天乐棋牌  arch/arm/mach-mx6/board-mx6q_sabresd.h

  4)CHAKANXIUGAIJIEGUO

  SHILIRUXIA:

  $ sed -n "/PAD_SD1_CLK/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

  PEIZHINEIHE

  CAIDANDINGWEI

天天乐棋牌  Device Drivers ---> -*- GPIO Support ---> /sys/class/gpio/... (sysfs inteRFace)

  BIANYI

  make uImage

天天乐棋牌  ZHONGXINSHAOXIEXITONGBINGQIDONGSHEBEICAOZUOCHAKANgpioMULU

天天乐棋牌  ZAI/sys/class/gpio/MULUXIAKEYIKANDAOYIJINGDAOCHUDEGPIO

  $ ls /sys/class/gpio/

  XIANGXITONGZHUCEGPIO

  SHIYONGechoZHUCEGPIO_1_20DAOXITONG,JIKEKANDAOgpioMULUXIADUOCHUYIGEgpio20MULU。

天天乐棋牌  TISHI:I.MX6 GPIODEZHIJISUANFANGFASHI(SUOZAIDEZU - 1) * 32 + XUHAO,SUOYIGPIO_1_20DEGUANJIAOZHIWEI (1 – 1) * 32 + 20 = 20。

  $ echo 20 > /sys/class/gpio/export

  GPIOSHUCHUKONGZHI

  SHEZHIGUANJIAOWEISHUCHUZHUANGTAI

  $ echo out > /sys/class/gpio/gpio20/direction

天天乐棋牌  SHEZHIGUANJIAOWEISHUCHUWEIGAODIANPING

  echo 1 > /sys/class/gpio/gpio20/value

  SHEZHIGUANJIAOWEISHUCHUWEIDIDIANPING

  echo 0 > /sys/class/gpio/gpio20/value

  GPIOSHURUSHEZHI

  SHEZHIGUANJIAOWEISHURUZHUANGTAI

  echo in > /sys/class/gpio/gpio20/direction

  HUOQUSHURUZHI

  cat /sys/class/gpio/gpio20/value

  ZHUXIAOGPIOJIEKOU

  ZHUXIAOGPIO_1_20

  echo 20 > /sys/class/gpio/unexport

  GPIO LED

  SHUOMING:GPIO LEDYIPAD NANDF_CS0WEILI。

  JINRUNEIHEMULU

  $ cd ~/MY-I.MX6/linux-3.0.35/

  TIANJIADAIMAXIUGAI.hWENJIAN

  1)CHAZHAOTOUWENJIANZHONGDUINANDF_CS0DEPEIZHI

  SHILIRUXIA:

  $ sed -n "/PAD_NANDF_CS0/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  2)ZHUSHITOUWENJIANZHONGDUINANDF_CS0DEPEIZHI

  SHILIRUXIA:

天天乐棋牌  $ sed -i "s/MX6Q_PAD_NANDF_CS0/// &/g" arch/arm/mach-mx6/board-mx6q_sabresd.h

  3)ZAImx6q_sabresd_padsZHONGTIANJIADUINANDF_CS0DEPEIZHI

天天乐棋牌  PEIZHINANDF_CS0GONGNENGWEIMX6Q_PAD_NANDF_CS0__GPIO_6_11

  SHILIRUXIA:

天天乐棋牌  $ sed -i "/mx6q_sabresd_pads/a\ MX6Q_PAD_NANDF_CS0__GPIO_6_11," arch/arm/mach-mx6/board-mx6q_sabresd.h

  4)CHAKANXIUGAIJIEGUO

  SHILIRUXIA:

  $ sed -n "/PAD_NANDF_CS0/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

  XIUGAI.cWENJIAN

  1)JIANCHA.cWENJIANZHONGGPIOSHIFOUBEIZHONGFUSHIYONG

  SHILIRUXIA:

天天乐棋牌  $ sed -n ‘/IMX_GPIO_NR(6,.11)/p‘ arch/arm/mach-mx6/board-mx6q_sabresd.c

  2)ZAI.cWENJIANZHONGZENGJIAGPIODEHONGDINGYI

  ZENGJIA#define SABRESD_USER_LED IMX_GPIO_NR(6, 11)

  SHILIRUXIA:

  $ GPIO_DEFINE="#define SABRESD_USER_LED IMX_GPIO_NR(6, 11)"

  $ sed -i "1,/#define/{/#define/s/#define/${GPIO_DEFINE} &/}" arch/arm/mach-mx6/board-mx6q_sabresd.c

  2)JIANCHAgpio_ledLEIXINGDESHUJUDINGYI

  SHILIRUXIA:

  $ sed -n ‘/struct gpio_led /,/}/p‘ arch/arm/mach-mx6/board-mx6q_sabresd.c

天天乐棋牌  3)ZENGJIAuser_ledDESHUJUDINGYI

  static struct gpio_led imx6q_gpio_leds[] = {

天天乐棋牌  GPIO_LED(SABRESD_USER_LED, "user_led", 0, 1,

天天乐棋牌  "charger"),

  };

  NEIHEPEIZHI

  CAIDANDINGWEI

  Device Drivers ---> LED Support ---> <*> LED Support for GPIO connected LEDs

  BIANYI

  make uImage

  ZHONGXINSHAOXIEXITONGBINGQIDONGGPIO_LEDCAOZUOSHEBEIWENJIANMULU

  QIDONGXITONGHOUJICUNZAI/sys/class/leds/user_ledMULU,SHIYONGlsJIKEKANDAO

天天乐棋牌  $ ls /sys/class/leds/user_led

  CAOZUOSHILI

  1)ZHINANDF_CS0WEI1

  $ echo 1 > /sys/class/leds/user_led/brightness

  2)ZHINANDF_CS0WEI0

  $ echo 0 > /sys/class/leds/user_led/brightness

  GPIOANJIAN

天天乐棋牌  GPIOANJIANYIGPIO_4、EIM_BCLK、CSI0_DATA_ENWEILI,FENBIESHIYUANLITUDEANJIANSW2,SW3HESW4。

  XIUGAI.hWENJIAN

  1)CHAZHAOTOUWENJIANZHONGDUIPADDEPEIZHI

  SHILIRUXIA:

  $ sed -n "/PAD_GPIO_4/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

  $ sed -n "/PAD_EIM_BCLK/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

  $ sed -n "/PAD_CSI0_DATA_EN/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  2)ZHUSHITOUWENJIANZHONGDUIPADDEPEIZHI

  SHILIRUXIA:

天天乐棋牌  $ sed -i "s/MX6Q_PAD_GPIO_4/// &/g" arch/arm/mach-mx6/board-mx6q_sabresd.h

  $ sed -i "s/MX6Q_PAD_EIM_BCLK/// &/g" arch/arm/mach-mx6/board-mx6q_sabresd.h

  $ sed -i "s/MX6Q_PAD_CSI0_DATA_EN/// &/g" arch/arm/mach-mx6/board-mx6q_sabresd.h

  3)ZAImx6q_sabresd_padsZHONGTIANJIADUIPADDEPEIZHI

天天乐棋牌  PEIZHIGPIO_4GONGNENGWEIMX6Q_PAD_GPIO_4__GPIO_1_4

  SHILIRUXIA:

  $ sed -i "/mx6q_sabresd_pads/a\ MX6Q_PAD_GPIO_4__GPIO_1_4," arch/arm/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  PEIZHIEIM_BCLKGONGNENGWEIMX6Q_PAD_EIM_BCLK__GPIO_6_31

  SHILIRUXIA:

  $ sed -i "/mx6q_sabresd_pads/a\ MX6Q_PAD_EIM_BCLK__GPIO_6_31," arch/arm/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  PEIZHICSI0_DATA_ENDEPADGONGNENGWEIMX6Q_PAD_CSI0_DATA_EN__GPIO_5_20

  SHILIRUXIA:

天天乐棋牌  $ sed -i "/mx6q_sabresd_pads/a\ MX6Q_PAD_CSI0_DATA_EN__GPIO_5_20," arch/arm/mach-mx6/board-mx6q_sabresd.h

  4)CHAKANXIUGAIJIEGUO

  SHILIRUXIA:

天天乐棋牌  $ sed -n "/PAD_GPIO_4/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

天天乐棋牌  $ sed -n "/PAD_EIM_BCLK/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

  $ sed -n "/PAD_CSI0_DATA_EN/p" arch/arm/mach-mx6/board-mx6q_sabresd.h

  XIUGAI.cWENJIAN

  1)JIANCHA.cWENJIANZHONGGPIOSHIFOUBEIZHONGFUSHIYONG

  SHILIRUXIA:

天天乐棋牌  $ sed -n ‘/IMX_GPIO_NR(1,.4)/p‘ arch/arm/mach-mx6/board-mx6q_sabresd.c

  $ sed -n ‘/IMX_GPIO_NR(6,.31)/p‘ arch/arm/mach-mx6/board-mx6q_sabresd.c

天天乐棋牌  $ sed -n ‘/IMX_GPIO_NR(5,.20)/p‘ arch/arm/mach-mx6/board-mx6q_sabresd.c

天天乐棋牌  2)ZAI.cWENJIANZHONGZENGJIAGPIODEHONGDINGYI

天天乐棋牌  MX6Q_PAD_GPIO_4__GPIO_1_4

  ZAI.cWENJIANZHONGTIANJIA#define SABRESD_POWER_OFF IMX_GPIO_NR(1, 4)

  SHILIRUXIA:

天天乐棋牌  $ GPIO_DEFINE="#define SABRESD_POWER_OFF IMX_GPIO_NR(1, 4)"

天天乐棋牌  $ sed -i "1,/#define/{/#define/s/#define/${GPIO_DEFINE} &/}" arch/arm/mach-mx6/board-mx6q_sabresd.c

天天乐棋牌  MX6Q_PAD_CSI0_DATA_EN__GPIO_5_20

  ZAI.cWENJIANZHONGTIANJIA#define SABRESD_VOLUME_UP IMX_GPIO_NR(6, 31)

  SHILIRUXIA:

天天乐棋牌  $ GPIO_DEFINE="#define SABRESD_VOLUME_UP IMX_GPIO_NR(6, 31)"

天天乐棋牌  $ sed -i "1,/#define/{/#define/s/#define/${GPIO_DEFINE} &/}" arch/arm/mach-mx6/board-mx6q_sabresd.c

  MX6Q_PAD_CSI0_DATA_EN__GPIO_5_20

  ZAI.cWENJIANZHONGTIANJIA#define SABRESD_VOLUME_DN IMX_GPIO_NR(5, 20)

  SHILIRUXIA:

  $ GPIO_DEFINE="#define SABRESD_VOLUME_DN IMX_GPIO_NR(5, 20)"

天天乐棋牌  $ sed -i "1,/#define/{/#define/s/#define/${GPIO_DEFINE} &/}" arch/arm/mach-mx6/board-mx6q_sabresd.c

天天乐棋牌  3)JIANCHAgpio_keys_buttonLEIXINGDESHUJUDINGYI

  SHILIRUXIA:

天天乐棋牌  $ sed -n ‘/gpio_keys_button/,/}/p‘ arch/arm/mach-mx6/board-mx6q_sabresd.c

  4)ZENGJIAvolume-up、volume-down、powerDESHUJUDINGYI

  static struct gpio_keys_button imx6q_buttons[] = {

  GPIO_BUTTON(SABRESD_VOLUME_UP, KEY_VOLUMEUP, 1, "volume-up", 0, 1),

  GPIO_BUTTON(SABRESD_VOLUME_DN, KEY_VOLUMEDOWN, 1, "volume-down", 0, 1),

天天乐棋牌  GPIO_BUTTON(SABRESD_POWER_OFF, KEY_POWER, 1, "power", 1, 1),

  };

  NEIHEPEIZHI

  CAIDANDINGWEI:

  Device Drivers ---> Input device support ---> Keyboards ---> <*> GPIO Buttons

  BIANYI

天天乐棋牌  make uImage

  ZHONGXINSHAOXIEXITONGBINGQIDONGGPIOANJIANCAOZUOGPIO_KEYSSHEBEI

  QIDONGXITONGHOUJICUNZAI/sys/devices/platform/gpio-keysMULU,SHIYONGlsJIKEKANDAO

天天乐棋牌  $ ls /sys/devices/platform/gpio-keys

  CHAKANSHEBEIXINXI

天天乐棋牌  ZAIprocWENJIANXITONGXIAKEYIKANDAOXIANGGUANXINXI

  $ cat /proc/bus/input/devices

  SHEBEIWENJIAN

天天乐棋牌  event0JIDUIYINGgpioANJIANDUIYINGDESHEBEIWENJIAN,SHIYONGlsKEYICHAKAN:

天天乐棋牌  $ ls /dev/input/event0 –la

  CAOZUOSHILI

天天乐棋牌  JIANLinuxCESHISHOUCE

我要评论:  
*内 容:
验证码: 换一张
 

共有0条评论

还在等什么,赶紧来评论!