6 Replies Latest reply on Oct 14, 2014 6:09 AM by jlhonora

    Can't set PWM to 20ms period

    jlhonora

      I'm working with an Intel Galileo Gen 1 board and I just can't make the PWM oscillate with a 20ms period:

       

      root@clanton:~# echo -n "3" > /sys/class/pwm/pwmchip0/export
      root@clanton:~# echo -n "1" > /sys/class/pwm/pwmchip0/pwm3/enable
      root@clanton:~# echo -n "0" > /sys/class/pwm/pwmchip0/pwm3/duty_cycle
      root@clanton:~# echo -n "20000000" > /sys/class/pwm/pwmchip0/pwm3/period
      -sh: echo: write error: Invalid argument
      root@clanton:~#
      
      
      
      
      

       

      The breaking point seems to be 8ms:

       

      root@clanton:~# echo -n "8000000" > /sys/class/pwm/pwmchip0/pwm3/period
      -sh: echo: write error: Invalid argument
      root@clanton:~# echo -n "7999999" > /sys/class/pwm/pwmchip0/pwm3/period
      root@clanton:~#
      
      
      

       

      Everything works fine when I try lower periods. I also implemented this using C and the sysfs interface, but the results are the same: perfect for 2ms, dead for 20ms. What are my options for controlling a servo? I want to do it "bare-boned", i.e. without any other library, just plain C/C++.