Thank you for your answer Qing.<div><br></div><div>still, i can&#39;t solve the problem : (</div><div><br></div><div>I captured some packets by using the wireshark program and i checked the pdos are sent properly.</div><div>
<br></div><div>but the real values of object dictionary are no changed!</div><div><br></div><div>so I think it is not a master module&#39;s problem....</div><div><br></div><div>I use epos3 motor drive for the test...</div>
<div><br></div><div>is there any solution? </div><div><br><div class="gmail_quote">2012/12/5  <span dir="ltr">&lt;<a href="mailto:etherlab-dev-request@etherlab.org" target="_blank">etherlab-dev-request@etherlab.org</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send etherlab-dev mailing list submissions to<br>
        <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://lists.etherlab.org/mailman/listinfo/etherlab-dev" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-dev</a><br>
or, via email, send a message with subject or body &#39;help&#39; to<br>
        <a href="mailto:etherlab-dev-request@etherlab.org">etherlab-dev-request@etherlab.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:etherlab-dev-owner@etherlab.org">etherlab-dev-owner@etherlab.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than &quot;Re: Contents of etherlab-dev digest...&quot;<br>
<br>
<br>
Today&#39;s Topics:<br>
<br>
   1. Re: A problem related to the pdo communication    (Jinyoung<br>
      Choi) (Royal Qing)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 5 Dec 2012 11:38:09 +0800 (CST)<br>
From: &quot;Royal Qing&quot; &lt;<a href="mailto:royalqing@163.com">royalqing@163.com</a>&gt;<br>
Subject: Re: [etherlab-dev] A problem related to the pdo communication<br>
        (Jinyoung Choi)<br>
To: <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br>
Message-ID: &lt;<a href="mailto:20c0bac1.500e.13b6924602d.Coremail.royalqing@163.com">20c0bac1.500e.13b6924602d.Coremail.royalqing@163.com</a>&gt;<br>
Content-Type: text/plain; charset=&quot;gbk&quot;<br>
<br>
Hi Jinyoung,<br>
<br>
It looks like nothing wrong with your codes.<br>
First of all, please check the device description file(XML) and make sure it just contains only 1 RxPDO with 7 entries and 1 TxPDO with 6 entries.<br>
Then please try to use external memory to manage the internal process data for your domain. I doubt that your pointer domain0_output is clear after  ecrt_master_send(master).<br>
<br>
if ((size = ecrt_domain_size(domain0))) {<br>
        if (!(domain0_output = (uint8_t *) kmalloc(size, GFP_KERNEL))) {<br>
            printk(KERN_ERR PFX &quot;Failed to allocate %u bytes of process data&quot;<br>
                    &quot; memory!\n&quot;, size);<br>
             return -1;<br>
        }<br>
        ecrt_domain_external_memory(domain0, domain0_output);<br>
    }<br>
