iMX6solox PWM control

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

iMX6solox PWM control

729 Views
weigao
Contributor II

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.

pastedImage_12.png

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

Regards

Wei

Labels (1)
0 Kudos
1 Reply

457 Views
igorpadykov
NXP Employee
NXP Employee

Hi Wei

RGMII2_TD2,3 are used by fec2, had you disabled fec2 records:

pinctrl_enet2, fec2

linux-2.6-imx.git - Freescale i.MX Linux Tree

also it may be useful to check that fec2 was not used in uboot.

Best regards

igor

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

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

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

0 Kudos