Hi!

I just started building a mobile sensor plattform/robot based on the 
beaglebone. Besides sensors which use I2C and UARTs, I intend using DC 
motors with attached encoders for moving.

Being used to the overlays of 3.8.x (and having a supported cape, thanks 
RCN), and did some recompiling/patching for 3.14, I thought this would be a 
good oppotunity for trying the "new" dtb-rebuilder concept, which I think 
by the way is a clean but yet not so well documented approach.

Attached are the device tree files/includes dts/dtsi which I made for use 
with the 3.16+ kernels. Starting with the ADC (4-6) was successful. Then I 
moved on to eqep. The excellent work at 
https://github.com/Teknoman117/beaglebot got me going. I compiled the 
driver and converted the overlay-dts to includes (see attached patch to 
dtb-rebuilder-repo). After loading "insmod tieqep.ko" is could get the 
reading "less /sys/devices/ocp/48304000.epwmss/48304180.eqep/position".

For PWM I also added two includes based on what I found at 
https://github.com/SaadAhmad/beaglebone-black-cpp-PWM

&am33xx_pinmux {
    pinctrl_ehrpwm2A: pinctrl_ehrpwm2A_pins {
    pinctrl-single,pins = <0x020  0x4>; /* P8_19 (ZCZ ball U10) | MODE 4 */ 
  
    };
};

&ocp {
    P8_19_pinmux {
        status = "disabled";
    };

    pwm_test_P8_19 {
        compatible    = "pwm_test";
        pwms        = <&ehrpwm2 0 0 1>;
        pwm-names    = "PWM_P8_19";

        pinctrl-names    = "default";
        pinctrl-0    = <&pinctrl_ehrpwm2A>;

        enabled        = <0>;
        duty        = <0>;
        status        = "okay";
    };
};

&epwmss2 {
  status = "okay";
};

&ehrpwm2 {
  status = "okay";
};

I compiled "pwm_test.ko" and insmod it but it complains

[ 9872.259095] pwm_test ocp:pwm_test_P8_19: unable to request PWM
> [ 9872.265429] pwm_test ocp:pwm_test_P8_13: unable to request PWM
>

When I "modprobe pwm-tiehrpwm" nothing happens. Consequently, the 
"pwm_test_P8_19" dir does not show any "period" or "duty" entries.

What am I supposed to do?

Thanks

BR
Robert

