Giter Club home page Giter Club logo

igh-ethercat-master-with-easycat-slave-example's Introduction

IgH EtherCAT master with EasyCAT slave example

Files:

  • ethercat.tar.bz2.00 - IgH EtherCAT master, part 1
  • ethercat.tar.bz2.01 - IgH EtherCAT master, part 2
  • main.c - IgH EtherCAT master modifyed example for EasyCAT slave, overwrite with main.c file in /ethercat/examples/dc_user and compile there with "make"
  • ethercat - config file for ethercat master, copy it to /etc/sysconfig, change lan mac and name (look installed lan for ethercat master)

Combine IgH EtherCAT master source code to one file with

  • cat ethercat.tar.bz2.?? > ethercat.tar.bz2

Unpack IgH EtherCAT master source code with

  • tar -xvjf ethercat.tar.bz2

Try to use ./configure --disable-8139too instead of ./configure if error occurs, read /ethercat/INSTALL for details, The IgH EtherCAT master source code has been tested to compile with kernel version 5.4.80-gentoo-x86_64.

After IgH EtherCAT master installed, check ethercat service settings /etc/sysconfig/ethercat, example

  • ifconfig

    enp3s0u1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 169.254.124.186  netmask 255.255.0.0  broadcast 169.254.255.255
            ether 70:88:6b:84:2d:b4  txqueuelen 1000  (Ethernet)
            RX packets 358799  bytes 28470392 (27.1 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 358978  bytes 33531024 (31.9 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    

    where the interface name is enp3s0u1, mac is 70:88:6b:84:2d:b4

  • lsusb # (use lspci -nn in case of lan is on PCI)

    Bus 004 Device 002: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
    

    where LAN with chipset RTL8153 (0bda:8153), the IgH EtherCAT master source code does not include Ethernet driver module specially for RTL8153 (0bda:8153) to use it for EtherCAT operation, ethercat master "generic" lan driver is going to be used.

    for this example, in /etc/sysconfig/ethercat file:

    MASTER0_DEVICE="70:88:6b:84:2d:b4"

    DEVICE_MODULES="generic"

    LINK_DEVICES="enp3s0u1"

Start ethercat service with

  • /etc/init.d/ethercat start

It might be helpful to check ethercat service messages with

  • dmesg
  • cat /var/log/messages

Check connected EasyCAT slave with

  • cd /usr/local/bin
  • ./ethercat slave -m0
  • ./ethercat pdos -m0

Expected output of "./ethercat slave -m0":

0  0:0  PREOP  +  Generic 32+32 bytes rev 1

Expected output of "./ethercat pdos -m0":

SM0: PhysAddr 0x1000, DefaultSize    0, ControlRegister 0x64, Enable 1 RxPDO 0x1600 "Outputs"

 PDO entry 0x0005:01,  8 bit, "Byte0"

   ::::::::::::::::::::::::::::::

 PDO entry 0x0005:20,  8 bit, "Byte31"
 
SM1: PhysAddr 0x1200, DefaultSize    0, ControlRegister 0x20, Enable 1 TxPDO 0x1a00 "Inputs"

 PDO entry 0x0006:01,  8 bit, "Byte0"

   ::::::::::::::::::::::::::::::

 PDO entry 0x0006:20,  8 bit, "Byte31"

Copy main.c file to /ethercat/examples/dc_user (/ethercat is IgH EtherCAT master source code)

Go to "/ethercat/examples/dc_user", compile "main.c" there with "make", the output file will be "ec_dc_user_example"

Start EasyCAT slave example in "/ethercat/examples/dc_user" with

  • ./ec_dc_user_example

Example code (main.c) creates files to use bash script or console to send/display received data to/from EasyCAT slave

/run/ethercat/EasyCAT/pdoin0

::::::::::::::::::::::::::::

/run/ethercat/EasyCAT/pdoin31


/run/ethercat/EasyCAT/pdoout0

:::::::::::::::::::::::::::::

/run/ethercat/EasyCAT/pdoout31

Example to display received byte from input 1

  • cat /run/ethercat/EasyCAT/pdoin1

Example to send byte 255 to output 10

  • echo 255 > /run/ethercat/EasyCAT/pdoout10

igh-ethercat-master-with-easycat-slave-example's People

Contributors

serge567 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.