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 |
2442 |
2442 |
2443 \begin{lstlisting} |
2443 \begin{lstlisting} |
2444 # `\textbf{/etc/init.d/ethercat start}` |
2444 # `\textbf{/etc/init.d/ethercat start}` |
2445 \end{lstlisting} |
2445 \end{lstlisting} |
2446 |
2446 |
2447 The operation of the master can be observed with the command |
2447 At this time, the operation of the master can be observed by viewing the |
2448 \lstinline+ethercat master+ or by viewing the Syslog\index{Syslog} |
2448 Syslog\index{Syslog} messages, which should look like the ones below. If |
2449 messages, which should look like the ones below. If EtherCAT slaves are |
2449 EtherCAT slaves are connected to the master's EtherCAT device, the activity |
2450 connected to the master's EtherCAT device, the activity indicators should |
2450 indicators should begin to flash. |
2451 begin to flash. |
|
2452 |
2451 |
2453 \begin{lstlisting}[numbers=left] |
2452 \begin{lstlisting}[numbers=left] |
2454 EtherCAT: Master driver `\masterversion` |
2453 EtherCAT: Master driver `\masterversion` |
2455 EtherCAT: 1 master waiting for devices. |
2454 EtherCAT: 1 master waiting for devices. |
2456 EtherCAT Intel(R) PRO/1000 Network Driver - version 6.0.60-k2 |
2455 EtherCAT Intel(R) PRO/1000 Network Driver - version 6.0.60-k2 |
2483 \item[\linenum{9} -- \linenum{16}] The master goes to idle phase, starts its |
2482 \item[\linenum{9} -- \linenum{16}] The master goes to idle phase, starts its |
2484 state machine and begins scanning the bus. |
2483 state machine and begins scanning the bus. |
2485 |
2484 |
2486 \end{description} |
2485 \end{description} |
2487 |
2486 |
|
2487 \section{Automatic Device Node Creation} |
|
2488 \label{sec:autonode} |
|
2489 |
|
2490 The \lstinline+ethercat+ command-line tool (see section~\ref{sec:ethercat}) |
|
2491 communicates with the master via a character device. The corresponding device |
|
2492 nodes are created automatically, if the udev daemon is running. |
|
2493 Note, that on some distributions, the \lstinline+udev+ package is not |
|
2494 installed by default. |
|
2495 |
|
2496 The device nodes will be created with mode \lstinline+0660+ and group |
|
2497 \lstinline+root+ by default. If you want to give normal users reading access, |
|
2498 create a udev rule file (for example |
|
2499 \textit{/etc/udev/rules.d/99-EtherCAT.rules} with the following content: |
|
2500 |
|
2501 \begin{lstlisting} |
|
2502 KERNEL=="EtherCAT[0-9]*", MODE="0664" |
|
2503 \end{lstlisting} |
|
2504 |
|
2505 After the udev rule file is created and the EtherCAT master is restarted with |
|
2506 \lstinline[breaklines=true]+/etc/init.d/ethercat restart+, the device node |
|
2507 will be automatically created with the desired rights: |
|
2508 |
|
2509 \begin{lstlisting} |
|
2510 # `\textbf{ls -l /dev/EtherCAT0}` |
|
2511 crw-rw-r-- 1 root root 252, 0 2008-09-03 16:19 /dev/EtherCAT0 |
|
2512 \end{lstlisting} |
|
2513 |
|
2514 Now, the \lstinline+ethercat+ tool can be used (see |
|
2515 section~\ref{sec:ethercat}) even as a non-root user. |
|
2516 |
2488 %------------------------------------------------------------------------------ |
2517 %------------------------------------------------------------------------------ |
2489 |
2518 |
2490 \begin{thebibliography}{99} |
2519 \begin{thebibliography}{99} |
2491 |
2520 |
2492 \bibitem{etherlab} Ingenieurgemeinschaft IgH: EtherLab -- Open Source Toolkit |
2521 \bibitem{etherlab} Ingenieurgemeinschaft IgH: EtherLab -- Open Source Toolkit |