Cubieboard-1 - powered by the Allwinner A10 Arm SOC
When I received my first Allwinner A10 board it lacked support for hardware PWM. Without a driver for hardware PWM it’s very hard to use this very powerful SOC for controlling motors
This article describes the design of one such hardware pwm driver interface.
The Arduino has a simple to use PWM interface and other implementations should strive to have a similarly developer friendly interface. The “analogWrite” Arduino interface is both easy to understand and implement. For instance the following code implements a 50% duty cycle on digital pin 5:
One problem with the Arduino interface is the learning curve required to venture beyond the primary interface. For instance, the above code doesn’t specify the PWM period. Many motors (servos..) function best within a specific PWM period.
This implementation doesn’t allow specification of the signal polarity either. If the hardware interface requires an inverted signal, then duty will have to be computed as 1/duty manually.
*example code from Timer One Library for Arduino
The Linux OS and expanded ram of the cubieboard make possible a much more rich interface than the arduino affords. File based programming interfaces are available to extend the PWM control to many more languages. One possible implementation might include the following interface (examples in shell script):