Quick Start

Hardware Requirements

This system was designed to work out of the box with a precise set of hardware. It is of course possible to tailor it to another one, this will be explained later [here](Adding Custom Hardware).

Target Machine

Computer

  • An Intel CPU with at least 4 cores

  • An e1000e Ethernet controller

  • A GPU from either Intel or Nvidia (preferably external)

  • At least one free USB port after connecting a keyboard and mouse

  • An USB stick (at least 200 MB at the time of writing)

  • A monitor

Note

In order to make the system as stable as possible, disable hyperthreading and any frequency scaling in BIOS/UEFI.

CNC

  • Two TSD80E drives from Triamec

  • 3 brushless motors for the 3 axes with angular position encoders, linear optical incremental encoders with an index and limit switches

  • 1 high-speed brushless motor for the spindle

Build Machine

  • A standard PC with Linux as Operating System (only tested with Debian and Ubuntu distribution)

Installation

Software

First we need to clone this repository using the master branch.

git clone https://gitlab.com/reds-heigvd/opencn

From here on, opencn will be assumed to be the base folder of the project. Then the base system (rootfs) has to be configured and built.

cd opencn/rootfs
make opencn_x86_defconfig
make

Warning

This will take a long time. Expect at least 2-3 hours on a decent PC.

After that, we can build the userspace applications.

cd opencn/usr
./build.sh

We need to tell the kernel which ethernet adapter is the one we wish to use for EtherCAT communication. This is done via the CONFIG_OPENCN_ETHERCAT_MASTER_MAC0 option for the kernel.

Begin by preparing the configuration file.

cd opencn/linux-4.14-amp
make opencn_x86_defconfig

Next change CONFIG_OPENCN_ETHERCAT_MASTER_MAC0 in the .config file to reflect the MAC address of the adapter you wish to use, and then build the kernel.

make

Create the system image.

cd opencn/usr
./deploy.sh

Now insert a USB stick and check the drive name with dmesg for example. (TODO: Add the output of with /dev/sdc highlighted) Assuming it is /dev/sdc :

Warning

Make sure you have the correct drive, you could destroy your OS

Format the thumb drive. (as root)

cd opencn/rootfs/usb
./prepare_usb.sh -d /dev/sdc -f

Install GRUB (as root)

./prepare_usb.sh -d /dev/sdc -g

Flash the thumb drive. (as root)

./prepare_usb.sh -d /dev/sdc -k ../../linux-4.14-amp/arch/x86/boot/bzImage -r

Note

These 3 operations can be done in a single step on some machines

Hardware

There are two main modes to run OpenCNC on the target machine: virtual and real.

Virtual mode

The virtual mode sets the ethercat master and its slave drivers into a simulated mode. This can be set in the two-drives.hal file: replace the line load lcec cfg=two-drives.xml by load lcec cfg=two-drives.xml -d

Real mode

OpenCNC assumes two TSD80E drives are connected in a chain to the Ethernet port of the target pc.

  • First drive : Axes X and Y

  • Second drive: Axis Z and spindle

The firmware used at the time of writing is 4.7.3, it can be found here .

Appart from the EtherCAT chain, the two drives are connected with each other with their digital ports, for instant error propagation and handling with the security firmware. They are written in a tiny subset of C# and executed on the isochronous TAMA vm of the drives.

The files required are found in opencn/firmware/drive. There are configuration files for the drives with our exact setup. Using TAM explorer, flash the drives with the 4.7.3 firmware, configure them with their respective configuration files and finally upload the security firmware.

Running

Insert the USB stick into a free slot, make sure booting from usb is selected or prioritized, and let it boot. If everything succeeded, you will be greeted with this screen:

_images/inactive.png

Try clicking on the homing tab and see if the current mode of the axes goes to a green HM.