2014年7月7日 星期一

LinuxCNC with EtherCAT

1)EtherCAT realtime HAL driver

Overview

This driver tries to provide an easy-to-expand framework for the connection of LinuxCNC to EtherCAT devices. Some of the often used Beckhoff devices like digital and analog I/O, encoder input and pulse train output are already supported just as the [Stöber] MDS5000 series of servo drives. The driver is based on [IgH's EtherCAT master] and builds a glue layer like the etherlab component. It consists of an userspace component for configuration and a RT HAL module for the data processing.
The config module reads in and parses a xml config file and provides a prepared form of configuration data via shared memory to the RT part. The RT module is organised in a global part that is common to all submodules and a .c and .h file for each supported (class off) hardware device.
Since this driver is sill under development you can find the code [here]. Feel free to test or review the code and send me suggestions and hints. There is a discussion thread about this driver in the [forum].

Currently supported devices

  • Bus coupler
  • Digital in
    • EL1002 - 2-channel digital input terminal 24 V DC, 3 ms
    • EL1004 - 4-channel digital input terminal 24 V DC, 3 ms
    • EL1008* - 8-channel digital input terminal 24 V DC, 3 ms
    • EL1012 - 2-channel digital input terminal 24 V DC, 10 µs
    • EL1014 - 4-channel digital input terminal 24 V DC, 10 µs
    • EL1018 - 8-channel digital input terminal 24 V DC, 10 µs
    • EL1024 - 4-channel digital input terminal 24 V DC for type 2 sensors
    • EL1034 - 4-channel digital input terminal 24 V DC, potential-free inputs
    • EL1084 - 4-channel digital input terminal 24 V DC, switching to negative potential, 3 ms
    • EL1088 - 8-channel digital input terminal 24 V DC, switching to negative potential, 3 ms
    • EL1094 - 4-channel digital input terminal 24 V DC, switching to negative potential, 10 µs
    • EL1098 - 8-channel digital input terminal 24 V DC, switching to negative potential, 10 µs
    • EL1104 - 4-channel digital input terminals 24 V DC, 24 V and 0 V sensor supply, 3 ms
    • EL1114 - 4-channel digital input terminals 24 V DC, 24 V and 0 V sensor supply, 10 µs
    • EL1124 - 4-channel digital input terminals 5 V DC
    • EL1134 - 4-channel digital input terminals 12 V DC
    • EL1144 - 4-channel digital input terminals 48 V DC
    • EL1808* - HD EtherCAT Terminal, 8-channel digital input 24 V DC, 2-wire connection
  • Digital out
    • EL2002 - 2-channel digital output terminal 24 V DC, 0.5 A
    • EL2004 - 4-channel digital output terminal 24 V DC, 0.5 A
    • EL2008 - 8-channel digital output terminal 24 V DC, 0.5 A
    • EL2022 - 2-channel digital output terminal 24 V DC, 2 A
    • EL2024 - 4-channel digital output terminal 24 V DC, 2 A
    • EL2032 - 2-channel digital output terminal 24 V DC, 2 A
    • EL2034 - 4-channel digital output terminal 24 V DC, 2 A
    • EL2042 - 2-channel digital output terminal 24 V DC, 2 x 4 A/1 x 8 A
    • EL2084 - 4-channel digital output terminal 24 V DC, negative switching
    • EL2088 - 8-channel digital output terminal 24 V DC, negative switching
    • EL2124 - 4-channel digital output terminal 5 V DC
    • EL2808* - HD EtherCAT Terminal, 8-channel digital output 24 V DC, 0.5 A
  • Analog in, 2ch, 16 bits
    • EL3102 - 2-channel analog input terminal -10 to +10 V, differential input, 16 bits
    • EL3112 - 2-channel analog input terminal 0 to 20 mA, differential input, 16 bits
    • EL3122 - 2-channel analog input terminal 4 to 20 mA, differential input, 16 bits
    • EL3142 - 2-channel analog input terminal 0 to 20 mA, single-ended, 16 bits
    • EL3152 - 2-channel analog input terminal 4 to 20 mA, single-ended, 16 bits
    • EL3162* - 2-channel analog input terminal 0 to 10 V, single-ended, 16 bits
  • Analog out, 2ch, 16 bits
    • EL4102 - 2-channel analog output terminal 0 to 10 V, 16 bits
    • EL4112 - 2-channel analog output terminal 0 to 20 mA, 16 bits
    • EL4122 - 2-channel analog output terminal 4 to 20 mA, 16 bits
    • EL4132* - 2-channel analog output terminal -10 to +10 V, 16 bits
  • Encoder inputs
    • EL5152* - 2-channel incremental encoder interface
  • Pulse train (stepper) output
    • EL2521* - 1-channel pulse train output terminal RS422/24 V DC
  • Servo Inverters
    • Stöber MDS5000 series*
Devices with an asterisk (*) are tested, all other devices are supported due to an equal process image. If you have hardware that is supported and not tested and you like to test it or you have hardware that is not supported yet und you like to support development for this device, just drop me a line.

Installation

You can get a patch of the current code [here]. This patch is for the master branch of LinuxCNC, so you could get some easy to fix conflicts if you apply it to a stable release.

EtherCAT master

The directory src/hal/drivers/ethercat/master contain files that are needed to build a debian package of the EtherCAT master. In contrast to IgH?'s method to start the master via an init script (and unloading existing standard ethernet drivers before statup), the config file (/etc/default/ethercat) is used by a script named update-ethercat-config that should be called after config changes. The script updates /etc/modules and /etc/modprobe.d/ethercat.conf to reflect the configuration so that unneeded/unwanted standard drivers get blacklisted and the EtherCAT drivers and master are automatically loaded at system startup with the right parameters.

Build process

The build process was testet unter the official LinuxCNC distibution based on Ubuntu 10.04 "Lucid Lynx".
1. Download the EtherCAT-Master source (V1.5.2) from [IgH]:
 # wget http://www.etherlab.org/download/ethercat/ethercat-1.5.2.tar.bz2
2. Untar the archive
 # tar xvfj ethercat-1.5.2.tar.bz2
3. copy the debian directory to your build directory.
 # cp -av <source-path-of-LinuxCNC>/src/hal/drivers/ethercat/master/debian ethercat-1.5.2
4. build the packages (very similar to the LinuxCNC build process)
 # cd ethercat-1.5.2
 # cd debian
 # ./configure -a
 # cd ..
 # dpkg-checkbuilddeps (and install missing deps)
 # dpkg-buildpackage

Installation

Just do a 'sudo dpkg -i ethercat_1.5.2-1_i386.deb' to install the diver and a 'sudo dpkg -i ethercat-dev_1.5.2-1_i386.deb' to install the development files. These are needed to compile the EtherCAT HAL driver.
IMPORTANT: after changing the conf in /etc/default/ethercat do a "sudo update-ethercat-config". This will activate the new configuration.

EtherCAT HAL driver

Compile LinuxCNC the usual way (after patching) will include the EtherCAT driver:
 # cd <src-of-LinuxCNC>/debian
 # ./configure -a
 # cd ../src
 # ./autogen.sh
 # ./configure
 # make
 # sudo make setuid

Configuration

... to be continued

Usage.. to be continued






2)LinuxCNC     http://www.linuxcnc.org/