<br>
BR!<br>
<br>
Royal Qing<br>
<br>
<br>
<br>
At 2012-11-30 18:20:10,<a href="mailto:etherlab-dev-request@etherlab.org">etherlab-dev-request@etherlab.org</a> wrote:<br>
&gt;Send etherlab-dev mailing list submissions to<br>
&gt;       <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br>
&gt;<br>
&gt;To subscribe or unsubscribe via the World Wide Web, visit<br>
&gt;       <a href="http://lists.etherlab.org/mailman/listinfo/etherlab-dev" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-dev</a><br>
&gt;or, via email, send a message with subject or body &#39;help&#39; to<br>
&gt;       <a href="mailto:etherlab-dev-request@etherlab.org">etherlab-dev-request@etherlab.org</a><br>
&gt;<br>
&gt;You can reach the person managing the list at<br>
&gt;       <a href="mailto:etherlab-dev-owner@etherlab.org">etherlab-dev-owner@etherlab.org</a><br>
&gt;<br>
&gt;When replying, please edit your Subject line so it is more specific<br>
&gt;than &quot;Re: Contents of etherlab-dev digest...&quot;<br>
&gt;<br>
&gt;<br>
&gt;Today&#39;s Topics:<br>
&gt;<br>
&gt;   1. A problem related to the pdo communication (Jinyoung Choi)<br>
&gt;<br>
&gt;<br>
&gt;----------------------------------------------------------------------<br>
&gt;<br>
&gt;Message: 1<br>
&gt;Date: Fri, 30 Nov 2012 19:20:07 +0900<br>
&gt;From: Jinyoung Choi &lt;<a href="mailto:kbkbc88@gmail.com">kbkbc88@gmail.com</a>&gt;<br>
&gt;Subject: [etherlab-dev] A problem related to the pdo communication<br>
&gt;To: <a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br>
&gt;Message-ID:<br>
&gt;       &lt;<a href="mailto:CADsBPRSrAhDoJad1n2fyKhc8ADCW412o8b1eX-mwzYp%2Bb68rtA@mail.gmail.com">CADsBPRSrAhDoJad1n2fyKhc8ADCW412o8b1eX-mwzYp+b68rtA@mail.gmail.com</a>&gt;<br>
&gt;Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
&gt;<br>
&gt;Hi all, my name CJ from south korea.<br>
&gt;<br>
&gt;I modified an example in /example/user/main.c<br>
&gt;<br>
&gt;My goal is to communicate with slave motor drive(epos3) by using ethercat<br>
&gt;through SDO and PDO messages.<br>
&gt;<br>
&gt;My slave drive can get into OP state like these messages<br>
&gt;<br>
&gt;Activating master...<br>
&gt;<br>
&gt;Starting timer...<br>
&gt;<br>
&gt;Started.<br>
&gt;<br>
&gt;1 slave(s).<br>
&gt;<br>
&gt;AL states: 0x02.<br>
&gt;<br>
&gt;Link is up.<br>
&gt;<br>
&gt;EPOS3 slave 0 State 0x02.<br>
&gt;<br>
&gt;EPOS3 slave 0: online.<br>
&gt;<br>
&gt;Domain: WC 3.<br>
&gt;<br>
&gt;Domain: State 2.<br>
&gt;<br>
&gt;AL states: 0x08.<br>
&gt;<br>
&gt;EPOS3 slave 0 State 0x08.<br>
&gt;<br>
&gt;EPOS3 slave 0: operational.<br>
&gt;<br>
&gt;<br>
&gt;and kernel messages are like this,<br>
&gt;<br>
&gt;...<br>
&gt;<br>
&gt;[29145.133927] EtherCAT DEBUG 0: Stopping master thread.<br>
&gt;<br>
&gt;[29145.133930] EtherCAT DEBUG 0: Master IDLE thread exiting...<br>
&gt;<br>
&gt;[29145.133952] EtherCAT 0: Master thread exited.<br>
&gt;<br>
&gt;[29145.133954] EtherCAT DEBUG 0: FSM datagram is ffff8800527bd648.<br>
&gt;<br>
&gt;[29145.133955] EtherCAT 0: Starting EtherCAT-OP thread.<br>
&gt;<br>
&gt;[29145.133973] EtherCAT DEBUG 0: mmap()<br>
&gt;<br>
&gt;[29145.133975] EtherCAT DEBUG 0: Vma fault, virtual_address =<br>
&gt;00007fb7e9b61000, offset = 0, page = ffffea00011ffe30<br>
&gt;<br>
&gt;[29145.134008] EtherCAT DEBUG 0: Operation thread running with fsm interval<br>
&gt;= 10000 us, max data size=112500<br>
&gt;<br>
&gt;[29145.134010] EtherCAT WARNING 0: 1 datagram UNMATCHED!<br>
&gt;<br>
&gt;[29145.143508] EtherCAT DEBUG 0: Configuration changed (aborting state<br>
&gt;check).<br>
&gt;<br>
&gt;[29145.143511] EtherCAT DEBUG 0: Writing system time offsets...<br>
&gt;<br>
&gt;[29145.143512] EtherCAT WARNING 0: No app_time received up to now, but<br>
&gt;master already active.<br>
&gt;<br>
&gt;[29145.143513] EtherCAT DEBUG 0: Requesting OP...<br>
&gt;<br>
&gt;[29145.181179] EtherCAT DEBUG 0-0: Changing state from PREOP to OP.<br>
&gt;<br>
&gt;[29145.181182] EtherCAT DEBUG 0-0: Configuring...<br>
&gt;<br>
&gt;[29145.215005] EtherCAT DEBUG 0-0: Now in INIT.<br>
&gt;<br>
&gt;[29145.215007] EtherCAT DEBUG 0-0: Clearing FMMU configurations...<br>
&gt;<br>
&gt;[29145.235006] EtherCAT DEBUG 0-0: Clearing sync manager configurations...<br>
&gt;<br>
&gt;[29145.255046] EtherCAT DEBUG 0-0: Clearing DC assignment...<br>
&gt;<br>
&gt;[29145.274967] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...<br>
&gt;<br>
&gt;[29145.274995] EtherCAT DEBUG 0-0: SM0: Addr 0x1000, Size 1024, Ctrl 0x26,<br>
&gt;En 1<br>
&gt;<br>
&gt;[29145.274997] EtherCAT DEBUG 0-0: SM1: Addr 0x1400, Size 1024, Ctrl 0x22,<br>
&gt;En 1<br>
&gt;<br>
&gt;[29145.334911] EtherCAT DEBUG 0-0: Now in PREOP.<br>
&gt;<br>
&gt;[29145.334918] EtherCAT DEBUG 0-0: Setting PDO assignment of SM2:<br>
&gt;<br>
&gt;[29145.334919] EtherCAT DEBUG 0-0: Currently assigned PDOs: 0x1600. PDOs to<br>
&gt;assign: 0x1600<br>
&gt;<br>
&gt;[29145.334922] EtherCAT DEBUG 0-0: Setting number of assigned PDOs to zero.<br>
&gt;<br>
&gt;[29145.334923] EtherCAT DEBUG 0-0: Downloading SDO 0x1C12:00.<br>
&gt;<br>
&gt;[29145.334924] EtherCAT DEBUG: 00<br>
&gt;<br>
&gt;[29145.334926] EtherCAT DEBUG 0-0: Expedited download request:<br>
&gt;<br>
&gt;[29145.334927] EtherCAT DEBUG: 00 20 2F 12 1C 00 00 00 00 00<br>
&gt;<br>
&gt;[29145.394874] EtherCAT DEBUG 0-0: Download response:<br>
&gt;<br>
&gt;[29145.394876] EtherCAT DEBUG: 00 30 60 12 1C 00 00 00 00 00<br>
&gt;<br>
&gt;[29145.394881] EtherCAT DEBUG 0-0: Assigning PDO 0x1600 at position 1.<br>
&gt;<br>
&gt;[29145.394882] EtherCAT DEBUG 0-0: Downloading SDO 0x1C12:01.<br>
&gt;<br>
&gt;[29145.394883] EtherCAT DEBUG: 00 16<br>
&gt;<br>
&gt;[29145.394885] EtherCAT DEBUG 0-0: Expedited download request:<br>
&gt;<br>
&gt;[29145.394885] EtherCAT DEBUG: 00 20 2B 12 1C 01 00 16 00 00<br>
&gt;<br>
&gt;[29145.454815] EtherCAT DEBUG 0-0: Download response:<br>
&gt;<br>
&gt;[29145.454816] EtherCAT DEBUG: 00 30 60 12 1C 01 00 16 00 00<br>
&gt;<br>
&gt;[29145.454820] EtherCAT DEBUG 0-0: Setting number of assigned PDOs to 1.<br>
&gt;<br>
&gt;[29145.454822] EtherCAT DEBUG 0-0: Downloading SDO 0x1C12:00.<br>
&gt;<br>
&gt;[29145.454822] EtherCAT DEBUG: 01<br>
&gt;<br>
&gt;[29145.454824] EtherCAT DEBUG 0-0: Expedited download request:<br>
&gt;<br>
&gt;[29145.454824] EtherCAT DEBUG: 00 20 2F 12 1C 00 01 00 00 00<br>
&gt;<br>
&gt;[29145.514775] EtherCAT DEBUG 0-0: Download response:<br>
&gt;<br>
&gt;[29145.514777] EtherCAT DEBUG: 00 30 60 12 1C 00 01 00 00 00<br>
&gt;<br>
&gt;[29145.514783] EtherCAT DEBUG 0-0: Successfully configured PDO assignment<br>
&gt;of SM2.<br>
&gt;<br>
&gt;[29145.514787] EtherCAT DEBUG 0-0: Setting PDO assignment of SM3:<br>
&gt;<br>
&gt;[29145.514787] EtherCAT DEBUG 0-0: Currently assigned PDOs: 0x1A00. PDOs to<br>
&gt;assign: 0x1A00<br>
&gt;<br>
&gt;[29145.514790] EtherCAT DEBUG 0-0: Setting number of assigned PDOs to zero.<br>
&gt;<br>
&gt;[29145.514792] EtherCAT DEBUG 0-0: Downloading SDO 0x1C13:00.<br>
&gt;<br>
&gt;[29145.514792] EtherCAT DEBUG: 00<br>
&gt;<br>
&gt;[29145.514794] EtherCAT DEBUG 0-0: Expedited download request:<br>
&gt;<br>
&gt;[29145.514794] EtherCAT DEBUG: 00 20 2F 13 1C 00 00 00 00 00<br>
&gt;<br>
&gt;[29145.574693] EtherCAT DEBUG 0-0: Download response:<br>
&gt;<br>
&gt;[29145.574695] EtherCAT DEBUG: 00 30 60 13 1C 00 00 00 00 00<br>
&gt;<br>
&gt;[29145.574700] EtherCAT DEBUG 0-0: Assigning PDO 0x1A00 at position 1.<br>
&gt;<br>
&gt;[29145.574702] EtherCAT DEBUG 0-0: Downloading SDO 0x1C13:01.<br>
&gt;<br>
&gt;[29145.574703] EtherCAT DEBUG: 00 1A<br>
&gt;<br>
&gt;[29145.574704] EtherCAT DEBUG 0-0: Expedited download request:<br>
&gt;<br>
&gt;[29145.574705] EtherCAT DEBUG: 00 20 2B 13 1C 01 00 1A 00 00<br>
&gt;<br>
&gt;[29145.634651] EtherCAT DEBUG 0-0: Download response:<br>
&gt;<br>
&gt;[29145.634653] EtherCAT DEBUG: 00 30 60 13 1C 01 00 1A 00 00<br>
&gt;<br>
&gt;[29145.634656] EtherCAT DEBUG 0-0: Setting number of assigned PDOs to 1.<br>
&gt;<br>
&gt;[29145.634658] EtherCAT DEBUG 0-0: Downloading SDO 0x1C13:00.<br>
&gt;<br>
&gt;[29145.634659] EtherCAT DEBUG: 01<br>
&gt;<br>
&gt;[29145.634660] EtherCAT DEBUG 0-0: Expedited download request:<br>
&gt;<br>
&gt;[29145.634661] EtherCAT DEBUG: 00 20 2F 13 1C 00 01 00 00 00<br>
&gt;<br>
&gt;[29145.694597] EtherCAT DEBUG 0-0: Download response:<br>
&gt;<br>
&gt;[29145.694599] EtherCAT DEBUG: 00 30 60 13 1C 00 01 00 00 00<br>
&gt;<br>
&gt;[29145.694603] EtherCAT DEBUG 0-0: Successfully configured PDO assignment<br>
&gt;of SM3.<br>
&gt;<br>
&gt;[29145.694607] EtherCAT DEBUG 0-0: SM2: Addr 0x1800, Size 19, Ctrl 0x64, En<br>
&gt;1<br>
&gt;<br>
&gt;[29145.694609] EtherCAT DEBUG 0-0: SM3: Addr 0x1C00, Size 15, Ctrl 0x20, En<br>
&gt;1<br>
&gt;<br>
&gt;[29145.714583] EtherCAT DEBUG 0 0:0: FMMU: LogAddr 0x00000000, Size 19,<br>
&gt;PhysAddr 0x1800, SM2, Dir out<br>
&gt;<br>
&gt;[29145.714585] EtherCAT DEBUG 0 0:0: FMMU: LogAddr 0x00000013, Size 15,<br>
&gt;PhysAddr 0x1C00, SM3, Dir in<br>
&gt;<br>
&gt;[29145.764458] EtherCAT 0: Domain 0: Working counter changed to 3/3.<br>
&gt;<br>
&gt;[29145.774506] EtherCAT DEBUG 0-0: Now in SAFEOP.<br>
&gt;<br>
&gt;[29145.814535] EtherCAT DEBUG 0-0: Now in OP. Finished configuration.<br>
&gt;<br>
&gt;[29145.840543] EtherCAT 0: Slave states: OP.<br>
&gt;<br>
&gt;<br>
&gt;------------------------------------------------------------------------------------------------<br>
&gt;<br>
&gt;<br>
&gt;I guess that the pdos may be sent by master module.<br>
&gt;<br>
&gt;but the actual value of objects in slave&#39;s object dictionary are not<br>
&gt;changed.<br>
&gt;<br>
&gt;what is the problem?<br>
&gt;<br>
&gt;please do me a favor.<br>
&gt;<br>
&gt;and this is my example code.<br>
&gt;<br>
&gt;<br>
&gt;/*****************************************************************************<br>
&gt; *<br>
&gt; *  $Id: main.c,v 60a116ed3897 2009/07/27 10:44:16 fp $<br>
&gt; *<br>
&gt; *  Copyright (C) 2007-2009  Florian Pose, Ingenieurgemeinschaft IgH<br>
&gt; *<br>
&gt; *  This file is part of the IgH EtherCAT Master.<br>
&gt; *<br>
&gt; *  The IgH EtherCAT Master is free software; you can redistribute it and/or<br>
&gt; *  modify it under the terms of the GNU General Public License version 2,<br>
&gt;as<br>
&gt; *  published by the Free Software Foundation.<br>
&gt; *<br>
&gt; *  The IgH EtherCAT Master is distributed in the hope that it will be<br>
&gt;useful,<br>
&gt; *  but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
&gt; *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU<br>
&gt;General<br>
&gt; *  Public License for more details.<br>
&gt; *<br>
&gt; *  You should have received a copy of the GNU General Public License along<br>
&gt; *  with the IgH EtherCAT Master; if not, write to the Free Software<br>
&gt; *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301<br>
&gt;USA<br>
&gt; *<br>
&gt; *  ---<br>
&gt; *<br>
&gt; *  The license mentioned above concerns the source code only. Using the<br>
&gt; *  EtherCAT technology and brand is only permitted in compliance with the<br>
&gt; *  industrial property and similar rights of Beckhoff Automation GmbH.<br>
&gt; *<br>
&gt; ****************************************************************************/<br>
&gt;<br>
&gt;#include &lt;errno.h&gt;<br>
&gt;#include &lt;signal.h&gt;<br>
&gt;#include &lt;stdio.h&gt;<br>
&gt;#include &lt;string.h&gt;<br>
&gt;#include &lt;sys/resource.h&gt;<br>
&gt;#include &lt;sys/time.h&gt;<br>
&gt;#include &lt;sys/types.h&gt;<br>
&gt;#include &lt;unistd.h&gt;<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;#include &quot;ecrt.h&quot;<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;// Application parameters<br>
&gt;#define FREQUENCY 100<br>
&gt;#define PRIORITY 1<br>
&gt;<br>
&gt;// Optional features<br>
&gt;#define CONFIGURE_PDOS  1<br>
&gt;#define SDO_ACCESS      0<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;// EtherCAT<br>
&gt;static ec_master_t *master = NULL;<br>
&gt;static ec_master_state_t master_state = {};<br>
&gt;<br>
&gt;static ec_domain_t *domain0 = NULL;<br>
&gt;static ec_domain_state_t domain_state = {};<br>
&gt;<br>
&gt;static ec_slave_config_t *sc_epos3 = NULL;<br>
&gt;static ec_slave_config_state_t sc_epos3_state = {};<br>
&gt;<br>
&gt;// Timer<br>
&gt;static unsigned int sig_alarms = 0;<br>
&gt;static unsigned int user_alarms = 0;<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;// process data<br>
&gt;static uint8_t *domain0_output = NULL;<br>
&gt;<br>
&gt;#define SLAVE_DRIVE_0 0, 0<br>
&gt;#define MAXON_EPOS3    0x000000fb, 0x64400000<br>
&gt;<br>
&gt;// offsets for PDO entries<br>
&gt;<br>
&gt;static unsigned int off_epos3_cntlwd;<br>
&gt;//static unsigned int off_epos3_tvel;<br>
&gt;static unsigned int off_epos3_tpos;<br>
&gt;static unsigned int off_epos3_off_pos;<br>
&gt;static unsigned int off_epos3_off_vel;<br>
&gt;static unsigned int off_epos3_off_toq;<br>
&gt;static unsigned int off_epos3_moo;<br>
&gt;static unsigned int off_epos3_dof;<br>
&gt;static unsigned int off_epos3_status;<br>
&gt;static unsigned int off_epos3_pos_val;<br>
&gt;static unsigned int off_epos3_vel_val;<br>
&gt;static unsigned int off_epos3_toq_val;<br>
&gt;static unsigned int off_epos3_mood;<br>
&gt;static unsigned int off_epos3_dif;<br>
&gt;<br>
&gt;const static ec_pdo_entry_reg_t domain0_regs[] = {<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x6040, 0, &amp;off_epos3_cntlwd},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x607a, 0, &amp;off_epos3_tpos},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x60b0, 0, &amp;off_epos3_off_pos},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x60b1, 0, &amp;off_epos3_off_vel},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x60b2, 0, &amp;off_epos3_off_toq},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x6060, 0, &amp;off_epos3_moo},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x2078, 1, &amp;off_epos3_dof},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x6041, 0, &amp;off_epos3_status},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x6064, 0, &amp;off_epos3_pos_val},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x606c, 0, &amp;off_epos3_vel_val},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x6077, 0, &amp;off_epos3_toq_val},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x6061, 0, &amp;off_epos3_mood},<br>
&gt;        {SLAVE_DRIVE_0, MAXON_EPOS3, 0x2071, 1, &amp;off_epos3_dif},<br>
&gt;        {}<br>
&gt;};<br>
&gt;<br>
&gt;static unsigned int counter = 0;<br>
&gt;static unsigned int blink = 0;<br>
&gt;<br>
&gt;/*****************************************************************************/<br>
&gt;<br>
&gt;#if CONFIGURE_PDOS<br>
&gt;<br>
&gt;static ec_pdo_entry_info_t epos3_pdo_rx_entries[] = {<br>
&gt;        {0x6040, 0, 16},       // controlword<br>
&gt;        {0x607a, 0, 32},       // target position<br>
&gt;        {0x60b0, 0, 32},       // position offset<br>
&gt;        {0x60b1, 0, 32},       // velocity offset<br>
&gt;        {0x60b2, 0, 16},       // torque offset<br>
&gt;        {0x6060, 0, 8},               // modes of opeartion<br>
&gt;        {0x2078, 1, 16}               // digital output functionality<br>
&gt;<br>
&gt;};<br>
&gt;<br>
&gt;static ec_pdo_entry_info_t epos3_pdo_tx_entries[] = {<br>
&gt;        {0x6041, 0, 16},        // status word<br>
&gt;        {0x6064, 0, 32},        // position actual value<br>
&gt;        {0x606c, 0, 32},        // velocity actual value<br>
&gt;        {0x6077, 0, 16},        // torque actual value<br>
&gt;        {0x6061, 0, 8},         // modes of operation display<br>
&gt;        {0x2071, 1, 16}         // digital input functionality<br>
&gt;};<br>
&gt;<br>
&gt;static ec_pdo_info_t epos3_pdos[] = {<br>
&gt;        {0x1600, 7, epos3_pdo_rx_entries},<br>
&gt;        {0x1a00, 6, epos3_pdo_tx_entries}<br>
&gt;};<br>
&gt;<br>
&gt;static ec_sync_info_t epos3_syncs[] = {<br>
&gt;        {2, EC_DIR_OUTPUT, 1, epos3_pdos},<br>
&gt;        {3, EC_DIR_INPUT, 1, epos3_pdos+1},<br>
&gt;        {0xff}<br>
&gt;};<br>
&gt;<br>
&gt;#endif<br>
&gt;<br>
&gt;/*****************************************************************************/<br>
&gt;<br>
&gt;#if SDO_ACCESS<br>
&gt;static ec_sdo_request_t *sdo;<br>
&gt;#endif<br>
&gt;<br>
&gt;/*****************************************************************************/<br>
&gt;<br>
&gt;void check_domain_state(ec_domain_t *domain)<br>
&gt;{<br>
&gt;    ec_domain_state_t ds;<br>
&gt;<br>
&gt;    ecrt_domain_state(domain, &amp;ds);<br>
&gt;<br>
&gt;    if (ds.working_counter != domain_state.working_counter)<br>
&gt;        printf(&quot;Domain: WC %u.\n&quot;, ds.working_counter);<br>
&gt;    if (ds.wc_state != domain_state.wc_state)<br>
&gt;        printf(&quot;Domain: State %u.\n&quot;, ds.wc_state);<br>
&gt;<br>
&gt;    domain_state = ds;<br>
&gt;}<br>
&gt;<br>
&gt;/*****************************************************************************/<br>
&gt;<br>
&gt;void check_master_state(void)<br>
&gt;{<br>
&gt;    ec_master_state_t ms;<br>
&gt;<br>
&gt;    ecrt_master_state(master, &amp;ms);<br>
&gt;<br>
&gt;    if (ms.slaves_responding != master_state.slaves_responding)<br>
&gt;        printf(&quot;%u slave(s).\n&quot;, ms.slaves_responding);<br>
&gt;    if (ms.al_states != master_state.al_states)<br>
&gt;        printf(&quot;AL states: 0x%02X.\n&quot;, ms.al_states);<br>
&gt;    if (ms.link_up != master_state.link_up)<br>
&gt;        printf(&quot;Link is %s.\n&quot;, ms.link_up ? &quot;up&quot; : &quot;down&quot;);<br>
&gt;<br>
&gt;    master_state = ms;<br>
&gt;}<br>
&gt;<br>
&gt;/*****************************************************************************/<br>
&gt;<br>
&gt;void check_slave_config_states(void)<br>
&gt;{<br>
&gt;    ec_slave_config_state_t s;<br>
&gt;<br>
&gt;    ecrt_slave_config_state(sc_epos3, &amp;s);<br>
&gt;<br>
&gt;    if (s.al_state != sc_epos3_state.al_state)<br>
&gt;        printf(&quot;EPOS3 slave 0 State 0x%02X.\n&quot;, s.al_state);<br>
&gt;    if (s.online != sc_epos3_state.online)<br>
&gt;        printf(&quot;EPOS3 slave 0: %s.\n&quot;, s.online ? &quot;online&quot; : &quot;offline&quot;);<br>
&gt;    if (s.operational != sc_epos3_state.operational)<br>
&gt;        printf(&quot;EPOS3 slave 0: %soperational.\n&quot;,<br>
&gt;                s.operational ? &quot;&quot; : &quot;Not &quot;);<br>
&gt;    sc_epos3_state = s;<br>
&gt;}<br>
&gt;<br>
&gt;/*****************************************************************************/<br>
&gt;<br>
&gt;#if SDO_ACCESS<br>
&gt;void read_sdo(void)<br>
&gt;{<br>
&gt;    switch (ecrt_sdo_request_state(sdo)) {<br>
&gt;        case EC_REQUEST_UNUSED: // request was not used yet<br>
&gt;            ecrt_sdo_request_read(sdo); // trigger first read<br>
&gt;            break;<br>
&gt;        case EC_REQUEST_BUSY:<br>
&gt;            fprintf(stderr, &quot;Still busy...\n&quot;);<br>
&gt;            break;<br>
&gt;        case EC_REQUEST_SUCCESS:<br>
&gt;            fprintf(stderr, &quot;SDO value: 0x%04X\n&quot;,<br>
&gt;                    EC_READ_U16(ecrt_sdo_request_data(sdo)));<br>
&gt;            ecrt_sdo_request_read(sdo); // trigger next read<br>
&gt;            break;<br>
&gt;        case EC_REQUEST_ERROR:<br>
&gt;            fprintf(stderr, &quot;Failed to read SDO!\n&quot;);<br>
&gt;            ecrt_sdo_request_read(sdo); // retry reading<br>
&gt;            break;<br>
&gt;    }<br>
&gt;}<br>
&gt;<br>
&gt;#endif<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;void cyclic_task(){<br>
&gt;        int i;<br>
&gt;<br>
&gt;        // receive process data<br>
&gt;        ecrt_master_receive(master);<br>
&gt;        ecrt_domain_process(domain0);<br>
&gt;<br>
&gt;        // check process data state (optional)<br>
&gt;        check_domain_state(domain0);<br>
&gt;<br>
&gt;        if (counter) {<br>
&gt;               counter--;<br>
&gt;        }else {        // do this at 1 Hz<br>
&gt;               counter = FREQUENCY;<br>
&gt;<br>
&gt;               // calculate new process data<br>
&gt;               blink = !blink;<br>
&gt;<br>
&gt;               // check for master state (optional)<br>
&gt;               check_master_state();<br>
&gt;<br>
&gt;               // check for islave configuration state(s) (optional)<br>
&gt;               check_slave_config_states();<br>
&gt;<br>
&gt;#if SDO_ACCESS<br>
&gt;               // read process data SDO<br>
&gt;               read_sdo();<br>
&gt;               printf(&quot;read_sdo\n&quot;);<br>
&gt;#endif<br>
&gt;        }<br>
&gt;        // read process data<br>
&gt;        //printf(&quot; stataus word : %u\n&quot;,EC_READ_U8(domain1_pd +<br>
&gt;off_epos3_moo));<br>
&gt;<br>
&gt;        // write process data<br>
&gt;        EC_WRITE_U32(domain0_output + off_epos3_tpos, 0xff);<br>
&gt;<br>
&gt;        // send process data<br>
&gt;        ecrt_domain_queue(domain0);<br>
&gt;        ecrt_master_send(master);<br>
&gt;<br>
&gt;<br>
&gt;}<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;void signal_handler(int signum) {<br>
&gt;    switch (signum) {<br>
&gt;        case SIGALRM:<br>
&gt;            sig_alarms++;<br>
&gt;            break;<br>
&gt;    }<br>
&gt;}<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;<br>
&gt;int main(int argc, char **argv)<br>
&gt;{<br>
&gt;        ec_slave_config_t *sc;<br>
&gt;        struct sigaction sa;<br>
&gt;        struct itimerval tv;<br>
&gt;<br>
&gt;        master = ecrt_request_master(0);<br>
&gt;               printf(&quot;ecrt_request_master is called \n&quot;);<br>
&gt;        if (!master)<br>
&gt;               return -1;<br>
&gt;<br>
&gt;        domain0 = ecrt_master_create_domain(master);<br>
&gt;        if(!domain0)<br>
&gt;               return -1;<br>
&gt;<br>
&gt;        if(!(sc_epos3 = ecrt_master_slave_config(<br>
&gt;                       master, SLAVE_DRIVE_0, MAXON_EPOS3))){<br>
&gt;               fprintf(stderr, &quot;Failed to get slave configuration. \n&quot;);<br>
&gt;               return -1;<br>
&gt;        }<br>
&gt;<br>
&gt;        //added by kbkbc<br>
&gt;        //if (ecrt_slave_config_sdo16(sc_epos3, 0x6040, 0x00,9 ) == 0)<br>
&gt;               //printf(&quot;change SDO : 0x6040 \n&quot;);<br>
&gt;<br>
&gt;#if SDO_ACCESS<br>
&gt;    fprintf(stderr, &quot;Creating SDO requests...\n&quot;);<br>
&gt;    if (!(sdo = ecrt_slave_config_create_sdo_request(sc_epos3, 0x6060,<br>
&gt;0x00, 16))) {<br>
&gt;        fprintf(stderr, &quot;Failed to create SDO request.\n&quot;);<br>
&gt;        return -1;<br>
&gt;    }<br>
&gt;    ecrt_sdo_request_timeout(sdo, 500); // ms<br>
&gt;<br>
&gt;#endif<br>
&gt;<br>
&gt;#if CONFIGURE_PDOS<br>
&gt;        printf(&quot;Configuring PDOs...\n&quot;);<br>
&gt;        if (ecrt_slave_config_pdos(sc_epos3, EC_END, epos3_syncs)) {<br>
&gt;               fprintf(stderr, &quot;Failed to configure PDOs.\n&quot;);<br>
&gt;               return -1;<br>
&gt;        }<br>
&gt;        printf(&quot;configureing PDO is completed!\n&quot;);<br>
&gt;#endif<br>
&gt;        if( ecrt_domain_reg_pdo_entry_list(domain0, domain0_regs)){<br>
&gt;               fprintf(stderr, &quot;PDO entty registration filed! \n&quot;);<br>
&gt;               return -1;<br>
&gt;        }<br>
&gt;<br>
&gt;        printf(&quot;Activating master...\n&quot;);<br>
&gt;        if (ecrt_master_activate(master))<br>
&gt;               return -1;<br>
&gt;<br>
&gt;        if( !(domain0_output = ecrt_domain_data(domain0))) {<br>
&gt;               return -1;<br>
&gt;        }<br>
&gt;<br>
&gt;#if PRIORITY<br>
&gt;    pid_t pid = getpid();<br>
&gt;    if (setpriority(PRIO_PROCESS, pid, -19))<br>
&gt;        fprintf(stderr, &quot;Warning: Failed to set priority: %s\n&quot;,<br>
&gt;                strerror(errno));<br>
&gt;#endif<br>
&gt;<br>
&gt;    sa.sa_handler = signal_handler;<br>
&gt;    sigemptyset(&amp;sa.sa_mask);<br>
&gt;    sa.sa_flags = 0;<br>
&gt;    if (sigaction(SIGALRM, &amp;sa, 0)) {<br>
&gt;        fprintf(stderr, &quot;Failed to install signal handler!\n&quot;);<br>
&gt;        return -1;<br>
&gt;    }<br>
&gt;<br>
&gt;    printf(&quot;Starting timer...\n&quot;);<br>
&gt;    tv.it_interval.tv_sec = 0;<br>
&gt;    tv.it_interval.tv_usec = 1000000 / FREQUENCY;<br>
&gt;    tv.it_value.tv_sec = 0;<br>
&gt;    tv.it_value.tv_usec = 1000;<br>
&gt;    if (setitimer(ITIMER_REAL, &amp;tv, NULL)) {<br>
&gt;        fprintf(stderr, &quot;Failed to start timer: %s\n&quot;, strerror(errno));<br>
&gt;        return 1;<br>
&gt;    }<br>
&gt;<br>
&gt;    printf(&quot;Started.\n&quot;);<br>
&gt;<br>
&gt;    while (1) {<br>
&gt;        pause();<br>
&gt;<br>
&gt;        #if 0<br>
&gt;        struct timeval t;<br>
&gt;        gettimeofday(&amp;t, NULL);<br>
&gt;        printf(&quot;%u.%06u\n&quot;, t.tv_sec, t.tv_usec);<br>
&gt;        #endif<br>
&gt;        while (sig_alarms != user_alarms) {<br>
&gt;            cyclic_task();<br>
&gt;            user_alarms++;<br>
&gt;        }<br>
&gt;    }<br>
&gt;<br>
&gt;    return 0;<br>
&gt;}<br>
&gt;<br>
&gt;/****************************************************************************/<br>
&gt;-------------- next part --------------<br>
&gt;An HTML attachment was scrubbed...<br>
&gt;URL: &lt;<a href="http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20121130/d7e815a7/attachment.html" target="_blank">http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20121130/d7e815a7/attachment.html</a>&gt;<br>

&gt;<br>
&gt;------------------------------<br>
&gt;<br>
&gt;_______________________________________________<br>
&gt;etherlab-dev mailing list<br>
&gt;<a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br>
&gt;<a href="http://lists.etherlab.org/mailman/listinfo/etherlab-dev" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-dev</a><br>
&gt;<br>
&gt;<br>
&gt;End of etherlab-dev Digest, Vol 49, Issue 1<br>
&gt;*******************************************<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20121205/d407ed9d/attachment.htm" target="_blank">http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20121205/d407ed9d/attachment.htm</a>&gt;<br>

<br>
------------------------------<br>
<br>
_______________________________________________<br>
etherlab-dev mailing list<br>
<a href="mailto:etherlab-dev@etherlab.org">etherlab-dev@etherlab.org</a><br>
<a href="http://lists.etherlab.org/mailman/listinfo/etherlab-dev" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-dev</a><br>
<br>
<br>
End of etherlab-dev Digest, Vol 50, Issue 1<br>
*******************************************<br>
</blockquote></div><br></div>