<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div>
<pre class="western">Dear Etherlab users,<br><br>I use a Beckhoff module EL5102 (2 channels encoder interface) and two servodrives to control motors.
I develop a homing sequence as below :
1- Enable counter reset on channel 1 when index encoder is encountered
2- Move axis 1 until index is encoutered
3- Unable counter reset on channel 1
4- Enable counter reset on channel 2 when index encoder is encountered
5- Move axis 2 until index is encoutered
6- Unable counter reset on channel 2
Unabling and disabling counter reset is done using SDOs 0x80n0:01 where n is the channel number.
In my program, I create 2 SDO requests with « ecrt_slave_config_create_sdo_request » before changing master state in OP with « ecrt_master_activate ».
Then, before entering in cyclic task, I write SDOs for the first time and I get « EC_REQUEST_UNUSED » SDO request state (trigger first write), it seems to be OK.
<font style="font-size: 8pt" size="1">void enableIndexResetCh_n(state)</font>
<font style="font-size: 8pt" size="1">{</font>
<font style="font-size: 8pt" size="1"> switch (ecrt_sdo_request_state(mReqIndexResetCh_n)) {</font>
<font style="font-size: 8pt" size="1"> case EC_REQUEST_UNUSED: </font>
<font style="font-size: 8pt" size="1"> ecrt_sdo_request_write(mReqIndexResetCh_n); </font>
<font style="font-size: 8pt" size="1"> break;</font>
<font style="font-size: 8pt" size="1"> </font>
<font style="font-size: 8pt" size="1"> case EC_REQUEST_BUSY:</font>
<font style="font-size: 8pt" size="1"> break;</font>
<font style="font-size: 8pt" size="1"> case EC_REQUEST_SUCCESS:</font>
<font style="font-size: 8pt" size="1"> EC_WRITE_U8(ecrt_sdo_request_data(mReqIndexResetCh1), static_cast<uint8_t>(state));</font>
<font style="font-size: 8pt" size="1"> ecrt_sdo_request_write(mReqIndexResetCh_n); </font>
<font style="font-size: 8pt" size="1"> break;</font>
<font style="font-size: 8pt" size="1"> default:</font>
<font style="font-size: 8pt" size="1"> ecrt_sdo_request_write(mReqIndexResetCh_n);</font>
<font style="font-size: 8pt" size="1"> break;</font>
<font style="font-size: 8pt" size="1"> }</font>
<font style="font-size: 8pt" size="1"> break;</font>
<font style="font-size: 8pt" size="1">}</font>
<font style="font-size: 10pt" size="2">Then, I realize homing sequence in the cyclic task as describe</font><font style="font-size: 10pt" size="2">d</font><font style="font-size: 10pt" size="2"> before.</font>
<font style="font-size: 10pt" size="2">For the fisrt channel, I write « </font><font style="font-size: 10pt" size="2">1 »</font><font style="font-size: 10pt" size="2"> into SDO 0x8000:01, request state is « EC_REQUEST_SUCCES » but for the second channel 0x8010:02 I get « EC_REQUEST_ERROR » and SDO value remains at false state.</font>
<font style="font-size: 10pt" size="2">I don’t understand why I get this error.</font>
Moreover I want to let you know that I don’t call « ecrt_sdo_request_write » at each loop of cyclic task but only when I need to change sdo state. Perhaps this is not the right way to call this function. Do I have to call this function at each iteration ?
How can I be sure that sdo state corresponds to the right state ? Do I have to read sdo state (if sdo is R/W) also at each iteration ?
<font style="font-size: 10pt" size="2">Regards</font></pre>
</div>
<p></p>
</div>
</body>
</html>