I have a BBB (running Ubuntu) connected to a custom cape which uses some 
GPIO pins for input and output. The output pins work as expected without 
any extra configuration, I'm just exporting the required pins in the 
/sys/class/gpio folder, setting the direction, and writing values. 

One of the GPIOs (specifically GPIO1_15) is connected to a button, which 
when pushed I want to shut down the BBB. I export the pin the same way I do 
the outputs, set the direction, and try reading the value. The value is 
always read as 0, regardless of whether the button is pressed or not. Is 
there any extra configuration needed for using GPIO inputs?

Looking at the pinmux for this pin in 
/sys/kernel/debug/pinctrl/44e10800.pinmux I get:

pin 15 (44e1083c) 00000027 pinctrl-single

which I take to mean that this pin is already configured for GPIO. I did a 
device tree overlay for that pin only for testing purposes, setting it to 
0x07. The pinmux changed, but it still behaved the same way. The tree 
overlay I tried:

/dts-v1/;
/plugin/;

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "bb-gpio";
    version = "00A0";

    exclusive-use =
                /* the pin header uses */
                "P8.15",        /* GPIO1_15 */
                /* the hardware ip uses */
                "GPIO1_15";

    fragment@0 {
            target = <&am33xx_pinmux>;
            __overlay__ {
                    bb_GPIO1_15_pins: pinmux_bb_GPIO1_15_pins {
                            pinctrl-single,pins = <
                                    0x03c 0x07
                            >;
                    };
            };
    };
    fragment@1 {
            target = <&ocp>;
            __overlay__ {
                    /* avoid stupid warning */
                    #address-cells = <1>;
                    #size-cells = <1>;

                    gpio1_15_test {
                            compatible = "bone-pinmux-helper";
                            pinctrl-names = "default";
                            pinctrl-0 = <&bb_GPIO1_15_pins>;
                            status = "okay";
                    };
            };
    };
};




We tested the cape without a BBB attached and the button sent a signal when 
pushed as expected. Any ideas on what is going wrong?

Thanks

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to