BeagleBone for CNC-control, howto timer, interrupt, pwm, ...

I would like to write a simple g-code to stepper pulses CNC controller app for the BeagleBone. I have been doing this on an ARM Cortex-M3 and I am familiar with setting up timer and doing very efficient bitmasking for IO.

I am having a really hard time to find any documentation for doing low-level, real-time stuff on the 'bone. Is this even possible? Specfically I need timer interrupts, io interrupts, efficient GPIO, full control over PWM.

Can anybody point me to the right docs and howtos.


I would take a look at the QNX or another real time OS.
There is also this offering from TI

Sorry cant help much more, my real time experience is limited to VxWorks

What you really need is the PRUSS, but it would appear from another thread
that there is a difficulty with getting hold of the assembler. The V1
assembler is apparently easy to get, but lacks features that the PRUSS on the
Bone's chip has for which you need the V2 assembler which is not on general
release. Hopefully this can be resolved.

The PRUSS is described in the chip Technical Reference Manual which is linked
from the BeagleBone web page.

I am also interested in this kind of use, not for CNC but as the controller
for a Reprap, so I also need GCODE to stepper conversion.


Too bad there is no easy way of doing this. I think I have mistaken the main purpose of the beaglebone.

As far as gcode to stepper check out our TinyG project. Its for the
avr xmega chip now. HOwever we are looking at porting it soonish.


The board targets this type of application, but the software/device support in this area is still a bit lacking. It is possible to build up real-time support w/o Linux using StarterWare. I’m targeting this summer to have support for the PRUv2 in bonescript. Hopefully we can get the TI assembler opened up, otherwise we’ll have to create our own in the community.

At this stage I'd just appreciate a user-space PRU loader so that I
can compile a program with the current assembler and just get it on
there quickly.

For a CNC application that is working and uses the PRUSS, see: </shameless plug> – Bas

Oh wow, nice work! This is great!

Do you mind explaining how the PRUSS stuff works? I see the stepper.bin referenced in the code. Is this what gets loaded into the PRUSS. How do you compile it? Also, how does the main code communicate with PRUSS code?


The PRUSS code is indeed in the stepper.bin file. PRU assembly code is assembled with a program called pasm (see for the open source version of this assembler). For the BeBoPr I run the critical (hard realtime) steppulse generation code on one of the two PRUs. The interface between the Linux application and the PRU is implemented as a FIFO. Because of this construction, the timing of the step pulses is very predictable with almost no jitter. Information on the PRUSS can be found on the web (and at the above mentioned github link). Advantage of using a PRU instead of a separate processor is that you don’t have to implement a bus and protocol. With the PRUSS you can use shared memory, interrupts and more without the need for custom hardware design. Hope this gives you enough pointers to start with :wink: – Bas


I’m doing data acquisition with light sources and light sensors. I’m aiming at sampling rates of 100 kSamples/s. My current implementation relies on OMAP2 general-purpose timers and timer interrupt handlers to make it happen in real-time. Is PRUSS could be useful in that situation too?

I should have a look at it…



2012/8/20 Bas Laarhoven <>