-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

For the particularly daring...

On 12/25/2012 7:14 PM, Charles Steinkuehler wrote:
> Of course, the proof is in the pudding, so keep an eye out on
> Michael Haberler's git repo...I'll commit code there once it does
> something useful.

I have checked in some code to Michael's repository that does some
(hopefully) useful tasks with the BeagleBone's PRU:

http://git.mah.priv.at/gitweb/emc2-dev.git/shortlog/refs/heads/arm335x-hal-pru-module

See the README.stepgen file for details:

http://git.mah.priv.at/gitweb/emc2-dev.git/blob/786c7901faf01761359e0c7944f58407e2bfa10f:/configs/pru-examples/README.stepgen

Executive Summary:

With appropriate HAL hacking (and stuffing some configuration details
directly into hal_pru.c), you can instantiate up to 7 PRU modules,
each of which may currently be one of the following:

  Step/Dir generation
  Two "Traditional" PWMs
  Two 14-bit 1st order Delta-Sigma modulators

...and all in less than 512 bytes of PRU code (of the 8K available).

TIMINGS:
Currently the main loop is running on a 10uS timer, and if you build
what's in the repository, apx. 1 uS is spent actually executing the
code for one step/dir module and 6 PWM modules (12 PWM outputs).  The
timer is not yet 'interrupt' driven...there should be minimal latency
jitter caused by the polling scheme, but jitter currently measures at
about 100 nS.  Fortunately, it does not appear to be additive over the
long term.  You can monitor the timings via a "busy" bit output on
GPIO2_6 (P8, pin 45).

If you change the configuration to 7 step/dir modules, code execution
gets close to 2 uS.  I have not yet analyzed worst-case code paths,
and the TI documentation is pretty silent on cycle-times, but it feels
like a 5 uS base thread (or faster) is possible with the generic code.

WARNINGS:
The PRU code is reasonably functional.  The same cannot be said for
the HAL modules that launch it.  I crudely hacked Michael's hal_pru.c
to initialize appropriate state data for the new stepgen.p PRU code
for testing (thanks for the jump-start Michael!), but what is really
needed is a mashup between the existing hal_pru.c (for PRU loading and
interface), stepgen.c (to control the PRU stepgen base thread, which
will behave mostly like the make_pulses() procedure), and something
like the hostmot2 configurable HAL pin exporting for whatever PRU code
modules a configuration happens to instantiate.

And finally:

NO WARRANTY EXPRESSED OR IMPLIED!

This code *PROBABLY* won't destroy your BeagleBone, but no promises.  :)

I did have some issues with my 'bone, but popping the SD-Card and
doing an fsck on another box fixed things right up (hint: don't
manually set the I/O pin mux to enable *ALL* the PRU pins...leave the
ones for the SD-Card interface alone!).  There is a setup.sh file to
keep you from making the same mistake...see the README.stepgen file
for more of a HOWTO.

Comments and criticism (especially of the PRU assembly code) will be
cheerfully received!  The PRU is a strange beast, and I'm still
wrapping my head around programming it effectively...

- -- 
Charles Steinkuehler
char...@steinkuehler.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlDdMpgACgkQLywbqEHdNFwxeACfcV13kv3vN19vySZeDtJ7B9xF
Ps0AoJ9ZibJxs6Lx9QP3U4ohkzy7Mt73
=ZHcI
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to