Wednesday, March 1, 2017

LinuxCNC on a Raspberry Pi

I need a small CNC controller for desktop robots and machine tools. Thus I decided to try LinuxCNC with Raspberry Pi and MESA 7i90HD. I have Raspberry Pi 2, and Pi 3 has been ordered recently from aliexpress.

Surprisingly (or not so much) there's no clear manual how to install LinuxCNC on a Raspberry Pi. A lot of information is available, but in very different places (a debt to collect). I'll try to get everything together here.


1. Download Raspberry Pi image from https://www.raspberrypi.org/downloads/raspbian/ and write it to a 8-16GB SD card with Win32DiskImager. Insert the SD card to a Raspberry Pi, connect keyboard, mouse, display and PSU and power up the Pi. I also connected a WiFi adapter which was luckily recognized.

2. Install preempt-rt kernel and headers:
http://deb.machinekit.io/debian/pool/main/l/linux-rt/linux-image-rpi2-rt_4.4.4-rt9-v7+-7_armhf.deb http://deb.machinekit.io/debian/pool/main/l/linux-rt/linux-headers-rpi2-rt_4.4.4-rt9-v7+-7_armhf.deb
Download the files, then

$ cd Download
$ sudo dpkg -i linux-*

3. Use the new kernel:

$ sudo geany /boot/config.txt

change or add the line:

kernel=kernel_rt-4.4.4-rt9-v7+.img

and also add

enable_uart=1
force_turbo=1 #Voids warranty!
temp_limit=75 #Will throttle to default clock speed if hit.
gpu_mem=128

4. Install LinuxCNC from http://buildbot.linuxcnc.org/ :

Add the buildbot archive signing key

$ sudo apt-key adv --keyserver hkp://keys.gnupg.net --recv-key E0EE663E

Open the sources list file

$ sudo geany /etc/apt/sources.list.d/linuxcnc-buildbot.list

insert the following lines
deb     http://buildbot.linuxcnc.org/ jessie master-sim
deb-src http://buildbot.linuxcnc.org/ jessie master-sim

and update
$ sudo apt-get update

Then install linuxcnc

$ sudo apt-get install linuxcnc-*

5. Make some settings to avoid freezing. Open the cmdline.txt in /boot with editor

$ sudo geany /boot/cmdline.txt

and add

dwc_otg.fiq_fsm_enable=0
dwc_otg.fiq_enable=0
dwc_otg.nak_holdoff=0

Now I publish it here so that I could open this on my Pi and proceed accordingly.
Later I'll edit and add new information if nesessary.

This is how it looks for now





10 comments:

  1. I do not tested any of these links, but I think it is a good first step:
    http://wiki.linuxcnc.org/cgi-bin/wiki.pl?RaspberryPi
    http://wiki.linuxcnc.org/cgi-bin/wiki.pl?RaspbianXenomaiBuild

    ReplyDelete
    Replies
    1. Well I've seen the first link, it's pretty outdated. The second looks very relevant (and it's by jepler!), but I had not seen it back then.
      Anyways, I have no problems with the method I used. The image probably has a lot of unnesessary stuff, but it's no big deal...

      Delete
  2. I tried this on RaspberryPI 3 model B, it freezes after setting up new kernel and and rebooting.
    kernel_rt-4.4.4-rt9-v7+.img

    Have you maybe tried to setup linuxcnc with RPi 3?

    ReplyDelete
    Replies
    1. IIRC I wrote this while expecting RPi3B. Later I successfully tested the same SD card with it. But the SPI link to 7i90HD proved very unstable, so I haven't touched this stuff for a while...

      Now I think that Orange Pi + Mesa 7i92/7i93 (Ethernet) should be almost perfect for a low-cost compact CNC.
      Furthermore, Orange Pi has co-processor which can be used for hardware step generation up to 200kHz.

      Delete
  3. Hi. Are you using software stepping? What's the max jitter?
    Also, doesn't RPi already has a WiFi onboard?

    ReplyDelete
    Replies
    1. Sorry for the late reply. I tried to use Mesa 7i90HD but that didn't work out well. Unstable SPI link.
      RPi 2 did not have a WiFi module...

      Delete
  4. Good evening is possible help
    I need a lot of pictures and videos for this machine
    And some information regarding rigidity
    I study currently on the same topic

    ReplyDelete
  5. Good evening is possible help
    I need a lot of pictures and videos for this machine
    And some information regarding rigidity
    I study currently on the same topic

    ReplyDelete
    Replies
    1. Good evening. Which machine are you interested in?

      Delete
  6. Hi dear,
    I can't do these processes on my RPI3 b+. Could you help me with it?

    ReplyDelete

Google+