This tutorial uses the rd235a kernel.
In fact pwm is not currently configured in the standard device tree provided with NTC's standard kernel (March 12 2016).
PWM0 can be activated in this way:
cd /sys/class/pwm/pwmchip0 sudo echo 0 >export
Now the new directory pwd0 provides all the meta-files to set up the waveform.
cd pwm0 sudo echo 1 >enable sudo echo normal > polarity sudo echo 20000000 > period sudo echo 1500000 > duty_cycle
Now if you connect an oscilloscope to the pin PWM0 (U13 pin 18) you'll see a square wave, period 20ms and a pulse width of 1.5ms.
This is exactly the signal needed to keep a servo motor in its central position (or stop a rotational 360 degree servo motor).
If you have a servo motor you can plug it (using a separate power supply, power spikes from a motor can force a reset of chip):
Servo black wire <-> power supply - <-> CHIP ground (e.g.U13 pin 1) Servo white wire <-> CHIP PWM0 (U13 pin 18) Servo red wire <-> power supply +
Now it is possible to change the pulse width, for esample:
sudo echo 1400000 > duty_cycle sudo echo 1600000 > duty_cycle sudo echo 1000000 > duty_cycle sudo echo 2000000 > duty_cycle sudo echo 1500000 > duty_cycle <pre> move the servo slighly counterclockwise, slightly clockwise, completely counterclockwise (-90 degrees), completely clockwise and back in its central position, respectively. (if the servo is a rotational one, rotates slowly backwards, slowly forward, fullspeed backwards, fullspeed forward,and stop again). For other applications it is possible to set different values to period, duty_cycle, polarity. At the end disable pwm0 in this way: <pre> sudo echo 0 > enable