NRMKEtherCAT Configuration Tool - SDO Tutorials

From Neuromeka Wiki
Jump to: navigation, search


NRMKEtherCAT Configuration Tool - SDO Tutorial

In this tutorial, we only focus on how to make SDO configuration in NRMKEtherCAT Configuration Tool (NRMKEcatTool). For general instruction about how to use NRMKEcatTool, please refer to NRMKEcatTool's Overview and NRMKEcatTool's Tutorials. For elaboration, this section will

  • Guide you how to add (remove) SDO objects to (from) a slave in NRMKEcatTool.
  • Explain you about SDO-related source code in C++ generated by NRMKEcatTool. As usual, the source code is managed as a project in Eclipse.

In addition, we used Ezi FASTECH servo drive in this tutorial. Indeed, the servo drives of this brand do not include the Mode of Operation (ModeOp) object in its default list of PDO entries so that we have to set (get) value of this ModeOp object via SDO communication.

Step 1 - Adding or Removing SDO objects

As shown in the figure below, we have 3 Ezi slaves in the workspace which do not contain Mode Operation (0x6060) and Mode Operation Display (0x6061) objects. Therefore, our task in this step is to add those objects into Ezi's SDO list.

NRMKEcat Tool Workspace

NRMKEcat Tool Workspace

Now, making a right click on the slave icon, we will see a properties menu which consists of many options for setting the slave. In this section, we focus only on Read SDO Setting and Write SDO Setting.

  • The Read SDO Setting is for configuration of input SDO objects such as Mode Operation Display, Error Code or other objects we want to read their value.
  • In contrast, Write SDO Setting is for configuration of output SDO objects such as Mode Operation, Homing Method or other objects we want to write our value into.
Slave Properties Menu

Slave Properties Menu

For instance, in order to add Mode Operation Display (ModeOpDisp) object, we select Read SDO Setting. Then, a window appears with a list of current SDO objects as shown in the following figure. Note that in this case, the list is empty because we have not added any objects yet.

SDO Setting

SDO Setting

In the window, there are Add and Remove button in order for us to add/remove SDO objects to/from the list. Because we want to add ModeOpDisp object, we click Add button and specify the object's information in the form as shown below.

SDO Object Specification

SDO Object Specification

Finally, click OK button and the new object will appear in the SDO list. On SDO Setting window, click OK button to finish setting process.

SDO Object Specification

SDO Object Specification

In order to add Mode Operation object, we select Write SDO Setting option in the slave's properties menu and repeat the previous steps.

Step 2 - Getting or Setting SDO objects' value in C++ code

This section is intended to explain the generated code snippet which is concerned with SDO communication. After finishing SDO configuration, we generate the C++ code project in Eclipse as explained in NRMKEcatTool's Overview. In the main.cpp, there are some lines of code as shown below.

....................................................................................

///////// SDO Access /////////
UINT8	ModeOpDisp[NUM_AXIS] = {0,0,0};

UINT8	ModeOp[NUM_AXIS] = {0,0,0};
//////////////////////////////

....................................................................................

int main(int argc, char **argv)
{

	....................................................................................

	while (1)
	{
		_systemInterface_EtherCAT_FASTECH_Ezi.readSDO(0x60610, ModeOpDisp);		
		
		_systemInterface_EtherCAT_FASTECH_Ezi.writeSDO(0x60600, ModeOp);		
		
		usleep(10);
	}

	....................................................................................

}

In the above code, the ModeOpDisp and ModeOp array are generated to store the value of respective objects of 3 Ezi slaves. Later, in the main() function, we call readSDO() and writeSDO() to update ModeOpDisp with new value from the slaves and send our ModeOp value to the slaves. Indeed, you can call readSDO() and writeSDO() anywhere in your code but you should be very careful because SDO communication is not guaranteed for real-time performance. Therefore, putting SDO communication in real-time threads can affect your real-time operations. As a result, we recommend you to access only C++ variables related to SDO value such as ModeOpDisp[] and ModeOp[] array.