STEP-3 : Setting the Pin mux and enabling the pullup or pull-down resistors on Port_8
- With the help of Device tree overlay we can set the pin mux and enable the pullup or pulldown resistors.
- Make a device tree overlay file with the following code:
/dts-v1/;
/plugin/;
/{
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "GPIO-Test";
version = "00A0";
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pinctrl_test: GPIO_Test {
pinctrl-single,pins = <
0x018 0x07 // P8_3 38 OUTPUT MODE7 pulldown
0x01c 0x07 // P8_4 39 OUTPUT MODE7 pulldown
0x008 0x07 // P8_5 34 OUTPUT MODE7 pulldown
0x00c 0x07 // P8_6 35 OUTPUT MODE7 pulldown
0x090 0x07 // P8_7 66 OUTPUT MODE7 pulldown
0x094 0x07 // P8_8 67 OUTPUT MODE7 pulldown
0x09c 0x07 // P8_9 69 OUTPUT MODE7 pulldown
0x098 0x07 // P8_10 68 OUTPUT MODE7 pulldown
0x034 0x17 // P8_11 45 OUTPUT MODE7 pullup
0x030 0x17 // P8_12 44 OUTPUT MODE7 pullup
0x024 0x17 // P8_13 23 OUTPUT MODE7 pullup
0x028 0x17 // P8_14 26 OUTPUT MODE7 pullup
0x03c 0x17 // P8_15 47 OUTPUT MODE7 pullup
0x038 0x17 // P8_16 46 OUTPUT MODE7 pullup
0x02c 0x17 // P8_17 27 OUTPUT MODE7 pullup
0x08c 0x17 // P8_18 65 OUTPUT MODE7 pullup
/* OUTPUT GPIO(mode7) 0x07 pulldown, 0x17 pullup, 0x?f no pullup/down */
/* INPUT GPIO(mode7) 0x27 pulldown, 0x37 pullup, 0x?f no pullup/down */
>;
};
};
};
fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_test>;
status = "okay";
};
};
};
};
- Save file with is name "GPIO-Test.dts",
- Compiling the overlay from .dts to .dtbo
- Now you need to copy it to /lib/firmware so it can be found.
- We need to define SLOTS to make it active
- Finally to make it active in SLOTS
root@beaglebone:# echo GPIO-Test > $SLOTS
- You can check with following command
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-- 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
7: ff:P-O-L Override Board Name,00A0,Override Manuf,GPIO-Test
- It is loaded on 7th slot.
- You can download HERE the file created by me
- You can modify and make your own device tree overlay with this file "GPIO-Test.dts" (Open file in text editor like)
Further info See Part3 - To be Continued
No comments:
Post a Comment