PWM Buzzer doesn't work with Kernel 4.14

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PWM Buzzer doesn't work with Kernel 4.14

2,052 Views
erichschmidt
Contributor I

Hello to all,

i configured pwm1 with linux kernel 3.14.38 and my pwm buzzer works. I try to upgrade the kernel to 4.14.101 and take the same device tree configuration. I've connected the pin to an oscilloscope. When I turn on the buzzer, however, no frequency is generated. As a gpio the pin generates a signal. Is it possible that the driver for the pwm has a bug?

defconfig

CONFIG_PWM=y
CONFIG_PWM_IMX=y
CONFIG_PWM_SYSFS=y


Freescale part of the device tree (imx6ul.dtsi)

pwm1: pwm@02080000 {
compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
reg = <0x02080000 0x4000>;
interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_PWM1>,
<&clks IMX6UL_CLK_PWM1>;
clock-names = "ipg", "per";
#pwm-cells = <2>;
status = "disabled";
};


My device tree extension

&iomuxc {
pinctrl_pwm1: pwm1grp {
fsl,pin = <
MX6UL_PAD_GPIO1_IO08__PWM1_OUT 0x110b0
>;
};
}

&pwm1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm1>;
status = "okay";
};


cat /sys/kernel/debug/pwm gives:

platform/2080000.pwm, 1 PWM device
pwm-0 ((null) ): period: 0 ns duty: 0 ns polarity: normal

I export and configure the with:


echo 0 > /sys/class/pwm/pwmchip0/export
echo 190000 > /sys/class/pwm/pwmchip0/pwm0/
echo 190000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

After that cat /sys/kernel/debug/pwm gives

platform/2080000.pwm, 1 PWM device
pwm-0 (sysfs ): requested enabled period: 250000 ns duty: 190000 ns polarity: normal

0 Kudos
3 Replies

1,571 Views
erichschmidt
Contributor I

Hi,

I found the mistake now. There was a syntax error in the devicetree which Yocto did not recognize and therefore compiled the devicetree anyway. Thank you for your help.

Best regards 

Erich

0 Kudos

1,571 Views
erichschmidt
Contributor I

I forgot the category and can't update it. I am using a imx6ul cpu.

0 Kudos

1,571 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Erich,

 

Linux BSP 4.14 for i.MX processors include a basic PWM library (mainly oriented for LCD backlight control).

Please refer to chapter 2.7 “Pulse-Width Modulator (PWM)” section of “i.MX Reference Manual” document (attached) for additional details.

Hope this will be useful for you.
Best regards!
/Carlos
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

0 Kudos