A good tutorial here:
http://derekmolloy.ie/gpios-on-the-beaglebone-black-using-device-tree-overlays/
simple example:
cd /sys/class/gpio
cd gpio60
echo 60 > export
echo out > direction
echo 1 > value
good luck
Jan
On Tuesday, December 9, 2014 1:41:10 AM UTC+11, Hemant Kapoor wrote:
>
> Hello All,
>
> I am a newbie to Linux and trying to figure out how device tree overlay
> works...
>
> So after googling for many days, I came up with below device tree:
>
> /dts-v1/;
> /plugin/;
>
> / {
> compatible = "ti,beaglebone", "ti,beaglebone-black";
>
> /* identification */
> part-number = "MY-LED";
> version = "00A0";
>
> /* state the resources this cape uses */
> exclusive-use =
> /* the pin header uses */
> "P9.12", /* GPIO*/
> /* the hardware ip uses */
> "gpio0";
>
> fragment@0 {
> target = <&am33xx_pinmux>;
> __overlay__ {
> bb_mygpio_pins: pinmux_bb_mygpio_pins {
> pinctrl-single,pins = <
> 0x870 0x07 /*
> output mode | MODE7, see Pin_Configuration.pdf in BBB */
> >;
> };
> };
> };
>
> fragment@1 {
> target = <&ocp>; /* not sure why it is not gpio0 */
> __overlay__ {
> status = "okay";
> pinctrl-names = "default";
> pinctrl-0 = <&bb_mygpio_pins>;
> };
> };
> };
>
>
> I was able to "build" the dtc and generated MY-LED-00A0.dtbo
>
> I then copied the MY-LED-00A0.dtbo to /lib/firmware
>
> Then i echoed it to slots:
> echo MY-LED > $SLOTS
>
> and cat $SLOTS gives me below result:
>
> root@beaglebone:/lib/firmware# cat $SLOTS
> 0: 54:PF---
> 1: 55:PF---
> 2: 56:PF---
> 3: 57:PF---
> 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
> 5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
> 6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN
> 9: ff:P-O-L Override Board Name,00A0,Override Manuf,MY-LED
>
> By looks of this, MY_LED seems to be loaded...
>
>
> The main confusion is how can I use MY-LED?
> Where are the files for MY-LED present?
>
> Any help or guidance is much appreciated.
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.