Other Parts Discussed in Thread: AM4372
Tool/software: Linux
Hi All,
I am working on bringing up EPWM1, EPWM3, and EPWM5 on the AM4378 in linux kernel version 4.1.6. I started with the default driver code provided for my kernel, and added code to my DTS and am4372.dtsi file according to what was provided in the documentation, but have had no luck in getting a PWM signal. I am able to get the 3 different PWM modules to show up in my file system under /sys/class/pwm/pwmchip#, however, executing the following commands do not result in a PWM signal getting generated:
# echo 0 > /sys/class/pwm/pwmchip0/export
# echo 1000 > /sys/class/pwm/pwmchip0/pwm0/period
# echo 500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
These were the commands I sent when trying to get just EPWM1 working. Enabling EPWM1 in my dts file results in pwmchip0 showing up in the filesystem.
I've been applying the changes to bugs noted in the patches of this thread:
Currently my dts and dtsi submissions are as follows:
In my DTS file I have added the following submission:
&epwmss1 {
status = "okay";
};
I've also tried adding pinctrl-names = "default", "sleep";
pinctrl-0 = <&ehrpwm1_default>;
pinctrl-1 = <&ehrpwm1_sleep>; to this submission, where these are defined as follows:
ehrpwm1_default: ehrpwm0_default {
pinctrl-single,pins = <
0x158 MUX_MODE1 /* spi0_d1 (eHRPWM1A)*/
0x15C MUX_MODE1 /* spi0_cs0 (eHRPWM1B)*/
>;
};
ehrpwm1_sleep: ehrpwm0_sleep {
pinctrl-single,pins = <
0x158 MUX_MODE7 /* spi0_d1 (eHRPWM1A)*/
0x15C MUX_MODE7 /* spi0_cs0 (eHRPWM1B)*/
>;
};
but this only pulled the pwm pin low rather than high and did not fix the issue of no pwm signal getting generated.
My current submission is am4372.dtsi is as follows:
epwmss1: epwmss@48302000 {
compatible = "ti,am4372-pwmss","ti,am33xx-pwmss";
reg = <0x48302000 0x100>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
ti,hwmods = "epwmss1";
status = "disabled";
ehrpwm1: pwm@48302200 {
compatible = "ti,am33xx-ehrpwm";
#pwm-cells = <3>;
reg = <0x48302200 0x80>;
ti,hwmods = "ehrpwm1";
clocks = <&ehrpwm1_tbclk>;
clock-names = "tbclk";
};
};
Again, I've tried a large variety of settings here as well. My first question/concern here is that the default value for the reg of epwmss1 in the documentation is reg = <0x48300000 0x10>;
I've changed this value to reg = <0x48300000 0x100>; because the size of PWMSS0 in Table 2-3 of the L4_PER mem map in section 2.1.3 page 145 of the datasheet is 256 bytes. Regardless, neither 0x10 or 0x100 here resulted in my drivers working.
Similarly, the reg value for ehrpwm1 in the documentation and in the patch link provided is reg = <0x48302200 0x80>; The datasheet on page 145 says the size of EPWM is 96b so i've also tried the proper value of reg = <0x48302200 0x60>; here with no luck. I've also tried not including the clocks, which is what the documentation suggests, with no luck. I'm fairly confident clocks are being properly configured in my clock file.
A final question, I notice that in the patch link I posted as well as in the documentation some users post compatible parameters of ti,am4372-pwmss and ti,am4372-ehrpwm for the epwmss and ehrpwm's respectively, yet I've not found drivers anywhere on the internet that have these compatibility parameters. Do drivers that support AM4372 pwms actually exist, or do I need to write my own custom ones?
Any help getting these pwm modules working would be much appreciated.
Kind regards,
Taylor Fahey