Just kidding! :)
...but seriously, this is not quite ready for the unwashed masses, so you need to be pretty familiar with Linux, LinuxCNC, and the BeagleBone if you want to try this out. If all you're interested in is the PRU code, just grab the source from the git repo, checkout the arm335x-hal-pru-tasks, and browse to the src/hal/drivers/hal_pru_generic directory. The *.p files are the PRU source, and the *.c files are the Linux side code to talk to it. The Linux code is written as a HAL driver for LinuxCNC, but it should be fairly apparent what is going on, and PRU communication is handled with the standard prussdrv driver, slightly modified to run under LinuxCNC. Important: You have to use the supplied pasm assembler, which can be found in src/hal/support/pasm, as it includes modifications by Bas Laarhoven (designer of the BeBoPr board) to support some semi-documented PRU instructions. Or you can just use Bas' version from github, but the "stock" TI pasm won't work.
If you really want to try running the code yourself and can't possibly wait until I get it working on a 3.8 kernel, here's what you need to do:
- I started with a Debian wheezy image from eLinux, I think the one from Feb: debian-wheezy-console-armhf-2013-02-16.tar.xz, but any of them should work.
- You have to add Michael Haberler's Xenomai kernel, and all the packages necessary to build LinuxCNC. I have some details on-line
- MAKE SURE YOU USE THE XENOMAI 3.2 KERNEL! This won't run under the 3.8 xenomai kernel (yet) or the 3.2 BeagleBone kernel.
- ...if this sounds like a hassle, you can bypass this by using a raw SDcard image provided by Michael Haberler (see the README files for details). This option also includes some things in rc.local that might trip up the casual user starting from scratch with a stock Debian install from eLinux (like setting the Xenomai gid at run-time, modifying permissions on /dev/mem, and getting all the LinuxCNC build dependencies pulled in from the package repositories).
- From this point, checkout the arm335x-hal-pru-tasks branch from the git repository
- ...and build LinuxCNC as normal (for a BeagleBone, using: "./configure --with-threads=xenomai-user --with-platform=beaglebone").
- Now run the configs/pru-examples/BeBoPr.setup.sh script as root to setup the pin multiplexing. This will hopefully be automatic once I get things working on the 3.8 kernel with device tree overlays.
- If you're lucky, launch LinuxCNC, load the setup from configs/pru-examples/BeBoPr.ini and see pulses!
I have been working on modifying RobertCNelson's automated building scripts to create a turn-key Debian install that runs LinuxCNC. It's not ready just yet, but you can follow along in my github fork of his omap-image-builder scripts
ReplyDeleteThere will be a very excited blog post when I get it working enough to be tested by others!
I'm familiar with Linux as a user and I have a bit knowledge about programming in C and Python. I'm an undergraduate ME student. I want to use my Beaglebone (White) as a controller of 3d printer I'm planning to build. I'm also thinking about using dc motors with encoders instead of steppers. Please, I couldn't find enough information about how to make linuxcnc to use Beaglebone's gpio pins for motor outputs and encoder inputs and what i need to drive motors. As a see I need to be familiar with "HAL" and "PRU" in order to understand the basics. I appreciate if you spend a little time to inform me.
ReplyDelete