AnsweredAssumed Answered

GPIO set value and get value

Question asked by cily mo on Aug 3, 2017
Latest reply on Aug 4, 2017 by Rita Wang


     I'm confused for the gpio control. Here is my step:

       1:    int pin_num = of_get_named_gpio(np, "345-en,fsl", 0);   //GPIO2 IO03  pin_num = 35;

       2:    gpio_direction_output(pin_num, 1);   //Voltage high

      3:    gpiod_get_value(gpio_to_desc(pin_num));   //get "0"

       4:    gpiod_set_value(gpio_to_desc(pin_num),0);   //voltage low

       5:    gpiod_get_value(gpio_to_desc(pin_num));  //get "0"

       6:   gpiod_set_value(gpio_to_desc(pin_num),1);  //voltage high

      7:   gpiod_get_value(gpio_to_desc(pin_num)); //get "0"

       Every time I get the gpio value is "0",  but the pin voltage is the same(high/low) what I set.  how can i get the GPIO value after i set.