LinuxCNC 2.5.4 Release
LinuxCNC.org

LinuxCNC: Software for realtime control

Welcome to the home of the LinuxCNC

Here you'll find information about the softwarehow to get ithow to configure ithow to run it, and especially where to ask for help.
Community maintained wiki with lots of information and examples about configuration and using LinuxCNC.

LinuxCNC is a software system for computer control of machines such as milling machines, lathes, plasma cutters, cutting machines, robots, hexapods, etc.
LinuxCNC is Free software released under the terms of the GNU GPLv2 (General Public License version 2).

LinuxCNC is a descendent of the original NIST Enhanced Machine Controller software, which is in the Public Domain.
LinuxCNC has many exciting new features and brings a lot of new functionality (a flexible and powerful Hardware Abstraction Layer that allows you to adapt it to many kinds of machinery, a software PLC controller, easier-than-ever installation, a new trajectory planner, and more.)

LinuxCNC is precompiled with Ubuntu LTS (long term support) versions for ease of installation and longevity.
Note: Do Not upgrade Ubuntu from the installed version as it will prevent LinuxCNC from working.
Last Updated on Sunday, 06 April 2014 22:30



Download Information


New Installation

  1. Download the ISO (EU Mirror)
  2. Verify the MD5SUM matches 76dc2416b917679b71255e464ede84ec
  3. Burn the ISO to a CD.
  4. Boot the computer with the CD and install.
  5. Connect to the internet and get any updates If you do not install updates, you will not have the latest version of LinuxCNC. The CD rarely contains the latest version matching the changelogs in the NEWS items to the left; you will get that version when you run the normal OS package updates. (Do Not Update the Ubuntu LTS version!)
  6. Read the Getting Started Manual
