I don't know how to do it via the command line, but with RPIO.PWM Python, you can assign a PWM channel to a GPIO pin. The PWM code defines a frequency you send the PWM messages at - most ESCs will accept somewhere between 100Hz and 450Hz.
That means every 0.01 to 0.002222.... seconds, you send a high pulse lasting between 1ms and 2 ms. Less than 1ms and the ESC will complain loudly and annoyingly. 1ms will shut it up, and between 1 and 2 milliseconds, the motor speed will increase to maximum supported by the ESC.
Code: Select all
RPIO.PWM.setup(1) # pulse sizes measures in 1us units
RPIO.PWM.init_channel(RPIO_DMA_CHANNEL, 3000) # 3ms (333Hz subcycle) - pulses repeated at this frequency
RPIO.PWM.add_channel_pulse(RPIO_DMA_CHANNEL, GPIO_PIN, 0, 1000) # set 1ms (=1000us) pulse
RPIO_DMA_CHANNEL is simple a choice of 1 of the 14 channels that can be used. GPIO_PIN is one of the BCM GPIO pin numbers.
For more info, checkout the RPIO PWM docs: http://pythonhosted.org/RPIO/pwm_py.html
I think the standard RPi.GPIO also supports PWM in an almost identical manner - my choice of RPIO is for other reasons.
You might also find some more info on my blog, but there's no PWM code there yet, until I have my drone flying, which, fingers crossed, will be any day now.