From 45e5b4e6eb31e6efd03ea7c3935c4be1417f80ca Mon Sep 17 00:00:00 2001 From: Claudio Scordino Date: Wed, 27 Mar 2019 16:36:37 +0100 Subject: [PATCH] Tutorial: explain how to access CoE SDOs and PDOs Trivial patch reporting some useful information already provided as GitHub issues. --- doc/tutorial.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/tutorial.txt b/doc/tutorial.txt index 2eae817..f722aa8 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -152,7 +152,10 @@ handling is split into ec_send_processdata and ec_receive_processdata. \section application Application -IO data is accessed through the IOmap, the ec_slave struct keep pointers +\subsection iomap Accessing data through IOmap + +IOmap is the fastest mechanism for accessing slaves' IO data. +Using this mechanism, the ec_slave struct keeps pointers to the start byte in the IO map on slave level together with start bit within the start byte. This way we can bit mask IO on bit level even though SOEM has combined slave data to minimize the frame size to be sent. We'll use @@ -300,7 +303,27 @@ if( inOP && ((wkc < expectedWKC) || ec_group[currentgroup].docheckstate)) printf("OK : all slaves resumed OPERATIONAL.\n"); } \endcode + + +\subsection sdo Accessing SDOs and PDOs + +There are multiple ways a slave can communicate with the master. CANopen over +EtherCAT (CoE) is a (slow but flexible) asynchronous mechanism for transferring +data via mailboxes. + +SOEM provides the ecx_SDOread() and ecx_SDOwrite() functions for reading and +writing a CoE SDO (Service Data Object) given the corresponding index and +subindex. + +SOEM does not provide specific functions for accessing CoE PDOs (Process Data +Objects). On most slaves, however, it is possible to use the same functions +available for SDOs. In the seldom case in which the PDO object has been marked +in the CoE dictionary as "PDO only", only IOmap access is allowed. +Note that a list of the PDO mappings can be retrieved through the "slaveinfo + -map" command. +--------------------- + This tutorial is just one way of doing it. Enjoy and happy coding!