AnsweredAssumed Answered

iMX6solox PWM control

Question asked by Wei Gao on Jun 1, 2016
Latest reply on Jun 2, 2016 by igorpadykov

Hi All,

  

     I am suffering a PWM problem and still can not get my excepted 'PWM' waveform.

    

     To follow with device tree customization, I want to achieve PWM functionality to some pins. I have chosen RGMII2_TD3 (pwm5_out) and RGMII2_TD2(pwm6_out). According to 'imx6solox-pinfunc.h' they can be used as pwm5 and pwm6, which are 'MX6SX_PAD_RGMII2_TD3__PWM5_OUT' and 'MX6SX_PAD_RGMII2_TD2__PWM6_OUT' .

 

     1) for my 'imx6sx-sdb.dts' files, I added my code below:

    

    &pwm5 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_pwm5>;
      status = "okay";
     };

 

     &pwm6 {
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_pwm6>;
      status = "okay";
     };

 

     pinctrl_pwm5: pwm5grp {
       fsl,pins = <
         MX6SX_PAD_RGMII2_TD3__PWM5_OUT 0x110b0                 
       >;
   };

 

     pinctrl_pwm6: pwm6grp {
       fsl,pins = <
         MX6SX_PAD_RGMII2_TD2__PWM6_OUT 0x110b0                
       >;
    };

 

And then, I  configure pwm5 and pwm6 at command line as fellow:

 

$echo 0 > /sys/class/pwm/pwmchip4/export

it creates pwm0 folder and I try to set the period (1 ms)

$echo 1000000  > /sys/class/pwm/pwmchip4/pwm0/period

$echo 500000 > /sys/class/pwm/pwmchip4/pwm0/duty_cycle

$echo 1 > /sys/class/pwm/pwmchip4/pwm0/enable

 

$echo 0 > /sys/class/pwm/pwmchip5/export

it creates pwm0 folder and I try to set the period (1 ms)

$echo 1000000  > /sys/class/pwm/pwmchip5/pwm0/period

$echo 500000 > /sys/class/pwm/pwmchip5/pwm0/duty_cycle

$echo 1 > /sys/class/pwm/pwmchip5/pwm0/enable

 

After that, I command '$cat /sys/kernel/debug/pwm', the following display, Hovever, I still can not get my expected PWM waveform which I have registered.

 

 

   Could you tell me how to do that in further, many thanks.

 

Regards

 

Wei

Outcomes