Skip to content

Instantly share code, notes, and snippets.

@pranav083
Created June 19, 2019 15:14
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/37b2ddc424edf99ebbcf7724ce8948d9 to your computer and use it in GitHub Desktop.
Save pranav083/37b2ddc424edf99ebbcf7724ce8948d9 to your computer and use it in GitHub Desktop.
GPIO IN MODE 6 IS not working for pin no. p8_11
.origin 0
.entrypoint start
#define GPIO0 0x44E07000
#define GPIO1 0x4804C000
#define GPIO2 0x481AC000
#define GPIO3 0x481AE000
#define GPIO_OE 0x134
#define GPIO_DATAIN 0x138
#define GPIO_CLEARDATAOUT 0x190
#define GPIO_SETDATAOUT 0x194
#define LED_PIN_BIT 13
#define CPRUCFG c4
#define INS_PER_MS 500 * 1000
#define ON_DURATION 250 * INS_PER_MS
#define OFF_DURATION 250 * 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, 15
MOV r0, ON_DURATION
DELAY_OFF:SUB r0, r0, 1
QBNE DELAY_OFF, r0, 0
// try EGPIO
CLR r30, r30, 15
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.13",
"P8.15",
"P8.16",
"P8.20",
"P8.21",
"pru0",
"P9.12",
"P9.24",
"pru1";
// pinmux
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
pinctrl_test: PRU-GPIO-EXAMPLE2-pins{
pinctrl-single,pins= <
0x034 0x36 /* p8_11 45 gpio1_13 in pu mode6 */
0x030 0x26 /* p8_12 44 gpio1_12 in pd mode6 */
0x024 0x07 /* p8_13 23 gpio0_23 op pd mode7 */
0x03c 0x07 /* p8_15 47 gpio1_15 op pd mode7 */
0x038 0x07 /* p8_16 46 gpio1_14 op pd mode7 */
0x084 0x37 /* p8_20 63 gpio1_31 in pd mode7 */
0x080 0x37 /* p8_21 62 gpio1_30 in pd mode7 */
0x078 0x0f /* p9_12 60 gpio1_13 op none mode7 */
0x184 0x27 /* p9_24 15 gpio1_28 in pd mode7 */
/* 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