we know the basics of beaglebone black now its time to know how to configure the beaglebone black so lets start
will write a shellscript for configuring
#!/bin/bash
//It's a convention so the *nix shell knows what kind of interpreter to run.(It's called shebang. In unix-speak, # is called sharp (like in music) or hash (like hashtags on twitter), and ! is called bang.)
echo "adc pin initialise"
//print(echo as adc pin initialise)
echo cape-bone-iio > /sys/devices/bone_capemgr.9/slots
//we r giving slots extention to cape-bone-iio with the help of its directory under bone_capemgr.9(no can be 8 or 9)
echo "export slots"
//in terminal again print exporting slots using echo command
export SLOTS=/sys/devices/bone_capemgr.9/slots
//export the slots of the beaglebone by giving export command with directory direction of slots
echo "export pins"
//print as export pins on the terminal while executing this bash script
export PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins
//now export the pins of the beaglebone black using pinmux(which gives the mode of the pin)
echo "Compiling the overlay from .dts to .dtbo" //print the text
dtc -O dtb -o DM-GPIO-Test-00A0.dtbo -b 0 -@ DM-GPIO-Test.dts
// device tree overlay convert the device tree source file into object file with specified extentions
echo "copy the file" //print the text
cp DM-GPIO-Test-00A0.dtbo /lib/firmware/
//now converted .dtbo file form .dts should be saved in firmware directory under lib,copy that into firmware
echo "echo the file to slots" //print the text
echo DM-GPIO-Test > $SLOTS
//redirect gpio file to slot with sucession case using $!!
echo "export the pin" //print the text using echo
How to Use the GPIO Pins
Access to the various pins in the headers on the left and right side of the BBB is done through the Linux kernel using its GPIO Interfaces.
echo 60 > /sys/class/gpio/export
//now to set the gpio pin we are exporting it,here we are using gpio60
echo "out" > /sys/class/gpio/gpio60/direction
//give out direction for the gpio60th pin(it will be the pin whr we can see the output).
echo 1 > /sys/class/gpio/gpio60/value
//now what to show in the gpio60?? so to give output we need to store that in value directory here we are giving a high value (ie 1).
will write a shellscript for configuring
#!/bin/bash
//It's a convention so the *nix shell knows what kind of interpreter to run.(It's called shebang. In unix-speak, # is called sharp (like in music) or hash (like hashtags on twitter), and ! is called bang.)
echo "adc pin initialise"
//print(echo as adc pin initialise)
echo cape-bone-iio > /sys/devices/bone_capemgr.9/slots
//we r giving slots extention to cape-bone-iio with the help of its directory under bone_capemgr.9(no can be 8 or 9)
echo "export slots"
//in terminal again print exporting slots using echo command
export SLOTS=/sys/devices/bone_capemgr.9/slots
//export the slots of the beaglebone by giving export command with directory direction of slots
echo "export pins"
//print as export pins on the terminal while executing this bash script
export PINS=/sys/kernel/debug/pinctrl/44e10800.pinmux/pins
//now export the pins of the beaglebone black using pinmux(which gives the mode of the pin)
echo "Compiling the overlay from .dts to .dtbo" //print the text
dtc -O dtb -o DM-GPIO-Test-00A0.dtbo -b 0 -@ DM-GPIO-Test.dts
// device tree overlay convert the device tree source file into object file with specified extentions
echo "copy the file" //print the text
cp DM-GPIO-Test-00A0.dtbo /lib/firmware/
//now converted .dtbo file form .dts should be saved in firmware directory under lib,copy that into firmware
echo "echo the file to slots" //print the text
echo DM-GPIO-Test > $SLOTS
//redirect gpio file to slot with sucession case using $!!
echo "export the pin" //print the text using echo
How to Use the GPIO Pins
Access to the various pins in the headers on the left and right side of the BBB is done through the Linux kernel using its GPIO Interfaces.
echo 60 > /sys/class/gpio/export
//now to set the gpio pin we are exporting it,here we are using gpio60
echo "out" > /sys/class/gpio/gpio60/direction
//give out direction for the gpio60th pin(it will be the pin whr we can see the output).
echo 1 > /sys/class/gpio/gpio60/value
//now what to show in the gpio60?? so to give output we need to store that in value directory here we are giving a high value (ie 1).
No comments:
Post a Comment