Tuesday, December 9, 2014

BeagleBone Encoder Support

Russell Gower has written a HAL driver for the hardware eQEP encoder inputs on the Beaglebone.  This makes it possible to do rigid tapping with an encoder on your spindle, and paves the way for eventually running high-speed servo systems on the 'Bone (which will likely also need support for hardware PWM, since the existing PRU based PWM isn't really fast enough for motor control).

The new code is merged and built, so you should be able to use apt (or your favorite package manager) to update if you've installed Machinekit from packages.  If not, you should consider doing so (instructions), since it makes it much easier to do updates.


  1. Hello Charles !
    Could you briefly explain the PRU based PWM performance problem, and the sort of hardware PWM generator you think about ?

    Briefly, just to orient me...
    Thanks a lot.

  2. The existing PRU based PWM runs at 100 Hz by default. Motor drive PWM is typically at least a few thousand Hz, and generally more like 25-30 KHz and above (to avoid audible noise caused by the switching transients). The PRU could potentially run that fast (especially if one PRU is dedicated to PWM generation), but it's easier just to use the hardware PWM generation already available on the BeagleBone. Details on the hardware PWM can be found in the AM335x Technical Reference Manual from TI.

  3. Hi, the instructions link seems to be broken. Could you please point it to the new location? I'm trying to add an encoder to my spindle for threading so it sounds like just what I need.

    1. I've updated the instructions link, but that's just for installing Machinekit via packages. I'm not sure if the eQEP HAL driver has a man page or not. If you can't figure out the usage, ask on the Machinekit Google Group (see "Support" tab, above).

    2. The eQEP HAL driver man page: http://www.machinekit.io/docs/drivers/hal_arm335xQEP/