-- 
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 beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/arm/am335x-bone-cape-bone-robot.dts b/src/arm/am335x-bone-cape-bone-robot.dts
index e69de29..637ffa6 100644
--- a/src/arm/am335x-bone-cape-bone-robot.dts
+++ b/src/arm/am335x-bone-cape-bone-robot.dts
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "am33xx.dtsi"
+#include "am335x-bone-common.dtsi"
+#include "am335x-bone-common-pinmux.dtsi"
+
+/ {
+	model = "TI AM335x BeagleBone";
+	compatible = "ti,am335x-bone", "ti,am33xx";
+};
+
+&ldo3_reg {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <3300000>;
+	regulator-always-on;
+};
+
+&ocp {
+	/* clkout2 */
+	P9_41_pinmux {
+		status = "disabled";
+	};
+	/* mmc1 */
+	P9_92_pinmux {
+		status = "disabled";
+	};
+};
+
+&mmc1 {
+	vmmc-supply = <&ldo3_reg>;
+};
+
+&am33xx_pinmux {
+	pinctrl-names = "default";
+	/* pinctrl-0 = <&clkout2_pin>; */
+};
+
+&sham {
+	status = "okay";
+};
+
+&aes {
+	status = "okay";
+};
+
+#include "am335x-bone-robot.dtsi"
diff --git a/src/arm/am335x-bone-ehrpwm2A.dtsi b/src/arm/am335x-bone-ehrpwm2A.dtsi
index e69de29..507ecb2 100644
--- a/src/arm/am335x-bone-ehrpwm2A.dtsi
+++ b/src/arm/am335x-bone-ehrpwm2A.dtsi
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 CircuitCo
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+&am33xx_pinmux {
+	pinctrl_ehrpwm2A: pinctrl_ehrpwm2A_pins {
+    pinctrl-single,pins = <0x020  0x4>; /* P8_19 (ZCZ ball U10) | MODE 4 */   
+	};
+};
+
+&ocp {
+	P8_19_pinmux {
+		status = "disabled";
+	};
+
+	pwm_test_P8_19 {
+		compatible	= "pwm_test";
+		pwms 		= <&ehrpwm2 0 0 1>;
+		pwm-names 	= "PWM_P8_19";
+
+		pinctrl-names	= "default";
+		pinctrl-0	= <&pinctrl_ehrpwm2A>;
+
+		enabled		= <0>;
+		duty		= <0>;
+		status 		= "okay";
+	};
+};
+
+&epwmss2 {
+  status = "okay";
+};
+
+&ehrpwm2 {
+  status = "okay";
+};
diff --git a/src/arm/am335x-bone-ehrpwm2B.dtsi b/src/arm/am335x-bone-ehrpwm2B.dtsi
index e69de29..07d686a 100644
--- a/src/arm/am335x-bone-ehrpwm2B.dtsi
+++ b/src/arm/am335x-bone-ehrpwm2B.dtsi
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2013 CircuitCo
+ * Copyright (C) 2013 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+&am33xx_pinmux {
+	pinctrl_ehrpwm2B: pinctrl_ehrpwm2B_pins {
+    pinctrl-single,pins = <0x024  0x4>; /* P8_13 (ZCZ ball T10) | MODE 4 */
+	};
+};
+
+&ocp {
+	P8_13_pinmux {
+		status = "disabled";
+	};
+
+	pwm_test_P8_13 {
+		compatible	= "pwm_test";
+		pwms 		= <&ehrpwm2 1 0 1>;
+		pwm-names 	= "PWM_P8_13";
+
+		pinctrl-names	= "default";
+		pinctrl-0	= <&pinctrl_ehrpwm2B>;
+
+		enabled		= <0>;
+		duty		= <0>;
+		status 		= "okay";
+	};
+};
+
+&epwmss2 {
+  status = "okay";
+};
+
+&ehrpwm2 {
+  status = "okay";
+};
diff --git a/src/arm/am335x-bone-eqep0.dtsi b/src/arm/am335x-bone-eqep0.dtsi
index e69de29..2c677b3 100644
--- a/src/arm/am335x-bone-eqep0.dtsi
+++ b/src/arm/am335x-bone-eqep0.dtsi
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2013 Nathaniel R. Lewis - http://nathanielrlewis.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ * 
+ * Enable eQEP0 on the Beaglebone Black - incompatible with BB White because
+ * most of the eQEP0 pins on Beaglebone white are not broken out.
+ */
+
+/ {
+	model = "TI AM335x BeagleBone Black";
+	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
+};
+
+&ocp {
+	P9_41_pinmux {
+		status = "disabled";
+	};
+	P9_25_pinmux {
+		status = "disabled";
+	};
+	P9_42_pinmux {
+		status = "disabled";
+	};
+	P9_27_pinmux {
+		status = "disabled";
+	};
+};
+
+&am33xx_pinmux {
+	pinctrl_eqep0: pinctrl_eqep0_pins {
+		pinctrl-single,pins = <
+      0x1A8 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* P9_41 = GPIO3_20 = EQEP0_index, MODE1 */        
+      0x1AC (PIN_INPUT_PULLDOWN | MUX_MODE1) /* P9_25 = GPIO3_21 = EQEP0_strobe, MODE1 */   
+      0x1A0 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* P9_42 = GPIO3_18 = EQEP0A_in, MODE1 */       
+      0x1A4 (PIN_INPUT_PULLDOWN | MUX_MODE1) /* P9_27 = GPIO3_19 = EQEP0B_in, MODE1 */     
+		>;
+	};
+};
+
+&epwmss0 {
+  status = "okay";
+
+  eqep0: eqep@0x48300180 {
+    compatible = "ti,am33xx-eqep";
+    reg = <0x48300180 0x80>;
+    interrupt-parent = <&intc>;
+    interrupts = <79>;
+    ti,hwmods = "eqep0";
+    status = "okay";
+
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_eqep0>;
+    
+    count_mode = <0>;  /* 0 - Quadrature mode, normal 90 phase offset cha & chb.  1 - Direction mode.  cha input = clock, chb input = direction */
+    swap_inputs = <0>; /* Are channel A and channel B swapped? (0 - no, 1 - yes) */
+    invert_qa = <1>;   /* Should we invert the channel A input?  */
+    invert_qb = <1>;   /* Should we invert the channel B input? I invert these because my encoder outputs drive transistors that pull down the pins */
+    invert_qi = <0>;   /* Should we invert the index input? */
+    invert_qs = <0>;   /* Should we invert the strobe input? */
+  };
+};
diff --git a/src/arm/am335x-bone-eqep1.dtsi b/src/arm/am335x-bone-eqep1.dtsi
index e69de29..7258762 100644
--- a/src/arm/am335x-bone-eqep1.dtsi
+++ b/src/arm/am335x-bone-eqep1.dtsi
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 Nathaniel R. Lewis - http://nathanielrlewis.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ * 
+ * Enable eQEP1 on the Beaglebone White and Black
+ */
+
+&ocp {
+	P8_31_pinmux {
+		status = "disabled";
+	};
+	P8_32_pinmux {
+		status = "disabled";
+	};
+	P8_33_pinmux {
+		status = "disabled";
+	};
+	P8_35_pinmux {
+		status = "disabled";
+	};
+};
+
+&am33xx_pinmux {
+	pinctrl_eqep1: pinctrl_eqep1_pins {
+		pinctrl-single,pins = <
+      0x0D8 (PIN_INPUT_PULLDOWN | MUX_MODE2)  /* P8_31 = GPIO0_10 = EQEP1_index, MODE2 */
+      0x0DC (PIN_INPUT_PULLDOWN | MUX_MODE2)  /* P8_32 = GPIO0_11 = EQEP1_strobe, MODE2 */
+      0x0D4 (PIN_INPUT_PULLDOWN | MUX_MODE2)  /* P8_33 = GPIO0_9 = EQEP1B_in, MODE2 */
+      0x0D0 (PIN_INPUT_PULLDOWN | MUX_MODE2)  /* P8_35 = GPIO0_8 = EQEP1A_in, MODE2 */
+		>;
+	};
+};
+
+&epwmss1 {
+  status = "okay";
+
+  eqep1: eqep@0x48302180 {
+    compatible = "ti,am33xx-eqep";
+    reg = <0x48302180 0x80>;
+    interrupt-parent = <&intc>;
+    interrupts = <88>;
+    ti,hwmods = "eqep1";
+    status = "okay";
+
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_eqep1>;
+    
+    count_mode = <0>;  /* 0 - Quadrature mode, normal 90 phase offset cha & chb.  1 - Direction mode.  cha input = clock, chb input = direction */
+    swap_inputs = <0>; /* Are channel A and channel B swapped? (0 - no, 1 - yes) */
+    invert_qa = <1>;   /* Should we invert the channel A input?  */
+    invert_qb = <1>;   /* Should we invert the channel B input? I invert these because my encoder outputs drive transistors that pull down the pins */
+    invert_qi = <0>;   /* Should we invert the index input? */
+    invert_qs = <0>;   /* Should we invert the strobe input? */
+  };
+};
diff --git a/src/arm/am335x-bone-eqep2.dtsi b/src/arm/am335x-bone-eqep2.dtsi
index e69de29..3ebca8f 100644
--- a/src/arm/am335x-bone-eqep2.dtsi
+++ b/src/arm/am335x-bone-eqep2.dtsi
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2013 Nathaniel R. Lewis - http://nathanielrlewis.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ * 
+ * Enable eQEP2 on the Beaglebone White and Black
+ */
+
+&ocp {
+	P8_39_pinmux {
+		status = "disabled";
+	};
+	P8_40_pinmux {
+		status = "disabled";
+	};
+	P8_41_pinmux {
+		status = "disabled";
+	};
+	P8_42_pinmux {
+		status = "disabled";
+	};
+};
+
+&am33xx_pinmux {
+	pinctrl_eqep2: pinctrl_eqep2_pins {
+		pinctrl-single,pins = <
+      0x0B8 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* P8_39 = GPIO2_12 = EQEP2_index, MODE3 */
+      0x0BC (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* P8_40 = GPIO2_13 = EQEP2_strobe, MODE3 */
+      0x0B0 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* P8_41 = GPIO2_10 = EQEP2A_in, MODE3 */
+      0x0B4 (PIN_INPUT_PULLDOWN | MUX_MODE3)  /* P8_42 = GPIO2_11 = EQEP2B_in, MODE3 */
+		>;
+	};
+};
+
+&epwmss2 {
+  status = "okay";
+
+  eqep2: eqep@0x48304180 {
+    compatible = "ti,am33xx-eqep";
+    reg = <0x48304180 0x80>;
+    interrupt-parent = <&intc>;
+    interrupts = <89>;
+    ti,hwmods = "eqep2";
+    status = "okay";
+
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_eqep2>;
+    
+    count_mode = <0>;  /* 0 - Quadrature mode, normal 90 phase offset cha & chb.  1 - Direction mode.  cha input = clock, chb input = direction */
+    swap_inputs = <0>; /* Are channel A and channel B swapped? (0 - no, 1 - yes) */
+    invert_qa = <1>;   /* Should we invert the channel A input?  */
+    invert_qb = <1>;   /* Should we invert the channel B input? I invert these because my encoder outputs drive transistors that pull down the pins */
+    invert_qi = <0>;   /* Should we invert the index input? */
+    invert_qs = <0>;   /* Should we invert the strobe input? */
+  };
+};
diff --git a/src/arm/am335x-bone-eqep2b.dtsi b/src/arm/am335x-bone-eqep2b.dtsi
index e69de29..adef9eb 100644
--- a/src/arm/am335x-bone-eqep2b.dtsi
+++ b/src/arm/am335x-bone-eqep2b.dtsi
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2013 Nathaniel R. Lewis - http://nathanielrlewis.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ * 
+ * Enable eQEP2 on the Beaglebone White and Black
+ * These pins don't conflict with the HDMI
+ */
+
+&ocp {
+	P8_16_pinmux {
+		status = "disabled";
+	};
+	P8_15_pinmux {
+		status = "disabled";
+	};
+	P8_12_pinmux {
+		status = "disabled";
+	};
+	P8_11_pinmux {
+		status = "disabled";
+	};
+};
+
+&am33xx_pinmux {
+	pinctrl_eqep2: pinctrl_eqep2_pins {
+		pinctrl-single,pins = <
+      0x038 (PIN_INPUT_PULLDOWN | MUX_MODE4)  /* P8_16 = GPIO1_14 = EQEP2_index, MODE4 */
+      0x03C (PIN_INPUT_PULLDOWN | MUX_MODE4)  /* P8_15 = GPIO1_15 = EQEP2_strobe, MODE4 */
+      0x030 (PIN_INPUT_PULLDOWN | MUX_MODE4)  /* P8_12 = GPIO1_12 = EQEP2A_in, MODE4 */
+      0x034 (PIN_INPUT_PULLDOWN | MUX_MODE4)  /* P8_11 = GPIO1_13 = EQEP2B_in, MODE4 */
+		>;
+	};
+};
+
+&epwmss2 {
+  status = "okay";
+
+  eqep2: eqep@0x48304180 {
+    compatible = "ti,am33xx-eqep";
+    reg = <0x48304180 0x80>;
+    interrupt-parent = <&intc>;
+    interrupts = <89>;
+    ti,hwmods = "eqep2";
+    status = "okay";
+
+    pinctrl-names = "default";
+    pinctrl-0 = <&pinctrl_eqep2>;
+    
+    count_mode = <0>;  /* 0 - Quadrature mode, normal 90 phase offset cha & chb.  1 - Direction mode.  cha input = clock, chb input = direction */
+    swap_inputs = <0>; /* Are channel A and channel B swapped? (0 - no, 1 - yes) */
+    invert_qa = <1>;   /* Should we invert the channel A input?  */
+    invert_qb = <1>;   /* Should we invert the channel B input? I invert these because my encoder outputs drive transistors that pull down the pins */
+    invert_qi = <0>;   /* Should we invert the index input? */
+    invert_qs = <0>;   /* Should we invert the strobe input? */
+  };
+};
diff --git a/src/arm/am335x-bone-robot.dtsi b/src/arm/am335x-bone-robot.dtsi
index e69de29..88aa460 100644
--- a/src/arm/am335x-bone-robot.dtsi
+++ b/src/arm/am335x-bone-robot.dtsi
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+&tscadc {
+	status = "okay";
+	adc {
+		ti,adc-channels = <4 5 6>;
+	};
+};
+
+#include "am335x-bone-eqep1.dtsi"
+#include "am335x-bone-eqep2.dtsi"
+
+#include "am335x-bone-ehrpwm2A.dtsi"
+#include "am335x-bone-ehrpwm2B.dtsi"
diff --git a/src/arm/am335x-boneblack-cape-bone-robot.dts b/src/arm/am335x-boneblack-cape-bone-robot.dts
index e69de29..2ee446c 100644
--- a/src/arm/am335x-boneblack-cape-bone-robot.dts
+++ b/src/arm/am335x-boneblack-cape-bone-robot.dts
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include "am33xx.dtsi"
+#include "am335x-bone-common.dtsi"
+#include "am335x-bone-common-pinmux.dtsi"
+
+/ {
+	model = "TI AM335x BeagleBone Black";
+	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
+};
+
+&dcdc1_reg {
+	/* VDD_DDR3 voltage 1.35V */
+	regulator-name = "vdd_ddr3";
+	regulator-min-microvolt = <1350000>;
+	regulator-max-microvolt = <1350000>;
+	regulator-boot-on;
+	regulator-always-on;
+};
+
+&ldo3_reg {
+	regulator-min-microvolt = <1800000>;
+	regulator-max-microvolt = <1800000>;
+	regulator-always-on;
+};
+
+&ocp {
+	/* clkout2 */
+	P9_41_pinmux {
+		status = "disabled";
+	};
+	/* mmc1 */
+	P9_92_pinmux {
+		status = "disabled";
+	};
+};
+
+&mmc1 {
+	vmmc-supply = <&vmmcsd_fixed>;
+};
+
+&am33xx_pinmux {
+	pinctrl-names = "default";
+	/* pinctrl-0 = <&clkout2_pin>; */
+};
+
+#include "am335x-boneblack-emmc.dtsi"
+/* bu: removed to free encoder inputs */
+//#include "am335x-boneblack-nxp-hdmi-audio.dtsi"
+
+#include "am335x-bone-robot.dtsi"

Reply via email to