author | Florian Pose <fp@igh-essen.com> |
Wed, 23 Nov 2011 15:11:07 +0100 | |
changeset 2163 | d6d49dcaf7a5 |
parent 2059 | ab0b96ac18bb |
permissions | -rw-r--r-- |
2059
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
1 |
------------------------------------------------------------------------------- |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
2 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
3 |
$Id$ |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
4 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
5 |
------------------------------------------------------------------------------- |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
6 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
7 |
This is a minimal example application for the use of the EtherCAT |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
8 |
master realtime RTDM interface with an RTAI-LXRT thread. |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
9 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
10 |
The application expects an RTAI installation. Configure the master sources |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
11 |
specifying --enable-rtdm --with-rtai-dir to have the right include paths. |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
12 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
13 |
Most probably you'll have different EtherCAT slaves present. Try adjusting the |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
14 |
section "process data" in main.c to your bus configuration. |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
15 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
16 |
There are some features that can be disabled by commenting out the respective |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
17 |
defines at the head of main.c. |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
18 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
19 |
--- |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
20 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
21 |
To build the example, call: |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
22 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
23 |
make |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
24 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
25 |
To run it, load the appropriate RTAI modules: |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
26 |
insmod $(RTAI_DIR)/modules/rtai_hal.ko |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
27 |
insmod $(RTAI_DIR)/modules/rtai_lxrt.ko |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
28 |
insmod $(RTAI_DIR)/modules/rtai_sem.ko |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
29 |
insmod $(RTAI_DIR)/modules/rtai_rtdm.ko |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
30 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
31 |
Preload the EtherCAT RTDM module: |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
32 |
modprobe ec_rtdm |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
33 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
34 |
and call as root: |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
35 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
36 |
./ec_rtai_rtdm_example |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
37 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
38 |
...and watch the system logs for the outputs. |
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
39 |
|
ab0b96ac18bb
Working RTAI LXRT example
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff
changeset
|
40 |
------------------------------------------------------------------------------- |