Skip to content

Instantly share code, notes, and snippets.

@pranav083
Last active June 20, 2019 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pranav083/fe3916cd4a97e8b9a823d82c82458d82 to your computer and use it in GitHub Desktop.
Save pranav083/fe3916cd4a97e8b9a823d82c82458d82 to your computer and use it in GitHub Desktop.
pru pinmux not working
debian@beaglebone:~$ sudo vim /lib/firmware/PRU-GPIO-EXAMPLE2.dts
debian@beaglebone:~$ sudo dtc -O dtb -o /lib/firmware/PRU-GPIO-EXAMPLE2.dtbo -b 0 -@ /lib/firmware/PRU-GPIO-EXAMPLE2.dts
debian@beaglebone:~$ sudo reboot
debian@beaglebone:~/pru_work/pru$ vim p8_12.p
debian@beaglebone:~$ cd pru_work/pru
------ after changing the pru.cpp file by putting .bin destination of program p8_12.bin-------
debian@beaglebone:~/pru_work/pru$ sudo pasm -b p8_12.p debian@beaglebone:~/pru_work/pru$ sudo arm-linux-gnueabihf-g++ pru.cpp prussdrv.c -o p8_12_out -w
debian@beaglebone:~/pru_work/pru$ sudo ./p8_12_out
---------------------------------
but it is not reflecting any change pin p8_12 in mode 6 as refernce from http://pinmux.tking.org/index.html and from dev.ti.com
.origin 0
.entrypoint start
#define INS_PER_MS 200 * 1000
#define ON_DURATION 550 * INS_PER_MS
#define OFF_DURATION 550 * INS_PER_MS
start:
lbco r0, CPRUCFG, 4, 4 // read SYSCFG
clr r0.t4 // clear SYSCFG[STANDBY_INIT]
sbco r0, CPRUCFG, 4, 4 // enable OCP master port;
MOV r0, ON_DURATION
DELAY_ON:SUB r0, r0, 1
QBNE DELAY_ON, r0, 0
// try EGPIO
SET r30, r30, 14 //p8_12 pin
MOV r0, OFF_DURATION
DELAY_OFF:SUB r0, r0, 1
QBNE DELAY_OFF, r0, 0
// try EGPIO
CLR r30, r30, 14 //p8_12 pin
MOV r0, ON_DURATION
QBA DELAY_ON
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
// identification
part-number = "PRU-GPIO-EXAMPLE2";
version = "00A0";
// resources
exclusive-use =
"P8.11",
"P8.12",
"P8.20",
"P8.21",
"pru0";
// pinmux
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pinctrl_test: PRU-GPIO-EXAMPLE2-pins{
pinctrl-single,pins= <
AM33XX_IOPAD(0x900, PIN_OUTPUT | MUX_MODE5) /* (G19) mmc0_clk.pr1_pru0_pru_r30[12] */
AM33XX_IOPAD(0x904, PIN_OUTPUT | MUX_MODE5) /* (G17) mmc0_cmd.pr1_pru0_pru_r30[13] */
AM33XX_IOPAD(0x830, PIN_OUTPUT | MUX_MODE6) /* (U13) gpmc_ad12.pr1_pru0_pru_r30[14] */
AM33XX_IOPAD(0x834, PIN_OUTPUT | MUX_MODE6) /* (T13) gpmc_ad13.pr1_pru0_pru_r30[15] */
>;
};
};
};
// PRU
fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
status = "okay";
pinctrl-names = "default", "gpio";
pinctrl-0 = <&pinctrl_test>;
};
};
};
fragment@2 {
target = <&pruss>;
__overlay__ {
status = "okay";
};
};
};
-----------------------------------------------------------
-------------------------ERROR------------------------
debian@beaglebone:~$ sudo dtc -O dtb -o /lib/firmware/PRU-GPIO-EXAMPLE2.dtbo -b 0 -@ /lib/firmware/PRU-GPIO-EXAMPLE2.dts
Error: /lib/firmware/PRU-GPIO-EXAMPLE2.dts:26.8-9 syntax error
FATAL ERROR: Unable to parse input tree
debian@beaglebone:~$
// this file is without pinmux generated file from dev.ti.com
// pin refernce from http://pinmux.tking.org/p9.html
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green";
// identification
part-number = "PRU-GPIO-EXAMPLE2";
version = "00A0";
// resources
exclusive-use =
"P8.11",
"P8.12",
"P8.20",
"P8.21",
"pru0";
// pinmux
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pinctrl_test: PRU-GPIO-EXAMPLE2-pins{
pinctrl-single,pins= <
/* 0x034 0x06 /* p8_11 45 gpio1_13 in no pull mode6 */
/* 0x030 0x06 /* p8_12 44 gpio1_12 in no pull mode6 */
/* 0x084 0x05 /* p8_20 63 gpio1_31 in no pull mode5 */
/* 0x080 0x05 /* p8_21 62 gpio1_30 in no pull mode5 */
/* OUTPUT GPIO(mode7) 0x07 pulldown, 0x17 pullup, 0x?f no pullup/down */
/* INPUT GPIO(mode7) 0x27 pulldown, 0x37 pullup, 0x?f no pullup/down */
>;
};
};
};
// PRU
fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
status = "okay";
pinctrl-names = "default", "gpio";
pinctrl-0 = <&pinctrl_test>;
};
};
};
fragment@2 {
target = <&pruss>;
__overlay__ {
status = "okay";
};
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment