Quick & dirty installation instructions:

  1. Download MachineKit image from elinux
  2. Flash it onto BBB (uncomment flasher line from /boot/uEnv.txt and boot from SD card)
  3. Update apt
  4. Update timezone & time ($ sudo dpkg-reconfigure tzdata)
  5. Install xauth
  6. Install XQuartz on macOS (homebrew: $ brew install xquartz), and enable “indirect GLX”:

     defaults write org.macosforge.xquartz.X11 enable_iglx -bool true
  7. ssh into it with -Y (e.g. ssh -Y machinekit@beaglebone.local)
  8. Run machinekit:

     $ machinekit
     MACHINEKIT - 0.1
     Machine configuration directory is '/home/machinekit/machinekit/configs/pru-examples'
     Machine configuration file is 'pru-stepper.ini'
     Starting Machinekit...
     io started
     emc/iotask/ioControl.cc 768: can't load tool table.
     halcmd loadusr io started
     task pid=8896
     emcTaskInit: using builtin interpreter
     libGL error: No matching fbConfigs or visuals found
     libGL error: failed to load driver: swrast

    Evntually a window will appear (on the Mac) prompting you to choose a configuration. I dug down into the sample configurations for pru-stepper. In this screenshot, I’ve already selected it on a previous run, and it prompted to copy it to my home dir. Now I choose that copy (under “My Configurations”).

  9. If you get errors like this:

     $ machinekit
     io started
     emc/iotask/ioControl.cc 768: can't load tool table.
     halcmd loadusr io started
     pru-stepper.hal:37: insmod failed, returned -1:
     rtapi_app_main(hal_pru_generic): -1 Operation not permitted

    You need to fix the misconfigured pru-stepper.ini. Find the line that begins with CONFIG=prucode, and change it to the following (this seems to work with machinekit images from Robert C Nelson as of 2018-03-25).

     CONFIG=prucode=/usr/lib/linuxcnc/rt-preempt/pru_generic.bin pru=1 num_stepgens=3 num_pwmgens=1

    You’ll have to quit and/or relaunch machinekit after making that edit. After the edit is in and launch machinekit again, you should see this:

    And that’s all I got. For now. Next up is to adjust the .hal file for my specific servo connections. But the hardware is all at the shop, and I’ve been doing this remotely.


XWindows under root

Note: This should not be necessary, but to enable root to use X (see this SO answer):

After logging in with ssh -Y to regular user:

$ xauth list | grep unix`echo $DISPLAY | cut -c10-12` > /tmp/xauth 
$ sudo su
# touch .Xauthority
# xauth add `cat /tmp/xauth`


hal config can use 8xx and 9xx numbers to refer to pins. Not sure where that goes, but I'm guessing the lines that look like this:

setp [PRUCONF](DRIVER).stepgen.00.steppin         0xA2
setp [PRUCONF](DRIVER).stepgen.00.dirpin          0xA3

Can be change by changing the hex values 0xA2 to some 8xx or 9xx value, etc.