In an earlier post I described some prototype CNC firmware that I had gotten running on the Teensy3.0. The Teensy3.0 is a 32-bit ARM board and is pretty nice, but I wanted to see if the code would also run on an Arduino Uno. This is a much more restrictive platform; only 2k of ram and 32k of program space. However, after a bit of porting of the hardware layer, it compiles and seem to run no problem. Here's a screen-capture from a (brief) session, the pulse-ticks stuff is debugging the motion control module.
Note that this is running the full GCode interpreter, with spec-compliant command sorting and an 8-move lookahead buffer. The step timer is running off a 2KHz Timer1 interrupt. I'm hoping to increase this to 8+ KHz, at least on other platforms, which should make smoother motion control possible, but at the moment I'm just happy that my ANSI C + POSIX code that I've developed on on a 64bit quad core machine with 16Gb ram ports easily to an 8bit system with 2k or ram and only interrupts after changing less than 50 hardware-specific lines of code.
I've written the code this way for just this reason; by keeping all the hardware specific stuff isolated in a hardware abstraction layer I'm hoping to make a code base that stands the test of time, from small embedded platforms to boards like the Raspberry Pi, to full-blown PCs. So far so good, it's running on an 8bit AVR, a 32 bit embedded ARM and a full X86_64 PC.
syntax-highlighter
Sunday, February 10, 2013
CNC Firmware running on Arduino Uno
Labels:
3D printing,
Arduino,
AVR,
CNC,
embedded,
linear motion,
making
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment