Playing with the Beaglebone Black am335x PRU to generate stepper pulses.

Playing with the Beaglebone Black am335x PRU to generate stepper pulses.
Originally this was a little New Years’ Eve project to learn how to utilize the PRU. It looked promising, so I added a G-Code interpreter :slight_smile:

The host CPU just pushes parameters via a ring-buffer to the PRU, the PRU reads these and creates full motion profiles (acceleration - travel - deceleration) autonomously.

BeagleG can easily reach 1Mhz step frequency (this is more a theoretical limit - real-world steppers won’t go that fast). And right now 8 motors can be operated in a controlled move. These number of axis should be useful for some robotics experiments.

The host CPU is pretty much bored. The advantage of BeagleG is, that the Beaglebone can host nice frontend software for the 3D printer (e.g. @OctoPrint ) without the trouble of too slow serial connections (often a pain-point). And of course cost saving because there is no additional micro-controller board needed for the low-level G-Code to stepper operation. And less things that can fail. It implements a network interface, so allows for interactive sessions via telnet without the need for a terminal emulation.

This is not complete software yet, but getting close. There are some small things to do to make it fully capable to operate a 3D printer (acceleration planning and a PID controller and PWM to control heaters). Also, I am looking forward connecting this to my Fireball V90 CNC machine.

As stepper drivers, I just use a regular RAMPS board, see this test-setup:
https://plus.google.com/u/0/+HennerZeller/posts/HyDMSHRBBDH

Code: http://github.com/hzeller/beagleg
http://www.youtube.com/attribution_link?a=lG_ogJAfrI0&u=/watch?v%3DhIEY9077D64%26feature%3Dshare

This sounds great! I wonder if there’s anything that can be taken from / given to the Replicape project?

https://bitbucket.org/intelligentagent/replicape

I’ve thought many times the BBB with octoprint and PRU based stepper control would be perfect! I think BBB has enough horsepower to slice models, would be interesting to see if direct STL printing with on the fly parameter altering would be possible?

Holy smokes! That video had a surprise.

So when you say the cpu is just sitting bored, could it possible be running batch slicing while printing? Having the host run without the worry of slowing the print is amazing. I print tethered by USB and don’t dare do anything cpu intensive on my pc because it will pause my print.

Apparently, the replicape software is written in Python, so software wise there is probably not much to be shared, @Liam_Jackson . However, it should be possible to have BeagleG use the same GPIOs, so that the cape is compatible.

Yes, ideally, I’d like to have a slicer (Slic3r or Cura) running on the board to do on-thy-fly slicing. If we can combine that with just a regular CUPS daemon, then printing could be as simple as network printing in the 2D space. Basic paraemters of the print (e.g. layer height) could be sent via the CUPS interface or by having different virtual ‘printers’ with different presets. Anyone working on a CUPS->slicer integration ?

The host CPU is less than 1%, @Eric_Moy , so there is lots left to do all kinds of other stuff, as long as the sending process (e.g. OctoPrint) is keeping up (alternatively BeagleG can just read a GCode file directly). OctoPrint doesn’t use much CPU either. So if BeagleG and the sending process run at slightly higher priority to not get starved, utilizing the CPU for batch slicing should just work fine.

Do you know what kind of stepper driver timing you used for the drivers? Im working on getting MachineKit running with my beagle bone and similar drivers but Im not sure what to put in for the step timing in LinuxCNC.

Not sure what you mean with stepper driver timing. Do you mean the frequency the steppers are driven with, @Joe_Spanier ?

The step frequency is typically in a range between 1kHz and 200kHz (I am using 16 microsteps, so fairly high frequency), depending on the feedrate. And of course it even differs with the same feedrate: say you need 1kHz for a particular horizontal move, then a 45 degree line would only use 707Hz stepping both motors, getting the same euclidian feedrate.

In general, it depends on your machine, the voltage you’re driving the motors (more voltage allows to use faster stepping), and if you’re doing Microstepping (16x microstepping requires 16kHz for which single stepping requires 1kHz to get the same speed).

So yes, I do know the timing in my case, but I can’t really recommend anything for you as this is heavily dependent on the machine. If you know the feedrate you want to achieve and the steps/mm on your machine, you can calculate the necessary frequency.

well in the process of googling to find more information to flesh out my question, I found the answer :confused: sorry about that. Your machine is awesome btw though. Are you running nema 17s at 12v to get that speed or have you jumped up your voltage?

The motors are the stock motors in the Type-A machine, but I had to jack up the voltage to 28V to make it work reliably that fast: current just doesn’t rise fast enough otherwise.