Other Installation Options from one of the LinuxCNC Live CDs.
You can also try out LinuxCNC without installing anything to your hard disk.
The LinuxCNC Live CD are based on Ubuntu 8.04 "Hardy Heron" LTS and Ubuntu 10.04 "Lucid Lynx" LTS with additional packages maintained by the LinuxCNC development team.
Note: Do Not upgrade Ubuntu from 6.06 to 8.04 or upgrade from 8.04 to 8.10. The precompiled versions of LinuxCNC are only compatible with the Ubuntu version they were compiled with. Upgrading will remove the LinuxCNC packages and make your system unable to run LinuxCNC .
With this configuration, you continue to get all the benefits of Ubuntu, such as security updates and excellent community-based support for the base OS, plus support of the LinuxCNC components by the LinuxCNC team. (Ubuntu is the preferred way to use LinuxCNC).

Updating 2.4 to 2.5

See the updating page here when updating a previous installation.

Other methods of installation

Other ways to obtain, compile, and install LinuxCNC are discussed on the community-maintained linuxcnc wiki.

Source code

LinuxCNC is an open-source project. Currently we keep the source-code in "Git" (a versioning system) at git.linuxcnc.org. You can browse the sources online, using gitweb , or download them (instructions).

Buildbot

The Buildbot contains other packages and developer information.

3)Hardware Requirements

This information is current to 8.04

Hardware Requirements (for current versions of EMC2)

The performance requirements for running EMC are relatively modest, by todays standards.

Hardware that has been tested and recorded

Here are the recorded latency numbers of some good, bad, and ugly systems-Please add yours. Remember hardware component detail as well as what needed to be changed is very important.[Latency-Test]

Ubuntu base system requirements

If you wish to install the precompiled version of EMC2 for Ubuntu 8.04 or 6.06, refer to Ubuntu's base system requirements: [System requirements for Ubuntu 8.04] [System requirements for Ubuntu 6.06]

Architecture

Currently an x86 PC is required.

Memory

To allow for both EMC and its host Ubuntu Linux installation to coexist comfortably, you should have at least 256MB of RAM, though 512MB is preferable. [The remainder of this paragraph is current as of late-May 2008] All RTAI versions prior to the not-yet-released vulcano CVS version misbehave in physical memory configurations larger than 1GB. Consequently, the kernel on the Ubuntu 6.06-based Live-CD available through www.linuxcnc.org was configured intentionally to recognize only the first 1GB of RAM (of which 896MB is available). This large-memory problem should go away Real Soon Now when a new version of RTAI is released and integrated into the EMC distribution. The kernel on the Ubuntu 8.04-based Live-CD has been configured to recognize more than 1GB of RAM in anticipation of this new version of RTAI which then wasn't released in time, so proceed with caution.
128MB of RAM is not enough to run the suggested Ubuntu distribution. However, a user in Brazil recently (2008) reported installing emc2 on a computer with 32MB of RAM by using a stripped down Debian distribution. The older frontends such as mini or keystick require much less memory and processing power than the Axis frontend.
256MB is adequate for the Ubuntu 6.06-based Live-CD to boot and run in Live mode. According to the notes for the new Ubuntu 8.04-based Live-CD, at least 384MB RAM is needed to boot in Live mode if no swap partition is accessible. If a swap partition is accessible, less physical memory is needed (case in point, the new Live-CD booted and ran fine on a machine with 256MB of RAM and an existing 400MB swap partition).

Processor

The processor should be at least a later Pentium II or III, 400MHz or higher. Slower computers will work, but performance will suffer with stepper motors or high speed servos. Current AMD processors like Athlon and Sempron work. Faster or newer processors will not necessarily work better, and may in fact perform worse. It is possible to install the 32 bit Ubuntu on an Athlon64 and EMC2 will run properly. It will not run using the 64 bit version of Ubuntu.

Hard Drive

Diskspace requirements are low: 4GB is plenty---over 1.2GB is still free after installing dapper, emc2, and the software needed to rebuild emc2. The (currently unsupported) "puppy emc2" will install in a small (128MB or less?) hard drive; it will even run totally in ram, but you still need somewhere to put your configuration files.

