How to enable Pwm via I2C3_SDA pinout, for imx8 mini ddr4?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable Pwm via I2C3_SDA pinout, for imx8 mini ddr4?

319 Views
sakizci
Contributor I

Hello everyone,

What I want to do is use the I2C3_SDA pinout on my board as pwm with sysfs. But I could not get it to work.

 

my steps;

step 1: Kernel configuration.

sakizci_0-1615911966698.png

step 2: Configuration of the device tree.


imx8mm-evk.dts :

&pwm3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pwm3>;
status = "okay";
};

..

..

&iomuxc {
pinctrl_pwm3: pwm3grp {
fsl,pins = <
MX8MM_IOMUXC_I2C3_SDA_PWM3_OUT 0x00000116
>;
};

..

..

When I do this, the pwmchips in the sysfs section do not appear.

cat /sys/class/pwm result is empty.

but if I enable pwm in imx8mm.dtsi file, pwmchips appears.

pwm1: pwm@30660000 {
compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
reg = <0x30660000 0x10000>;
interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_PWM1_ROOT>,
<&clk IMX8MM_CLK_PWM1_ROOT>;
clock-names = "ipg", "per";
#pwm-cells = <2>;
status = "okay";
};

pwm2: pwm@30670000 {
compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
reg = <0x30670000 0x10000>;
interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_PWM2_ROOT>,
<&clk IMX8MM_CLK_PWM2_ROOT>;
clock-names = "ipg", "per";
#pwm-cells = <2>;
status = "okay";
};

pwm3: pwm@30680000 {
compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
reg = <0x30680000 0x10000>;
interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_PWM3_ROOT>,
<&clk IMX8MM_CLK_PWM3_ROOT>;
clock-names = "ipg", "per";
#pwm-cells = <2>;
status = "okay";
};

pwm4: pwm@30690000 {
compatible = "fsl,imx8mm-pwm", "fsl,imx27-pwm";
reg = <0x30690000 0x10000>;
interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_PWM4_ROOT>,
<&clk IMX8MM_CLK_PWM4_ROOT>;
clock-names = "ipg", "per";
#pwm-cells = <2>;
status = "okay";
};

 

root@imx8ddr4evk: ls /sys/class/pwm/

pwmchip0 pwmchip1 pwmchip2 pwmchip3 

 

and I'm running sysfs commands.

echo 0 > /sys/class/pwm/pwmchip0/export

echo 10000 > /sys/class/pwm/pwmchip0/pwm0/period

echo 10000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle

echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

I tried it for all pwmchips. but it didn't work on any of them.

What steps should I follow to run pwm in imx8 mini ddr4 evk? I don't know where I went wrong.

thanks.

 

 

Labels (1)
Tags (2)
0 Kudos
1 Reply

211 Views
nxf46838
NXP TechSupport
NXP TechSupport

Hello,

I see no errors in the changes you have made to your device tree and the kernel configuration looks fine as well.

May I ask how you're doing the changes to the device tree?

I see that you're modifying imx8mm-evk.dts, but you should be using imx8mm-ddr4-evk.dts, it should be ok if you have done the changes before compiling since this file includes the imx8mm-evk.dts file.

Best regards,
Aldo.

0 Kudos