PWM and Encoders (EQEP) on 3.16 and later (using dtb-rebuilder) - eqep working, pwm not

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

eqep_and_pwm_dtsi_for_3_16_later.patch (13.8 KB)

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.

Just a BIG warning, dtb-rebuilder is gaining a dependency* on a
patchset in the v3.14.x repo:

https://github.com/RobertCNelson/ti-linux-kernel-dev/tree/ti-linux-3.14.y/patches/beaglebone/pinmux-helper

as of last week, both the hdmi/usart pins need pinmux-helper enabled,
otherwise (hdmi & usart) will not enable correctly.

Pretty soon, the "3.14-ti" branch name of the repo will make more
sense... I'm forward porting the pinmux-helpher patches to my
v3.16/v3.17 bone trees but there will be lag, as i'm human..

ps, the docs are here:

http://elinux.org/Beagleboard:Capes_3.8_to_3.14#Custom_dtb

but i'd rather get all the capes working first, before writing up
something that may change..

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".

Sorry, i haven't tried that eqep driver outside of 3.8, so i can't
verifry if it works 3.8+

Regards,