This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to make gpio input and get gpio

Other Parts Discussed in Thread: AM3517

I am using am3517 som-m2 ,I want to write gpio 34 and get gpio 34,i do as follow

 

gpio_request(34,"b");

gpio_set_value(34 ,1);

int a;
  a=gpio_get_value(34);

printk("%x\n",a);

but i can no get 1,always 0

why? anyone who could help me, many thanks!

  • Hi Hongsen,

    I confused with your other thread.

    http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/416/t/181708.aspx

    Which GPIO line you want to control 88 or 34?

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi Hongsen,

    Better close one thread and we can follow single one.

    You will get some pointers from this thread

    http://e2e.ti.com/support/embedded/linux/f/354/p/178496/643926.aspx#643926

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

  • Hi ,

    I want to control gpio 119 ang 88,i do as follow

    mount -t debugfs debugfs /sys/kernel/debug/
     cat /sys/kernel/debug/gpio


    GPIOs 0-31, gpio:

    GPIOs 32-63, gpio:
     gpio-57  (USB1 PHY reset      ) out hi

    GPIOs 64-95, gpio:

    GPIOs 96-127, gpio:
     gpio-126 (mmc_wp              ) in  hi
     gpio-127 (mmc_cd              ) in  hi irq-287 edge-both

    GPIOs 128-159, gpio:
     gpio-128 (mmc_cd              ) in  hi irq-288 edge-both
     gpio-129 (mmc_wp              ) in  hi

    GPIOs 160-191, gpio:
     gpio-176 (lcd_panel_pwr       ) out hi
     gpio-181 (lcd_pwm             ) out hi
     gpio-182 (lcd_backlight_pwr   ) out hi

     

    cat /sys/kernel/debug/omap_gpio

    GPIO  57 (USB1 PHY reset      ): out hi
    GPIO 126 (mmc_wp              ): in  hi
    GPIO 127 (mmc_cd              ): in  hi, irq-287 bothedge
    GPIO 128 (mmc_cd              ): in  lo, irq-288 bothedge
    GPIO 129 (mmc_wp              ): in  hi
    GPIO 176 (lcd_panel_pwr       ): out hi
    GPIO 181 (lcd_pwm             ): out hi
    GPIO 182 (lcd_backlight_pwr   ): out hi

     


    echo 119 > export
    echo out > direction
    echo 1 > value
    echo 0 > value

    it can toggle ,i can control gpio 119


    echo 88 > export
    echo out > direction
    echo 1 > value
    echo 0 > value

    it can not toggle i can not control gpio 88
    why?

     cat /sys/kernel/debug/omap_gpio

    GPIO  57 (USB1 PHY reset      ): out hi
    GPIO  88 (sysfs               ): out hi
    GPIO 119 (sysfs               ): out hi
    GPIO 126 (mmc_wp              ): in  hi
    GPIO 127 (mmc_cd              ): in  hi, irq-287 bothedge
    GPIO 128 (mmc_cd              ): in  hi, irq-288 bothedge
    GPIO 129 (mmc_wp              ): in  hi
    GPIO 176 (lcd_panel_pwr       ): out hi
    GPIO 181 (lcd_pwm             ): out hi
    GPIO 182 (lcd_backlight_pwr   ): out hi

    in uboot i found

    MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)) /*DSS_DATA18*/\  gpio 88
    MUX_VAL(CP(MCBSP2_DX), (IDIS | PTD | DIS | M0)) /*McBSP2_DX*/\   gpio119

    I can control gpio 119 so it prove M0 is ok;but why can not i control gpio 88 ? what is the reason ?

  • i have solved the problem many thanks

  • Hi, is there any chance you could explain how you solved the problem?

    Thanks,

    David