Pages

Wednesday, March 13, 2013

RPIO.PWM learning notes


I found GuzuntyPi's GPCLK0 function not that powerful.  So I googled RPIO.PWM, hoping that I can use it to set RPi's GPCLK0, GPPWM, or other pins.

RPIO.PWM: Precise PWM via DMA for servos and more (1µs res) - by metachris » Sat Mar 09, 2013 7:47 pm

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=36572&p=308056

I'm happy to announce that RPIO now includes PWM via DMA for very precise semi-hardware PWM. RPIO.PWM supports pulses with a maximum resolution of 1µs, all 15 available DMA channels and any number of GPIO's. Since it uses the same on-board PWM module as the sound card it may interfere with sound.

RPIO.PWM is written in C (source) and includes a Python wrapper compatible with Python 2 and 3. You can find the PWM documentation at pythonhosted.org/RPIO.The easiest way to install/update RPIO is with easy_install:

$ sudo apt-get install python-setuptools
$ sudo easy_install -U RPIO

...

*** RPIO update record tlfong01 2013mar13 ***

pi@raspberrypi ~ $ sudo apt-get install python-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-setuptools is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 242 not upgraded.

pi@raspberrypi ~ $ sudo easy_install -U RPIO
Searching for RPIO
Reading http://pypi.python.org/simple/RPIO/
Reading https://github.com/metachris/RPIO
Reading https://github.com/metachris/raspberrypi-utils
Best match: RPIO 0.9.2
Downloading http://pypi.python.org/packages/2.7/R/RPIO/RPIO-0.9.2-py2.7-linux-armv6l.egg#md5=28b962296b30bb294b417ebdbaada05a
Processing RPIO-0.9.2-py2.7-linux-armv6l.egg
creating /usr/local/lib/python2.7/dist-packages/RPIO-0.9.2-py2.7-linux-armv6l.egg
Extracting RPIO-0.9.2-py2.7-linux-armv6l.egg to /usr/local/lib/python2.7/dist-packages
Removing RPIO 0.8.4 from easy-install.pth file
Adding RPIO 0.9.2 to easy-install.pth file
Installing rpio-curses script to /usr/local/bin
Installing rpio script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/RPIO-0.9.2-py2.7-linux-armv6l.egg
Processing dependencies for RPIO
Finished processing dependencies for RPIO
pi@raspberrypi ~ $ date

Wed Mar 13 01:40:06 UTC 2013

.END

No comments:

Post a Comment