Enable PWM on i.MX7

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

Enable PWM on i.MX7

1,379 Views
jacobi
Contributor I

Hi,

I am very new to i.MX7. Actually I am new to embedded programming in general.

What I would like to do is enable the PWM on the Mikrobus on the i.MX7 processor (MKBUS_PWM2). How do I do this?

I have logged into Linux and exported pwmchip0 and set the duty_cycle and period. However, the pwm I see is very small indeed - probably cross talk from PWM from another pin.

What do I have to do? I would appreciate some help.

Jacob.

Tags (2)
0 Kudos
Reply
2 Replies

920 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jacob

one can add pwm2 entries in dts (arch/arm/boot/dts/imx7d-sdb.dts), use pwm1 as example

linux-imx.git - i.MX Linux Kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

920 Views
jacobi
Contributor I

Hi Igor,

Thanks for your reply. That's exactly what I did and I got it working!

I made the changes below in my the dts:

&pwm2 {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_pwm2>;
   status = "okay";
};

&iomuxc_lpsr {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_hog_2 &pinctrl_usbotg2_pwr_2>;

    imx7d-sdb {
        pinctrl_hog_2: hoggrp-2 {
        fsl,pins = <
        MX7D_PAD_GPIO1_IO05__GPIO1_IO5 0x14
        >;
     };

     pinctrl_pwm1: pwm1grp {
          fsl,pins = <
          MX7D_PAD_GPIO1_IO01__PWM1_OUT 0x30
          >;
     };

     pinctrl_pwm2: pwm2grp {
          fsl,pins = <
          MX7D_PAD_GPIO1_IO02__PWM2_OUT 0x30
          >;
     };

..

..

0 Kudos
Reply