Advertisements

An Atom for the Sherline Milling Machine

Somewhat against the recommendations of the experts on the EMC2 mailing list, I bought a Foxconn R30-D2 with an Intel Atom D520 from Newegg during a sale: add 2 GB of memory from Crucial, a spare SATA drive from my collection, and it’s ready to go. I also bashed a spare parallel printer port card into the box, although it isn’t really needed right now: unlike the Intel system board, Foxconn brings the on-board parallel port directly to the back panel.

The Foxconn support site is a nightmare and was, AFAICT, dead for the first few weeks I had the box. The key fact to remember is that the -D2 part of the number specifies the system board / CPU, so the same downloads / BIOS updates apply to the R10, R20, R30, and R40 models. There is no new BIOS available to fix the “fan runs all the time” problem reported by so many people.

I installed Ubuntu 10.04 LTS from the distro CD, then ran the EMC2 installation script. All that is routine, as described there. You probably want to install the EMC2 Live CD, though, and to get much the same result with less fiddling.

Turn off Hyperthreading in the BIOS, which seems to make the RTAI real-time hypervisor happier. Under those conditions, the default install has an interrupt latency of about 13 µs.

The Atom D520 is a dual-core processor and you can devote one core to EMC2’s real-time functions, thus eliminating much of the usual contention and interrupt latency. That works surprisingly well and is completely automagic after you add the isolcpus=1 kernel option to the appropriate line in /boot/grub/grub.cfg. Thusly:

linux	/boot/vmlinuz-2.6.32-122-rtai root=UUID=57fe2b04-ffe4-4de3-a597-89bd4ed01018 ro  vga=758  noquiet nosplash isolcpus=1

With that done, the latency drops down under 8 µs, which is entirely satisfactory. I can push it to 10 µs by doing stupid things: scrubbing a glxgears window over a Flash video in Firefox, for example.

The catch is that the wonderful new grub2 bootloader rewrites its boot configuration file on the fly, based on a set of rules that, evidently, cannot apply different kernel configuration parameters to different kernels within the same partition. As a result, you must choose between:

  • Running stock Ubuntu on one core
  • Manually tweaking grub.cfg after every kernel update

Given that an Atom isn’t exactly a blinding flash and a deafening report in the performance department, I opted for the second method. If Ubuntu was still using Legacy Grub, then I’d just tweak menu.lst and be done with it. This is, I suppose, progress.

Memo to Self: Adjust grub.cfg every mumble time.

[Update: There’s now a fix for that, as described in the EMC2 wiki. Go for it!]

Advertisements

, ,

  1. #1 by Frans on 2010-12-21 - 07:23

    I’ve been very pleased with Grub2 as well.

    http://fransdejonge.com/2010/01/07/grub2-brilliance/

    Additionally, it used to take Grub2 like 10 seconds to do anything on my desktop (that is, *before* it would start the countdown), but it seems that Ubuntu 10.10 includes a version of Grub2 that is slightly less slow.

    • #2 by Ed on 2010-12-21 - 07:53

      Just did a kernel update on that box that blam killed the isolcpus=1 kernel parameter…

      Some reading suggests possible hocus-pocus in the later stages of building grub.cfg, but I’m pretty sure I’m not bright enough to write a filter script that will

      1. Do what I want and
      2. Do it dependably on every update and
      3. Not have horrible unanticipated consequences

      Heavy sigh…

      • #3 by Frans on 2010-12-21 - 08:05

        On the good side, I suppose, it’s still a lot more user-friendly than the Windows bootloader. Thanks to installing Windows 7 on my desktop (came with some laptop, trashed it for Ubuntu and figured I’d experiment with it a bit) I now have a strange construction where three HDDs are required to boot the OS I use most on said desktop (XP). Neither 7 nor XP can really do much with the bootloader as far as settings go and Grub can only sort of hand things over to the Windows bootloader. I really wish I didn’t need XP for proper optical 5.1 output over S/PDIF (and to a lesser extent for multiple monitor support that is at least vaguely usable).

        But I digress.

  2. #4 by John Rehwinkel on 2010-12-22 - 15:46

    What happened to the “High Visibility Dremel Chuck Wrench” post?

    • #5 by Ed on 2010-12-22 - 16:20

      Time travel: it moved to next year.

      I’ll be on a trip and I’m trying to get slightly ahead of myself, but suffered a finger fumble that didn’t change 2010 to 2011 before pulling the trigger.

      It was originally dated 3 Jan 2010, if that’s any indication…

  3. #6 by smellsofbikes on 2011-04-13 - 00:35

    Well, now I have an Atom — a D525, I think — and thanks to your guide it seems to have about 5 uS of jitter. I haven’t tried anything heavy yet, but it plays flash video while I’m typing away, and that’s more than it’ll ever do while it’s running the mill. Thanks for posting this.

    • #7 by Ed on 2011-04-13 - 07:00

      it seems to have about 5 uS of jitter

      Step away! My D520 chugs along at 7-8 ms, but that’s scrubbing a Flash video over something else. It’ll idle at 5-7 ms, which is just fine.

      The bulging brains on the EMC2 mailing list just solved a problem that you haven’t hit yet, but will: the normal Ubuntu kernel updates kill your carefully crafted grub.cfg modifications.

      The solution involves adding a script to the update-grub chain, as described there.

      One less thing to worry about…

  4. #8 by John Rehwinkel on 2012-01-06 - 13:23

    So the -D2 specifies the motherboard, what are the differences between R10, R20, R50, etc? I agree the Foxconn site is pretty bad, I tried their “product comparison” and aside from the pictures, all the R boxes seem identical. Perhaps it’s just cosmetic, or there’s more/less room for drives or something. Looks like they don’t offer the -D2 any more, but -D3 and -D4 versions seem like updated versions of essentially the same thing. The R20-D4 is pretty affordable, and seems like it should do the job. Alternatively, I could get on the EMC2 mailing list and see what their experts recommend.

    • #9 by Ed on 2012-01-06 - 16:08

      Perhaps it’s just cosmetic

      Got it in one: (I think) it’s all in the front panel dress. The drive cover flat-out doesn’t work, so don’t base your decision on that; I booted it once and that was the end of the drive nonsense.

      The Foxconn D510 and D525 boxes were on sale at Newegg, which accounts for almost the entire selection process…

      get on the EMC2 mailing list

      The archives should reveal a recent series of discussions that pretty much boiled down to the Intel D525 system board tucked into a smallish box. There’s also a fanless board built around the same chipset that works pretty well and gets you on the air for about $300 complete.

  1. Atom D520: Config Files for Smoother Sherline Stepping « The Smell of Molten Projects in the Morning
  2. From Peanuts to Chips: EMC2 on the Atom « The Smell of Molten Projects in the Morning
  3. Thing-O-Matic: USB Power Backfeed Prevention « The Smell of Molten Projects in the Morning
  4. Thing-O-Matic: Work Flow « The Smell of Molten Projects in the Morning