321 |
321 |
322 \paragraph{Process Data Image} |
322 \paragraph{Process Data Image} |
323 \index{Process data} |
323 \index{Process data} |
324 |
324 |
325 The slaves offer their inputs and outputs by presenting the master |
325 The slaves offer their inputs and outputs by presenting the master |
326 so-called ``Process Data Objects'' (PDOs\index{PDO}). The available |
326 so-called ``Process Data Objects'' (Pdos\index{Pdo}). The available |
327 PDOs can be determined by reading out the slave's TXPDO and RXPDO |
327 Pdos can be determined by reading out the slave's TXPDO and RXPDO |
328 E$^2$PROM categories. The realtime module can register the PDOs for |
328 E$^2$PROM categories. The realtime module can register the Pdos for |
329 data exchange during cyclic operation. The sum of all registered PDOs |
329 data exchange during cyclic operation. The sum of all registered Pdos |
330 defines the ``process data image'', which is exchanged via the |
330 defines the ``process data image'', which is exchanged via the |
331 ``Logical ReadWrite'' datagrams introduced |
331 ``Logical ReadWrite'' datagrams introduced |
332 in~\cite[section~5.4.2.4]{dlspec}. |
332 in~\cite[section~5.4.2.4]{dlspec}. |
333 |
333 |
334 \paragraph{Process Data Domains} |
334 \paragraph{Process Data Domains} |
335 \index{Domain} |
335 \index{Domain} |
336 |
336 |
337 The process data image can be easily managed by creating co-called |
337 The process data image can be easily managed by creating co-called |
338 ``domains'', which group PDOs and allocate the datagrams needed to |
338 ``domains'', which group Pdos and allocate the datagrams needed to |
339 exchange them. Domains are mandatory for process data exchange, so |
339 exchange them. Domains are mandatory for process data exchange, so |
340 there has to be at least one. They were introduced for the following |
340 there has to be at least one. They were introduced for the following |
341 reasons: |
341 reasons: |
342 |
342 |
343 \begin{itemize} |
343 \begin{itemize} |
347 EtherCAT datagram header and EtherCAT datagram footer: $1500 - 2 - |
347 EtherCAT datagram header and EtherCAT datagram footer: $1500 - 2 - |
348 12 - 2 = 1484$ octets. If the size of the process data image exceeds |
348 12 - 2 = 1484$ octets. If the size of the process data image exceeds |
349 this limit, multiple frames have to be sent, and the image has to be |
349 this limit, multiple frames have to be sent, and the image has to be |
350 partitioned for the use of multiple datagrams. A domain manages this |
350 partitioned for the use of multiple datagrams. A domain manages this |
351 automatically. |
351 automatically. |
352 \item Not every PDO has to be exchanged with the same frequency: The |
352 \item Not every Pdo has to be exchanged with the same frequency: The |
353 values of PDOs can vary slowly over time (for example temperature |
353 values of Pdos can vary slowly over time (for example temperature |
354 values), so exchanging them with a high frequency would just waste |
354 values), so exchanging them with a high frequency would just waste |
355 bus bandwidth. For this reason, multiple domains can be created, to |
355 bus bandwidth. For this reason, multiple domains can be created, to |
356 group different PDOs and so allow separate exchange. |
356 group different Pdos and so allow separate exchange. |
357 \end{itemize} |
357 \end{itemize} |
358 |
358 |
359 There is no upper limit for the number of domains, but each domain |
359 There is no upper limit for the number of domains, but each domain |
360 occupies one FMMU in each slave involved, so the maximum number of |
360 occupies one FMMU in each slave involved, so the maximum number of |
361 domains is also limited by the slaves' capabilities. |
361 domains is also limited by the slaves' capabilities. |
362 |
362 |
363 \paragraph{FMMU Configuration} |
363 \paragraph{FMMU Configuration} |
364 \index{FMMU!Configuration} |
364 \index{FMMU!Configuration} |
365 |
365 |
366 A realtime module can register PDOs for process data exchange. Every |
366 A realtime module can register Pdos for process data exchange. Every |
367 PDO is part of a memory area in the slave's physical memory, that is |
367 Pdo is part of a memory area in the slave's physical memory, that is |
368 protected by a sync manager \cite[section~6.7]{dlspec} for |
368 protected by a sync manager \cite[section~6.7]{dlspec} for |
369 synchronized access. In order to make a sync manager react on a |
369 synchronized access. In order to make a sync manager react on a |
370 datagram accessing its memory, it is necessary to access the last byte |
370 datagram accessing its memory, it is necessary to access the last byte |
371 covered by the sync manager. Otherwise the sync manager will not react |
371 covered by the sync manager. Otherwise the sync manager will not react |
372 on the datagram and no data will be exchanged. That is why the whole |
372 on the datagram and no data will be exchanged. That is why the whole |
373 synchronized memory area has to be included into the process data |
373 synchronized memory area has to be included into the process data |
374 image: For example, if a certain PDO of a slave is registered for |
374 image: For example, if a certain Pdo of a slave is registered for |
375 exchange with a certain domain, one FMMU will be configured to map the |
375 exchange with a certain domain, one FMMU will be configured to map the |
376 complete sync-manager-protected memory, the PDO resides in. If a |
376 complete sync-manager-protected memory, the Pdo resides in. If a |
377 second PDO of the same slave is registered for process data exchange |
377 second Pdo of the same slave is registered for process data exchange |
378 within the same domain, and this PDO resides in the same |
378 within the same domain, and this Pdo resides in the same |
379 sync-manager-protected memory as the first PDO, the FMMU configuration |
379 sync-manager-protected memory as the first Pdo, the FMMU configuration |
380 is not touched, because the appropriate memory is already part of the |
380 is not touched, because the appropriate memory is already part of the |
381 domain's process data image. If the second PDO belongs to another |
381 domain's process data image. If the second Pdo belongs to another |
382 sync-manager-protected area, this complete area is also included into |
382 sync-manager-protected area, this complete area is also included into |
383 the domains process data image. See figure~\ref{fig:fmmus} for an |
383 the domains process data image. See figure~\ref{fig:fmmus} for an |
384 overview, how FMMU's are configured to map physical memory to logical |
384 overview, how FMMU's are configured to map physical memory to logical |
385 process data images. |
385 process data images. |
386 |
386 |
392 \end{figure} |
392 \end{figure} |
393 |
393 |
394 \paragraph{Process Data Pointers} |
394 \paragraph{Process Data Pointers} |
395 |
395 |
396 The figure also demonstrates the way, the realtime module can access the |
396 The figure also demonstrates the way, the realtime module can access the |
397 exchanged process data: At PDO registration, the realtime module has |
397 exchanged process data: At Pdo registration, the realtime module has |
398 to provide the address of a process data pointer. Upon calculation of |
398 to provide the address of a process data pointer. Upon calculation of |
399 the domain image and allocation of process data memory, this pointer |
399 the domain image and allocation of process data memory, this pointer |
400 is redirected to the appropriate location inside the domain's process |
400 is redirected to the appropriate location inside the domain's process |
401 data memory and can later be easily dereferenced by the module code. |
401 data memory and can later be easily dereferenced by the module code. |
402 |
402 |
452 |
452 |
453 Operation mode is entered when a realtime module requests the master. |
453 Operation mode is entered when a realtime module requests the master. |
454 The idle mode is stopped and the bus is scanned by getting the number |
454 The idle mode is stopped and the bus is scanned by getting the number |
455 of slaves and executing the ``Slave scan state machine'' (see |
455 of slaves and executing the ``Slave scan state machine'' (see |
456 section~\ref{sec:fsm-scan}) for each slave. The master is now ready to |
456 section~\ref{sec:fsm-scan}) for each slave. The master is now ready to |
457 create domains and accept PDO registrations and slave configurations. |
457 create domains and accept Pdo registrations and slave configurations. |
458 After that, cyclic communication can be done by the realtime module. |
458 After that, cyclic communication can be done by the realtime module. |
459 |
459 |
460 \paragraph{Master Phases} |
460 \paragraph{Master Phases} |
461 |
461 |
462 Every realtime module should use the master in three phases: |
462 Every realtime module should use the master in three phases: |
463 |
463 |
464 \begin{enumerate} |
464 \begin{enumerate} |
465 \item \textit{Startup} - The master is requested and the bus is |
465 \item \textit{Startup} - The master is requested and the bus is |
466 validated. Domains are created and PDOs are registered. Slave |
466 validated. Domains are created and Pdos are registered. Slave |
467 configurations are applied. |
467 configurations are applied. |
468 \item \textit{Operation} - Cyclic code is run, process data is |
468 \item \textit{Operation} - Cyclic code is run, process data is |
469 exchanged and the master state machine is executed. |
469 exchanged and the master state machine is executed. |
470 \item \textit{Shutdown} - Cyclic code is stopped and the master |
470 \item \textit{Shutdown} - Cyclic code is stopped and the master |
471 is released. |
471 is released. |
1506 \item[dl\_*] These fields store information of the ``DL Status'' |
1506 \item[dl\_*] These fields store information of the ``DL Status'' |
1507 attribute, for example states of the the communication ports. |
1507 attribute, for example states of the the communication ports. |
1508 \item[sii\_*] These attributes contain values from the ``Slave |
1508 \item[sii\_*] These attributes contain values from the ``Slave |
1509 Information Interface'' \cite[section~6.4]{dlspec}, mostly identity |
1509 Information Interface'' \cite[section~6.4]{dlspec}, mostly identity |
1510 and mailbox information, but also the list of sync manager |
1510 and mailbox information, but also the list of sync manager |
1511 configurations and PDOs. |
1511 configurations and Pdos. |
1512 \item[registered] This flag is set, if one or more PDOs of the slave |
1512 \item[registered] This flag is set, if one or more Pdos of the slave |
1513 have been registered for process data exchange. Otherwise a warning |
1513 have been registered for process data exchange. Otherwise a warning |
1514 is output, because the slave is unused. |
1514 is output, because the slave is unused. |
1515 \item[fmmus] Is an array of FMMU configurations, that have to be |
1515 \item[fmmus] Is an array of FMMU configurations, that have to be |
1516 applied to the slave. |
1516 applied to the slave. |
1517 \item[fmmu\_count] contains number of FMMUs used. |
1517 \item[fmmu\_count] contains number of FMMUs used. |
1528 to indicate, that a state transisition has failed and should not be |
1528 to indicate, that a state transisition has failed and should not be |
1529 tried again until an external event happens. |
1529 tried again until an external event happens. |
1530 \item[online] This flag contains the online state of the slave (i.~e. |
1530 \item[online] This flag contains the online state of the slave (i.~e. |
1531 if it currently responds to the masters commands). Changes of the |
1531 if it currently responds to the masters commands). Changes of the |
1532 online state are always reported. |
1532 online state are always reported. |
1533 \item[varsize\_fields] is only suitable for slaves that provide PDOs |
1533 \item[varsize\_fields] is only suitable for slaves that provide Pdos |
1534 of variable size (like slaves that manage a sub-fieldbus) and |
1534 of variable size (like slaves that manage a sub-fieldbus) and |
1535 contains information about what size this fields actually should |
1535 contains information about what size this fields actually should |
1536 have. |
1536 have. |
1537 \end{description} |
1537 \end{description} |
1538 |
1538 |
1547 E$^2$PROM category contents. |
1547 E$^2$PROM category contents. |
1548 \item[ec\_slave\_locate\_string()] extracts a string out of a STRING |
1548 \item[ec\_slave\_locate\_string()] extracts a string out of a STRING |
1549 category and allocates string memory. |
1549 category and allocates string memory. |
1550 \item[ec\_slave\_calc\_sync\_size()] calculates the size of sync |
1550 \item[ec\_slave\_calc\_sync\_size()] calculates the size of sync |
1551 manager contents, because they can be variable due to variable-sized |
1551 manager contents, because they can be variable due to variable-sized |
1552 PDOs. |
1552 Pdos. |
1553 \item[ec\_slave\_info()] This method prints all slave information into |
1553 \item[ec\_slave\_info()] This method prints all slave information into |
1554 a buffer for Sysfs reading. |
1554 a buffer for Sysfs reading. |
1555 \item[ec\_slave\_mbox\_*()] These functions prepare datagrams for |
1555 \item[ec\_slave\_mbox\_*()] These functions prepare datagrams for |
1556 mailbox communication, or process mailbox responses, respectively. |
1556 mailbox communication, or process mailbox responses, respectively. |
1557 \end{description} |
1557 \end{description} |
1565 \end{description} |
1565 \end{description} |
1566 |
1566 |
1567 \paragraph{Slave Methods (Realtime Interface)} |
1567 \paragraph{Slave Methods (Realtime Interface)} |
1568 |
1568 |
1569 \begin{description} |
1569 \begin{description} |
1570 \item[ecrt\_slave\_conf\_sdo*()] These methods accept SDO |
1570 \item[ecrt\_slave\_conf\_sdo*()] These methods accept Sdo |
1571 configurations, that are applied on slave activation (i.~e. |
1571 configurations, that are applied on slave activation (i.~e. |
1572 everytime the slave is configured). The methods differ only in the |
1572 everytime the slave is configured). The methods differ only in the |
1573 data size of the SDO (8, 16 or 32 bit). |
1573 data size of the Sdo (8, 16 or 32 bit). |
1574 \item[ecrt\_slave\_pdo\_size()] This method specifies the size of a |
1574 \item[ecrt\_slave\_pdo\_size()] This method specifies the size of a |
1575 variable-sized PDO. |
1575 variable-sized Pdo. |
1576 \end{description} |
1576 \end{description} |
1577 |
1577 |
1578 %------------------------------------------------------------------------------ |
1578 %------------------------------------------------------------------------------ |
1579 |
1579 |
1580 \subsubsection{The Device Class} |
1580 \subsubsection{The Device Class} |
1776 section~\ref{sec:class-datagram}). |
1776 section~\ref{sec:class-datagram}). |
1777 \item[base\_address] This attribute stores the logical offset, to |
1777 \item[base\_address] This attribute stores the logical offset, to |
1778 which the domain's process data are mapped. |
1778 which the domain's process data are mapped. |
1779 \item[response\_count] The sum of the datagrams' working counters at |
1779 \item[response\_count] The sum of the datagrams' working counters at |
1780 the last process data exchange. Changes are always reported. |
1780 the last process data exchange. Changes are always reported. |
1781 \item[data\_regs] The (linked) list of PDO registrations. The realtime |
1781 \item[data\_regs] The (linked) list of Pdo registrations. The realtime |
1782 module requests the exchange of certain PDOs and supplies the |
1782 module requests the exchange of certain Pdos and supplies the |
1783 address of process data pointers, that will later point to the |
1783 address of process data pointers, that will later point to the |
1784 respective locations in the process data image. These ``data |
1784 respective locations in the process data image. These ``data |
1785 registrations'' are saved in the \textit{data\_regs} list. |
1785 registrations'' are saved in the \textit{data\_regs} list. |
1786 \item[working\_counter\_changes] This field stores the number of |
1786 \item[working\_counter\_changes] This field stores the number of |
1787 working counter changes since the last notification. This helps to |
1787 working counter changes since the last notification. This helps to |
1802 \end{description} |
1802 \end{description} |
1803 |
1803 |
1804 \paragraph{Private Domain Methods} |
1804 \paragraph{Private Domain Methods} |
1805 |
1805 |
1806 \begin{description} |
1806 \begin{description} |
1807 \item[ec\_domain\_reg\_pdo\_entry()] This method is used to do a PDO |
1807 \item[ec\_domain\_reg\_pdo\_entry()] This method is used to do a Pdo |
1808 registration. It finds the appropriate sync manager covering the PDO |
1808 registration. It finds the appropriate sync manager covering the Pdo |
1809 data, calculates its offset in the sync-manager-protected memory and |
1809 data, calculates its offset in the sync-manager-protected memory and |
1810 prepares the FMMU configurations for the related slave. Then the PDO |
1810 prepares the FMMU configurations for the related slave. Then the Pdo |
1811 registration is appended to the list. |
1811 registration is appended to the list. |
1812 \item[ec\_domain\_clear\_data\_regs()] Clearing all process data |
1812 \item[ec\_domain\_clear\_data\_regs()] Clearing all process data |
1813 registrations is needed in serveral places and therefore has been |
1813 registrations is needed in serveral places and therefore has been |
1814 sourced out to an own method. |
1814 sourced out to an own method. |
1815 \item[ec\_domain\_add\_datagram()] This methods allocates a datagram |
1815 \item[ec\_domain\_add\_datagram()] This methods allocates a datagram |
1875 state change state machine. |
1875 state change state machine. |
1876 \item[change\_start] A timestamp attribute to detect a timeout while |
1876 \item[change\_start] A timestamp attribute to detect a timeout while |
1877 changing slave states. |
1877 changing slave states. |
1878 \item[coe\_state] This function pointer stores the current state of |
1878 \item[coe\_state] This function pointer stores the current state of |
1879 the CoE state machines. |
1879 the CoE state machines. |
1880 \item[sdodata] This is an SDO data object that stores information |
1880 \item[sdodata] This is an Sdo data object that stores information |
1881 about the current SDO to write. |
1881 about the current Sdo to write. |
1882 \item[coe\_start] A timestamp attribute to detect timeouts during CoE |
1882 \item[coe\_start] A timestamp attribute to detect timeouts during CoE |
1883 configuration. |
1883 configuration. |
1884 \end{description} |
1884 \end{description} |
1885 |
1885 |
1886 \paragraph{Public FSM Methods} |
1886 \paragraph{Public FSM Methods} |
2261 int ecrt_domain_register_pdo_list(ec_domain_t *domain, |
2261 int ecrt_domain_register_pdo_list(ec_domain_t *domain, |
2262 const ec_pdo_reg_t *pdos); |
2262 const ec_pdo_reg_t *pdos); |
2263 \end{lstlisting} |
2263 \end{lstlisting} |
2264 |
2264 |
2265 The \textit{ecrt\_domain\_register\_pdo()} method registers a certain |
2265 The \textit{ecrt\_domain\_register\_pdo()} method registers a certain |
2266 PDO as part of the domain and takes the address of the process data |
2266 Pdo as part of the domain and takes the address of the process data |
2267 pointer. This pointer will be set on master activation and then can be |
2267 pointer. This pointer will be set on master activation and then can be |
2268 parameter to the \textit{EC\_READ\_*} and \textit{EC\_WRITE\_*} macros |
2268 parameter to the \textit{EC\_READ\_*} and \textit{EC\_WRITE\_*} macros |
2269 described below. |
2269 described below. |
2270 |
2270 |
2271 A perhaps easier way to register multiple PDOs at the same time is to |
2271 A perhaps easier way to register multiple Pdos at the same time is to |
2272 fill an array of \textit{ec\_pdo\_reg\_t} and hand it to the |
2272 fill an array of \textit{ec\_pdo\_reg\_t} and hand it to the |
2273 \textit{ecrt\_domain\_register\_pdo\_list()} method. Attention: This |
2273 \textit{ecrt\_domain\_register\_pdo\_list()} method. Attention: This |
2274 array has to be terminated by an empty structure (\textit{\{\}})! |
2274 array has to be terminated by an empty structure (\textit{\{\}})! |
2275 |
2275 |
2276 \paragraph{Evaluating Domain Data} |
2276 \paragraph{Evaluating Domain Data} |
2317 uint8_t sdo_subindex, |
2317 uint8_t sdo_subindex, |
2318 uint32_t value); |
2318 uint32_t value); |
2319 \end{lstlisting} |
2319 \end{lstlisting} |
2320 |
2320 |
2321 The \textit{ecrt\_slave\_conf\_sdo*()} methods prepare the |
2321 The \textit{ecrt\_slave\_conf\_sdo*()} methods prepare the |
2322 configuration of a certain SDO. The index and subindex of the SDO, and |
2322 configuration of a certain Sdo. The index and subindex of the Sdo, and |
2323 the value have to be specified. The configuration is done each time, |
2323 the value have to be specified. The configuration is done each time, |
2324 the slave is reconfigured. The methods only differ in the SDO's data |
2324 the slave is reconfigured. The methods only differ in the Sdo's data |
2325 type. If the configuration could be prepared, zero is returned. If an |
2325 type. If the configuration could be prepared, zero is returned. If an |
2326 error occured, non-zero is returned. |
2326 error occured, non-zero is returned. |
2327 |
2327 |
2328 \paragraph{Variable-sized PDOs} |
2328 \paragraph{Variable-sized Pdos} |
2329 |
2329 |
2330 For specifying the size of variable-sized PDOs, the following method |
2330 For specifying the size of variable-sized Pdos, the following method |
2331 can be used: |
2331 can be used: |
2332 |
2332 |
2333 \begin{lstlisting}[language=C] |
2333 \begin{lstlisting}[language=C] |
2334 int ecrt_slave_pdo_size(ec_slave_t *slave, |
2334 int ecrt_slave_pdo_size(ec_slave_t *slave, |
2335 const char *pdo_name, |
2335 const char *pdo_name, |
2336 size_t size); |
2336 size_t size); |
2337 \end{lstlisting} |
2337 \end{lstlisting} |
2338 |
2338 |
2339 The \textit{ecrt\_slave\_pdo\_size()} method takes the name of the PDO |
2339 The \textit{ecrt\_slave\_pdo\_size()} method takes the name of the Pdo |
2340 and the size. It returns zero on success, otherwise non-zero. |
2340 and the size. It returns zero on success, otherwise non-zero. |
2341 |
2341 |
2342 \subsubsection{Process Data Access} |
2342 \subsubsection{Process Data Access} |
2343 \label{sec:macros} |
2343 \label{sec:macros} |
2344 |
2344 |
2368 There are macros for bitwise access (\textit{EC\_READ\_BIT()}, |
2368 There are macros for bitwise access (\textit{EC\_READ\_BIT()}, |
2369 \textit{EC\_WRITE\_BIT()}), and bytewise access |
2369 \textit{EC\_WRITE\_BIT()}), and bytewise access |
2370 (\textit{EC\_READ\_*()}, \textit{EC\_WRITE\_*()}). The bytewise macros |
2370 (\textit{EC\_READ\_*()}, \textit{EC\_WRITE\_*()}). The bytewise macros |
2371 carry the data type in their name. Example: \textit{EC\_WRITE\_S16()} |
2371 carry the data type in their name. Example: \textit{EC\_WRITE\_S16()} |
2372 writes a 16 bit signed value to EtherCAT data. The \textit{DATA} |
2372 writes a 16 bit signed value to EtherCAT data. The \textit{DATA} |
2373 parameter is supposed to be a process data pointer, as provided at PDO |
2373 parameter is supposed to be a process data pointer, as provided at Pdo |
2374 registration. |
2374 registration. |
2375 |
2375 |
2376 The macros use the kernel's endianess conversion macros, that are |
2376 The macros use the kernel's endianess conversion macros, that are |
2377 preprocessed to empty macros in case of equal endianess. This is the |
2377 preprocessed to empty macros in case of equal endianess. This is the |
2378 definition for the \textit{EC\_\-READ\_\-U16()} macro: |
2378 definition for the \textit{EC\_\-READ\_\-U16()} macro: |
3185 |
3185 |
3186 If the PREOP state was the target state, the configuration is |
3186 If the PREOP state was the target state, the configuration is |
3187 finished. $\rightarrow$~END |
3187 finished. $\rightarrow$~END |
3188 |
3188 |
3189 If the slave supports no FMMUs, the FMMU configuration can be |
3189 If the slave supports no FMMUs, the FMMU configuration can be |
3190 skipped. If the slave has SDOs to configure, it is begun with |
3190 skipped. If the slave has Sdos to configure, it is begun with |
3191 sending the first SDO. $\rightarrow$~SDO\_CONF |
3191 sending the first Sdo. $\rightarrow$~SDO\_CONF |
3192 |
3192 |
3193 If no SDO configurations are provided, the slave can now directly be |
3193 If no Sdo configurations are provided, the slave can now directly be |
3194 brought into the SAFEOP state and the state change state machine is |
3194 brought into the SAFEOP state and the state change state machine is |
3195 started again. $\rightarrow$~SAFEOP |
3195 started again. $\rightarrow$~SAFEOP |
3196 |
3196 |
3197 Otherwise, all supported FMMUs are configured according to the PDOs |
3197 Otherwise, all supported FMMUs are configured according to the Pdos |
3198 requested via the master's realtime interface. The appropriate |
3198 requested via the master's realtime interface. The appropriate |
3199 datagram is issued. $\rightarrow$~FMMU |
3199 datagram is issued. $\rightarrow$~FMMU |
3200 |
3200 |
3201 \item[FMMU] The FMMU configuration datagram was accepted. If the slave |
3201 \item[FMMU] The FMMU configuration datagram was accepted. If the slave |
3202 has SDOs to configure, it is begun with sending the first SDO. |
3202 has Sdos to configure, it is begun with sending the first Sdo. |
3203 $\rightarrow$~SDO\_CONF |
3203 $\rightarrow$~SDO\_CONF |
3204 |
3204 |
3205 Otherwise, the slave can now be brought into the SAFEOP state. The |
3205 Otherwise, the slave can now be brought into the SAFEOP state. The |
3206 state change state machine is started. |
3206 state change state machine is started. |
3207 $\rightarrow$~SAFEOP |
3207 $\rightarrow$~SAFEOP |
3208 |
3208 |
3209 \item[SDO\_CONF] The CoE state machine is executed until termination. |
3209 \item[SDO\_CONF] The CoE state machine is executed until termination. |
3210 $\rightarrow$~SDO\_CONF |
3210 $\rightarrow$~SDO\_CONF |
3211 |
3211 |
3212 If another SDO has to be configured, a new SDO download sequence is |
3212 If another Sdo has to be configured, a new Sdo download sequence is |
3213 begun. $\rightarrow$~SDO\_CONF |
3213 begun. $\rightarrow$~SDO\_CONF |
3214 |
3214 |
3215 Otherwise, the slave can now be brought into the SAFEOP state. The |
3215 Otherwise, the slave can now be brought into the SAFEOP state. The |
3216 state change state machine is started. |
3216 state change state machine is started. |
3217 $\rightarrow$~SAFEOP |
3217 $\rightarrow$~SAFEOP |
3614 \label{sec:coeimp} |
3614 \label{sec:coeimp} |
3615 \index{CoE} |
3615 \index{CoE} |
3616 |
3616 |
3617 The CANopen-over-EtherCAT protocol \cite[section~5.6]{alspec} is used |
3617 The CANopen-over-EtherCAT protocol \cite[section~5.6]{alspec} is used |
3618 to configure slaves on application level. Each CoE-capable slave |
3618 to configure slaves on application level. Each CoE-capable slave |
3619 provides a list of SDOs for this reason. |
3619 provides a list of Sdos for this reason. |
3620 |
3620 |
3621 \paragraph{SDO Configuration} |
3621 \paragraph{Sdo Configuration} |
3622 |
3622 |
3623 The SDO configurations have to be provided by the realtime module. |
3623 The Sdo configurations have to be provided by the realtime module. |
3624 This is done via the \textit{ecrt\_slave\_conf\_sdo*()} methods (see |
3624 This is done via the \textit{ecrt\_slave\_conf\_sdo*()} methods (see |
3625 section~\ref{sec:ecrt-slave}), that are part of the realtime |
3625 section~\ref{sec:ecrt-slave}), that are part of the realtime |
3626 interface. The slave stores the SDO configurations in a linked list, |
3626 interface. The slave stores the Sdo configurations in a linked list, |
3627 but does not apply them at once. |
3627 but does not apply them at once. |
3628 |
3628 |
3629 \paragraph{SDO Download State Machine} |
3629 \paragraph{Sdo Download State Machine} |
3630 |
3630 |
3631 The best time to apply SDO configurations is during the slave's PREOP |
3631 The best time to apply Sdo configurations is during the slave's PREOP |
3632 state, because mailbox communication is already possible and slave's |
3632 state, because mailbox communication is already possible and slave's |
3633 application will start with updating input data in the succeeding |
3633 application will start with updating input data in the succeeding |
3634 SAFEOP state. Therefore the SDO configuration has to be part of the |
3634 SAFEOP state. Therefore the Sdo configuration has to be part of the |
3635 slave configuration state machine (see section~\ref{sec:fsm-conf}): It |
3635 slave configuration state machine (see section~\ref{sec:fsm-conf}): It |
3636 is implemented via an SDO download state machine, that is executed |
3636 is implemented via an Sdo download state machine, that is executed |
3637 just before entering the slave's SAFEOP state. In this way, it is |
3637 just before entering the slave's SAFEOP state. In this way, it is |
3638 guaranteed that the SDO configurations are applied each time, the |
3638 guaranteed that the Sdo configurations are applied each time, the |
3639 slave is reconfigured. |
3639 slave is reconfigured. |
3640 |
3640 |
3641 The transition diagram of the SDO Download state machine can be seen |
3641 The transition diagram of the Sdo Download state machine can be seen |
3642 in figure~\ref{fig:fsm-coedown}. |
3642 in figure~\ref{fig:fsm-coedown}. |
3643 |
3643 |
3644 \begin{figure}[htbp] |
3644 \begin{figure}[htbp] |
3645 \centering |
3645 \centering |
3646 \includegraphics[width=.9\textwidth]{images/fsm-coedown} |
3646 \includegraphics[width=.9\textwidth]{images/fsm-coedown} |
3648 \label{fig:fsm-coedown} |
3648 \label{fig:fsm-coedown} |
3649 \end{figure} |
3649 \end{figure} |
3650 |
3650 |
3651 \begin{description} |
3651 \begin{description} |
3652 \item[START] The beginning state of the CoE download state |
3652 \item[START] The beginning state of the CoE download state |
3653 machine. The ``SDO Download Normal Request'' mailbox command is |
3653 machine. The ``Sdo Download Normal Request'' mailbox command is |
3654 sent. $\rightarrow$~REQUEST |
3654 sent. $\rightarrow$~REQUEST |
3655 |
3655 |
3656 \item[REQUEST] It is checked, if the CoE download request has been |
3656 \item[REQUEST] It is checked, if the CoE download request has been |
3657 received by the slave. After that, a mailbox check command is issued |
3657 received by the slave. After that, a mailbox check command is issued |
3658 and a timer is started. $\rightarrow$~CHECK |
3658 and a timer is started. $\rightarrow$~CHECK |
3659 |
3659 |
3660 \item[CHECK] If no mailbox data is available, the timer is checked. |
3660 \item[CHECK] If no mailbox data is available, the timer is checked. |
3661 \begin{itemize} |
3661 \begin{itemize} |
3662 \item If it timed out, the SDO download is aborted. |
3662 \item If it timed out, the Sdo download is aborted. |
3663 $\rightarrow$~ERROR |
3663 $\rightarrow$~ERROR |
3664 \item Otherwise, the mailbox is queried again. |
3664 \item Otherwise, the mailbox is queried again. |
3665 $\rightarrow$~CHECK |
3665 $\rightarrow$~CHECK |
3666 \end{itemize} |
3666 \end{itemize} |
3667 |
3667 |
3668 If the mailbox contains new data, the response is fetched. |
3668 If the mailbox contains new data, the response is fetched. |
3669 $\rightarrow$~RESPONSE |
3669 $\rightarrow$~RESPONSE |
3670 |
3670 |
3671 \item[RESPONSE] If the mailbox response could not be fetched, the data |
3671 \item[RESPONSE] If the mailbox response could not be fetched, the data |
3672 is invalid, the wrong protocol was received, or a ``Abort SDO |
3672 is invalid, the wrong protocol was received, or a ``Abort Sdo |
3673 Transfer Request'' was received, the SDO download is aborted. |
3673 Transfer Request'' was received, the Sdo download is aborted. |
3674 $\rightarrow$~ERROR |
3674 $\rightarrow$~ERROR |
3675 |
3675 |
3676 If a ``SDO Download Normal Response'' acknowledgement was received, |
3676 If a ``Sdo Download Normal Response'' acknowledgement was received, |
3677 the SDO download was successful. $\rightarrow$~END |
3677 the Sdo download was successful. $\rightarrow$~END |
3678 |
3678 |
3679 \item[END] The SDO download was successful. |
3679 \item[END] The Sdo download was successful. |
3680 |
3680 |
3681 \item[ERROR] The SDO download was aborted due to an error. |
3681 \item[ERROR] The Sdo download was aborted due to an error. |
3682 |
3682 |
3683 \end{description} |
3683 \end{description} |
3684 |
3684 |
3685 %------------------------------------------------------------------------------ |
3685 %------------------------------------------------------------------------------ |
3686 |
3686 |
3871 0: 0x1800, length 246, control 0x26, enable |
3871 0: 0x1800, length 246, control 0x26, enable |
3872 1: 0x18F6, length 246, control 0x22, enable |
3872 1: 0x18F6, length 246, control 0x22, enable |
3873 2: 0x1000, length 0, control 0x24, enable |
3873 2: 0x1000, length 0, control 0x24, enable |
3874 3: 0x1100, length 0, control 0x20, enable |
3874 3: 0x1100, length 0, control 0x20, enable |
3875 |
3875 |
3876 PDOs: |
3876 Pdos: |
3877 RXPDO "Channel 1" (0x1600), Sync-Manager 2 |
3877 RXPDO "Channel 1" (0x1600), Sync-Manager 2 |
3878 "Output" 0x6411:1, 16 bit |
3878 "Output" 0x6411:1, 16 bit |
3879 RXPDO "Channel 2" (0x1601), Sync-Manager 2 |
3879 RXPDO "Channel 2" (0x1601), Sync-Manager 2 |
3880 "Output" 0x6411:2, 16 bit |
3880 "Output" 0x6411:2, 16 bit |
3881 \end{lstlisting} |
3881 \end{lstlisting} |
4490 will later point to the \underline{r}aw process data values inside |
4490 will later point to the \underline{r}aw process data values inside |
4491 the domain memory. The addresses they point to will be set during a |
4491 the domain memory. The addresses they point to will be set during a |
4492 call to \textit{ec\_\-master\_\-activate()}, that will create the |
4492 call to \textit{ec\_\-master\_\-activate()}, that will create the |
4493 domain memory and configure the mapped process data image. |
4493 domain memory and configure the mapped process data image. |
4494 \item[\normalfont\textcircled{\tiny 8} -- \textcircled{\tiny 12}] The |
4494 \item[\normalfont\textcircled{\tiny 8} -- \textcircled{\tiny 12}] The |
4495 configuration of the mapping of certain PDOs in a domain can easily |
4495 configuration of the mapping of certain Pdos in a domain can easily |
4496 be done with the help of an initialization array of the |
4496 be done with the help of an initialization array of the |
4497 \textit{ec\_pdo\_reg\_t} type, defined as part of the realtime |
4497 \textit{ec\_pdo\_reg\_t} type, defined as part of the realtime |
4498 interface. Each record must contain the ASCII bus-address of the |
4498 interface. Each record must contain the ASCII bus-address of the |
4499 slave (see section~\ref{sec:addr}), the slave's vendor ID and |
4499 slave (see section~\ref{sec:addr}), the slave's vendor ID and |
4500 product code, and the index and subindex of the PDO to map (these |
4500 product code, and the index and subindex of the Pdo to map (these |
4501 four fields can be specified in junction, by using one of the |
4501 four fields can be specified in junction, by using one of the |
4502 defines out of the \textit{include/ecdb.h} header). The last field |
4502 defines out of the \textit{include/ecdb.h} header). The last field |
4503 has to be the address of the process data pointer, so it can later |
4503 has to be the address of the process data pointer, so it can later |
4504 be redirected appropriately. Attention: The initialization array |
4504 be redirected appropriately. Attention: The initialization array |
4505 must end with an empty record (\textit{\{\}})! |
4505 must end with an empty record (\textit{\{\}})! |
4554 \item[\normalfont\textcircled{\tiny 7}] In order to exchange process |
4554 \item[\normalfont\textcircled{\tiny 7}] In order to exchange process |
4555 data, a domain object has to be created. The |
4555 data, a domain object has to be created. The |
4556 \textit{ecrt\_\-master\_\-create\_domain()} function also returns a |
4556 \textit{ecrt\_\-master\_\-create\_domain()} function also returns a |
4557 pointer to the created domain, or \textit{NULL} in error case. |
4557 pointer to the created domain, or \textit{NULL} in error case. |
4558 \item[\normalfont\textcircled{\tiny 11}] The registration of domain |
4558 \item[\normalfont\textcircled{\tiny 11}] The registration of domain |
4559 PDOs with an initialization array results in a single function call. |
4559 Pdos with an initialization array results in a single function call. |
4560 Alternatively the data fields could be registered with individual |
4560 Alternatively the data fields could be registered with individual |
4561 calls of \textit{ecrt\_domain\_register\_pdo()}. |
4561 calls of \textit{ecrt\_domain\_register\_pdo()}. |
4562 \item[\normalfont\textcircled{\tiny 16}] After the configuration of |
4562 \item[\normalfont\textcircled{\tiny 16}] After the configuration of |
4563 process data mapping, the master can be activated for cyclic |
4563 process data mapping, the master can be activated for cyclic |
4564 operation. This will configure all slaves and bring them into |
4564 operation. This will configure all slaves and bring them into |