High speed encoder input capability of BBB?

Hi TJF! It’s been a few months since my last post, just curious if you have the QEP features ready in libpruio?

Here is a simple project which might help you with “where to go from here”:


This project uses one of the Encoder modules which the PRU accesses via its OCP master.
The PRU has its own encoder, but it has only one pin wired out, and in this project that pin is used in PWM mode.
The encoder function must be quadrature (2 wires), so even if the PWM was not being used it would have to use an external encoder.

The project uses RemoteProc which you have already encountered in the Labs.
RemoteProc will take care of loading the firmwares as well as provide a simple two-way communications channel between the PRUs and user-space.
The most expensive component (besides the Beaglebone) is the motor-encoder which you can get from eBay for about $20.

At the very least you can look at the C code for the PRU firmware and you can see how the external Quadrature Encoder module is accessed from the PRU.


Hi beezerlm!

Greg - Thanks for the link I will check it out.

TJF - I should probably wait for the docs because I will probably need them. My project is finished for now, but it’s running in a windows environment so it has some limitations on what it can do. I would rather wait until the docs are ready to avoid any unnecessary hurdles if you know what I mean. Thanks for the quick reply!

OK, I just got my BBB so I gotta talk a bit out of my butt (having not done this yet myself).

What you need to do is get it “interrupt driven”. However you do it.

I’m thinking there is a GPIO pin that has this capability (and realistically accessible via the OS in whatever dev environment you use). The form it would take is a callback kinda looking function (like int_countencoder() ). All the function does is super-fast adjust its accumulators and save the absolute position of your encoder in a way accessible at the application level. In other words you just call a high-level function getposition() and it gives you the number you need.

Another way to do is to do the same thing with a PIC or an Arduino where it does an interrupt driven function and then allows you to scan the absolute position via a serial or USB connection. I would do it in assembly language as well (like with a PIC16Fx), crystal-controlled, and tight so there’s no chance of loosing any pulses. Maybe just have it update the host at maybe 10 to 100 hz, so you have the absolute position in real time.

Have you tried it on the 4.9.x kernel yet?

I've been unable to get the tiqep kernel driver in 4.9.5-ti-r16 to
work so far. I'm curious if eQEP would still work with your method.


Hi beezerlm!

I tried to answer your EMail, but got an error message:

550 <your.emailaddress.here> Account Inactive

Here's the text I tried to sent:

AFAIR the QEP docu is done, but the preparation/installing is still work
in progress.

I uploaded the beta source at

Just check it out, your feedback is much appreciated.


Please input PlcEdit on the Google Play and you can program plc on your
phone,the PlcEdit is at