LinuxCNC on Raspberry Pi 4 with Mesa 7i76e

Setup Guide

LinuxCNC Raspberry Pi and Mesa 7i76e

This guide documents how I set up a Raspberry Pi 4 to run LinuxCNC 2.8 along with a Mesa 7i76e FPGA board. The Pi communicates with the 7i76e over Ethernet.

This is the process that worked for me in December 2020. These steps may become outdated since LinuxCNC and Raspbian are under constant development.

Raspberry Pi Setup

  1. On another PC (i.e. not the Raspberry Pi), I downloaded the LinuxCNC image for Raspberry Pi: www.linuxcnc.org/iso/linuxcnc-2.8.0-pi4.zip
  2. Unzip the image file.
  3. Insert the Raspberry Pi’s micro sd card into a card reader on your PC.
  4. Using the Raspberry Pi Imager https://www.raspberrypi.org/blog/raspberry-pi-imager-imaging-utility/, write the image to the Raspberry Pi’s micro sd card. This will overwrite the contents of the card.
    1. Choose Operating System “Use Custom” and select the LinuxCNC .img file from the folder where it was unzipped.
    2. Choose the micro sd card that you inserted.
  5. Once the image is written to the card, insert the card in the Raspberry Pi.
  6. Plug in a mouse, keyboard and monitor to the Pi.
  7. Apply power to the Pi by plugging it in.
  8. Ignore error message during boot up about CPU 0.
  9. Follow the “Welcome to Raspberry Pi” wizard to setup password, location, and WiFi.
  10. I skipped the updates.
  11. Set a static IP address for the Ethernet adaptor (eth0):
    1. Open a terminal window and enter sudo nano /etc/dhcpcd.conf
    2. Read through the file to find the “#Example static IP configuration”. Uncomment by removing the “#”, then modify the following lines to end up with this:
      interface eth0
      static ip_address=10.10.10.100/24
    3. Press ‘Ctrl+X’ to exit, then ‘Y’ to save changes and ‘Enter’ to use same filename.
  12. Reboot the Raspberry Pi.
  13. To use the Pi remotely or headless (no monitor/keyboard/mouse), install Remote Desktop Server on the Raspberry Pi:
    1. sudo apt-get install xrdp
    2. Find out the IP address of the Pi’s WiFi adapter (wlan0) by logging into your network’s router and looking at the network map, or other methods found online.
    3. Set the Pi to a fixed ip address for its wireless connection using the router options. This isn’t required, but saves you from looking up the ip everytime you want to connect.
    4. Run Remote Desktop Connection (Win 10) or similar from another PC and use the Pi’s wireless lan IP address to connect to it. The default username is “pi” and the password is what you set earlier.
  14. Shut down the Raspberry Pi.

 

Mesa 7i76e Setup

  1. On the Mesa 7i76e, with power off, set jumper W2 DOWN and W3 UP to assign it a fixed IP address from the EEPROM. This will set it to 10.10.10.10.
  2. Plug in an Ethernet cable between the Pi and the 7i76e.
  3. Apply power to the 7i76e. Apply power to the Raspberry Pi.
  4. From the Pi terminal, ping 10.10.10.10 to verify a good connection. Should see a response time for each packet sent. My response times were about 0.100 ms.
  5. I installed the mesaflash utility to check current firmware version, since I had used the 7i76e previously with a Gecko G540 and I think I had flashed different firmware. If you just bought the 7i76e it comes with the latest firmware installed, so you may not need to do this step. If you’re using daughter cards with it, you may need to update the firmware anyway. I used the instructions here: https://github.com/linuxcnc/mesaflash
  6. Run mesaflash --device 7i76e --addr 10.10.10.10 --readhmid to check current board configuration.
  7. Download 7i76e “support software” from the product page on http://www.mesanet.com/ and unzip the file on the Raspberry Pi.
  8. In the unzipped folder, find the proper file for your use case. I used the default 7i76e_7i76x1D.bit.
  9. Write the file to the 7i76e EEPROM:
    mesaflash --device 7i76e --addr 10.10.10.10 --write /home/pi/Downloads/7i76e/configs/hostmot2/7i76e_7i76x1D.bit

 

LinuxCNC Setup

  1. Run Pncconf Wizard for LinuxCNC, found in the Raspberry Pi menu under "CNC".
    1. Create a new configuration.
    2. Select options to "Create a desktop shortcut...." and "Create a desktop launcher....".
    3. Read more about how to configure LinuxCNC 2.8 Using Pncconf
  2. To run LinuxCNC, open the desktop launcher that was created for your configuration.
  3. If there are any changes needed, re-run Pncconf and modify the existing configuration rather than creating a new configuration.

 

Notes and Troubleshooting:

When first testing steppers for motion, ensure all joints are homed prior to attempting to move the steppers, otherwise the display will show motion but the motors won’t move.

If an axis moves in the wrong direction, re-run Pncconf and check off the option for Invert Direction.

Use 'dhcpcd.conf' rather than 'interfaces' for setting up network connections for linux versions later than Wheezy (Jessie, Stretch, etc.).

Support software and manual for the 7i76e are found at http://www.mesanet.com/ under the product page for Anything IO FPGA Cards, the scroll down to 7i76e.

Note: I read that Raspberry Pi hardware with 8GB RAM had known compatibility issues with LinuxCNC at the time I wrote this. I’m using a 4GB version so it wasn’t an issue and I didn’t read any further into the details. If you have an 8GB Pi and run into any problems you may want to research this.