Problematic Hardware

Laptops

Laptops have a terrible reputation for realtime performance. One list member reported having a PII laptop that would cause a realtime "hiccup" (which would stall the steppers) every time the processor's fan would turn on or off. There was no fix except using a different machine. Fortunately EMC2 will now let you know when it detects a problem like this.

Video

Many onboard video chips cause bad realtime performance. The ones that use some of the system RAM for video ("shared memory") are the worst. If you have realtime problems with a system using onboard video, the first thing to do is disable it and plug in a video card. The closed-source NVidia driver is known to break realtime, so if you have an NVidia card you should try the "nv" or "vesa" drivers.
By installing the package 'libgl1-mesa-swx11' you can get software OpenGL? rendering even if your video card has buggy direct rendering. For more information, [see this mailing list post].

Power Management

For running a realtime OS, you should disable all power management options in the system BIOS.

Computer issues

The Real Time Kernel that ships with Ubuntu, called "Magma", is compiled without ACPI support (ACPI includes power management functionality). This creates minor problems on newish machines and motherboards which rely on ACPI to configure peripherals (integrated sound, wi-fi, etc.) (See also the comments above about large memory problems.)
  • P4R800-V Deluxe motherboard which includes onboard AC'97 audio
  • Lenovo 3000 series laptop
  • Either the audio chip needs to be diabled from the BIOS, or the sound driver must not be loaded at bootup - otherwise Ubuntu 6.06 with the Magma kernel will not boot. There are at least three workarounds:
  • Disable integrated sound from the BIOS (this has the unwanted effect of diabling sound for all other OSs also)
  • Disable the sound driver from loading with a 'nosound' file in /etc/modprobe.d
    • nosound should be a text file containing the single line 'install snd /bin/true'
  • Disable the sound driver by passing an argument to the kernel at bootup:
    1. When booting, press "e" (for edit) while the 'Magma" line is selected. The screen will change.
    2. Use the down arrow to select the second line, and press "e" again.
    3. The cursor should be at the end of the line. Hit space, and type in nosound then press enter.
    4. Press "b" to boot.

Real Time Performance Database

Results from a survey of realtime latency tests are available at [1] - we are interested in the "tUP max latency" column; the smaller the number, the better. There are only 350 entries in the database so far, and many are lacking in details as far as exactly what model of motherboard, processor, bios version etc, were used. Please submit an entry to the survey by downloading and running the cd image on issaris.org ! 

Optiplex2 and pentium 3 are high on the list.. Probably more interesting than what models give the best performance is what models give the worst performance; the difference between a system that works well and something that works OK is miniscule compared to the latency of a system that has an actual problem. 

The best way to benchmark RT performance is to [run the RT latency test provided with the RT kernel.] While it is running, try to stress the system - move windows around, do a ping flood, copy some huge files around, play quake, and compile a kernel, all at the same time. A compilation of results from this test has been started at [2]
Which motherboard/cpu combinations are recommended for EMC2? Which motherboard/cpu combinations are _not_ recommended for EMC2?

Some recent conversations on the mailing list revealed some motherboards

Just for future reference here is what I found out about the part numbers:
J7F2WEIG-OC-LF OC organic capacitor LF time stamp
I asked an engineer at Jetway how long they would be making this board and he indicated about 5 more years. They do have a version without the tv interface but they seem to be really scarce.
The parport is a 26 pin header behind the plugs so I was able to modify the NEMA box with a small cutout for mouse, kbd, and display connectors without fighting the parallel port cable. Went to a local used computer store and found a few dozen cables with the right ends.
J7F2WEIG 1GHz VIA C7 processor J7F2WEIG5 1.5GHz VIA C7 processor 12 watts J7F2WEIG5D 1.5GHz VIA C7 processor 25 watts J7F2WEIG2E 1.2GHz VIA C7 processor fan less
I used something like this. I believe there are 90 watt ones out there as well. Without much moving in the box there is no need for a great deal of power. http://www.idotpc.com/thestore/pc/viewPrd.asp?idcategory=10&idproduct=262
JetWay? Model JAD12VB 80W DC-DC 12V power supply http://www.newegg.com/Product/Product.aspx?Item=N82E16813998007
http://www.newegg.com/Product/Product.aspx?Item=N82E16813153092

ESTUN, LinuxCNC, EtherCAT | First Setup

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。