1907 % --master |
1907 % --master |
1908 |
1908 |
1909 \subsection{Character Devices} |
1909 \subsection{Character Devices} |
1910 \label{sec:cdev} |
1910 \label{sec:cdev} |
1911 |
1911 |
1912 Each master instance will get a character device as a user-space interface. |
1912 Each master instance will get a character device as a userspace interface. |
1913 The devices are named \textit{/dev/EtherCATX}, where $X$ is the index of the |
1913 The devices are named \textit{/dev/EtherCATx}, where $x \in \{0 \ldots n\}$ is |
1914 master. |
1914 the index of the master. |
1915 |
1915 |
1916 % FIXME |
1916 \paragraph{Device Node Creation} The character device nodes are automatically |
1917 % udev |
1917 created, if the \lstinline+udev+ Package is installed. See section |
1918 % rights |
1918 \ref{sec:autonode} for how to install and configure it. |
1919 |
1919 |
1920 %------------------------------------------------------------------------------ |
1920 %------------------------------------------------------------------------------ |
1921 |
1921 |
1922 \subsection{Setting Alias Addresses} |
1922 \subsection{Setting Alias Addresses} |
1923 \label{sec:alias} % FIXME |
1923 \label{sec:alias} % FIXME |
2430 |
2430 |
2431 \begin{lstlisting} |
2431 \begin{lstlisting} |
2432 # `\textbf{/etc/init.d/ethercat start}` |
2432 # `\textbf{/etc/init.d/ethercat start}` |
2433 \end{lstlisting} |
2433 \end{lstlisting} |
2434 |
2434 |
2435 The operation of the master can be observed with the command |
2435 At this time, the operation of the master can be observed by viewing the |
2436 \lstinline+ethercat master+ or by viewing the Syslog\index{Syslog} |
2436 Syslog\index{Syslog} messages, which should look like the ones below. If |
2437 messages, which should look like the ones below. If EtherCAT slaves are |
2437 EtherCAT slaves are connected to the master's EtherCAT device, the activity |
2438 connected to the master's EtherCAT device, the activity indicators should |
2438 indicators should begin to flash. |
2439 begin to flash. |
|
2440 |
2439 |
2441 \begin{lstlisting}[numbers=left] |
2440 \begin{lstlisting}[numbers=left] |
2442 EtherCAT: Master driver `\masterversion` |
2441 EtherCAT: Master driver `\masterversion` |
2443 EtherCAT: 1 master waiting for devices. |
2442 EtherCAT: 1 master waiting for devices. |
2444 EtherCAT Intel(R) PRO/1000 Network Driver - version 6.0.60-k2 |
2443 EtherCAT Intel(R) PRO/1000 Network Driver - version 6.0.60-k2 |
2471 \item[\linenum{9} -- \linenum{16}] The master goes to idle phase, starts its |
2470 \item[\linenum{9} -- \linenum{16}] The master goes to idle phase, starts its |
2472 state machine and begins scanning the bus. |
2471 state machine and begins scanning the bus. |
2473 |
2472 |
2474 \end{description} |
2473 \end{description} |
2475 |
2474 |
|
2475 \section{Automatic Device Node Creation} |
|
2476 \label{sec:autonode} |
|
2477 |
|
2478 The \lstinline+ethercat+ command-line tool (see section~\ref{sec:ethercat}) |
|
2479 communicates with the master via a character device. The corresponding device |
|
2480 nodes are created automatically, if the udev daemon is running. |
|
2481 Note, that on some distributions, the \lstinline+udev+ package is not |
|
2482 installed by default. |
|
2483 |
|
2484 The device nodes will be created with mode \lstinline+0660+ and group |
|
2485 \lstinline+root+ by default. If you want to give normal users reading access, |
|
2486 create a udev rule file (for example |
|
2487 \textit{/etc/udev/rules.d/99-EtherCAT.rules} with the following content: |
|
2488 |
|
2489 \begin{lstlisting} |
|
2490 KERNEL=="EtherCAT[0-9]*", MODE="0664" |
|
2491 \end{lstlisting} |
|
2492 |
|
2493 After the udev rule file is created and the EtherCAT master is restarted with |
|
2494 \lstinline[breaklines=true]+/etc/init.d/ethercat restart+, the device node |
|
2495 will be automatically created with the desired rights: |
|
2496 |
|
2497 \begin{lstlisting} |
|
2498 # `\textbf{ls -l /dev/EtherCAT0}` |
|
2499 crw-rw-r-- 1 root root 252, 0 2008-09-03 16:19 /dev/EtherCAT0 |
|
2500 \end{lstlisting} |
|
2501 |
|
2502 Now, the \lstinline+ethercat+ tool can be used (see |
|
2503 section~\ref{sec:ethercat}) even as a non-root user. |
|
2504 |
2476 %------------------------------------------------------------------------------ |
2505 %------------------------------------------------------------------------------ |
2477 |
2506 |
2478 \begin{thebibliography}{99} |
2507 \begin{thebibliography}{99} |
2479 |
2508 |
2480 \bibitem{etherlab} Ingenieurgemeinschaft IgH: EtherLab -- Open Source Toolkit |
2509 \bibitem{etherlab} Ingenieurgemeinschaft IgH: EtherLab -- Open Source Toolkit |