Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
martijnvandermarel edited this page Jan 23, 2019 · 1 revision

How to make a new slave

Setting up:

Install the EtherCAT SDK by RT-labs and Visual Studio Code + platformio plugin.

Clone the ethercat-slaves repository on github (link) and open it in Visual Studio Code.

Get a DieBieSlave, a ST-link to program it and an ethernet cable. Connect the slave to your pc with the ethernet cable.

Slave editor:

Create a new EtherCAT slave description in the EtherCAT SDK by RT-labs. (If you haven't yet, first create a new project in which you can make the slave description).

Go through the tabs 'Slave', 'Configuration', 'EEPROM' and make sure to copy the settings as they are in the 'Template.esx' included in the example ges. In the 'Slave' tab, you can change the Slave ID and Name to whatever application you're making.

In the 'Application' tab, add records with variables based on what you want for your application. It is advised to create one record for MOSI signals and one for MISO signals (more is untested).

  • Use 0x1600 as index for the (MOSI) input record and 0x1A00 as index for the (MISO) output record.

  • The indices for the variables in the records can start at 1 and increment for each new variable.

Save the slave description using Ctrl+S.

Click the buttons in the top right corner ('generate description files' and 'generate C code') to generate the ESI/SII files and the C source files.

Editing the SII

See the file Template.bin for an example of how the SII file should look at the end of this step.

Open the generated SII.

In the field 'Strings', add the names of all records and variables used.

In the field 'SII Area', change 'Mbox Protocol' to 0.

In the field 'Rx PDO', add a new element for each MOSI record.

  • Similar to in the slave editor, set 0x1600 as the index.

  • Set the Sync Manager to 2.

  • Set the Name Index to the corresponding record name added in the 'Strings' field.

  • Add an 'Entry' element for each variable in the record

    • Similar to in the slave editor, the index here can start at 1 and increment for each entry.
    • Set the Name Index to the corresponding variable name added in the 'Strings' field.
    • Set the bit length to the bit length of the variable.

In the field 'Tx PDO', add a new element for each MISO record.

  • Similar to in the slave editor, set 0x1A00 as the index.

  • Set the Sync Manager to 3.

  • Set the Name Index to the corresponding record name added in the 'Strings' field.

  • Add an 'Entry' element for each variable in the record

    • Similar to in the slave editor, the index here can start at 1 and increment for each entry.
    • Set the Name Index to the corresponding variable name added in the 'Strings' field.
    • Set the bit length to the bit length of the variable.

Preferably, save the edited SII file in some way that it can't be overwritten if the 'generate description files' button is hit again accidentally.

Updating the slave firmware:

Create a new platformio project under the folder ges similar to the example project there.

Copy the generated utypes.h into the src folder of the desired ethercat-slaves project.

Copy the generated (and edited) ESI and SII files under the folder ESI to let other people know with what EEPROM configuration the project works.

Edit the main application to do something with the EtherCAT inputs and outputs.

Program the DieBieSlave via the ST-link (see also the page on programming the DieBieSlave in mbed).

EtherCAT Explorer:

Open the EtherCAT Explorer view in the EtherCAT SDK.

Create a new master and start it.

The master should automatically find the slave if it is connected to your computer.

In the tab 'EEPROM', load the (edited) SII file and write it to the slave.

Reset:

  • Stop the EtherCAT master.
  • Remove the slave from the network.
  • Unplug the power to the slave and plug it back in to reset it.
  • (If you have changed something in the firmware, program it again via the ST link).
  • Start the master again.

Check if the slave is in operational state in the 'Slaves' tab.

In the 'Process Image' tab, check the behaviour of the slave by changing the inputs to the slave and checking the outputs.