|Note: This tutorial assumes that you have completed the previous tutorials: ethercat_hardware/Tutorials/Integrating A New EtherCAT Device.|
|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Setting up communication with a new EtherCAT deviceDescription: Second part of tutorial. Shows how to setup process communication with new device.
The previous tutorial added initial support for a mythical analog device with one 16bit analog input and one 16bit analog output. This tutorial will setup process communication with the new device.
Process Data Communication
Communication with the new EtherCAT device was already occurring in the previous tutorial. The EthercatHardware:::ethercatDiagnostics() function uses EtherCAT positional addressing to read communication error counters. However, positional addressing has high overhead.
For reads and writes that need to constantly occur, logical addressing uses much lower overhead. However, logical addressing uses special hardware (FMMU and SyncManagers) on each device. There is limited amount FMMU and SyncManager hardware. Also, SyncManagers and FMMU must be configured before logical addressing will work.
For the new device, both the 16bit analog input and 16bit analog output are good candidates for logical addressing.
SyncManagers and FMMU setup
In the previous tutorial left the construct() function setup zero SyncManagers and zero FMMUs. For communication to work correctly with new device, two SyncManagers and two FMMUs are needed. One SyncManager and one FMMU is used for getting the analog input status data. The other SyncManager and FMMU will be used for send the analog output data.
EtherCAT device details
Lets assume that the !EtherCAT slave device consists of two major parts. EtherCAT ASIC and a microcontroller. A system diagram is shown below.
TODO : system diagram.
The microcontroller interfaces with a 16 bit ADC for its analog input. It also interfaces with a 16bit DAC for its analog output. The microcontroller also uses a SPI bus to communicate with the !EtherCAT ASIC.
The EtherCAT ASIC is connected to two Ethernet PHYs.