<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">06.07.2012 09:51 tarihinde, Ralf Roesch
yazdı:<br>
</div>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<pre wrap="">On Thu Jul 05 2012 17:33:47 GMT+0200 (CEST), Oguz Dilmac
<a class="moz-txt-link-rfc2396E" href="mailto:odilmac@bilko.com.tr"><odilmac@bilko.com.tr></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Now I have another problems:
1. If I don't use DC, I can control the drive and IO devices at the
same time.
</pre>
</blockquote>
<pre wrap="">o.k, which action do you perform in your control cycle?</pre>
</blockquote>
<font color="#6600cc"><br>
I can use "homing" and "profile position" without a problem. I can
rotate the motor to whereever I like.<br>
If I use "Interpolated Position" or "Cyclic synchronous position"
I can hear "knock" sounds from the motor. I see that, my drive
doesn't support SM synchronisation.<br>
<br>
I need to use those two modes. Therefore I need to use DC
synchronisation.<br>
If I configure DC with "ecrt_slave_config_dc", and if I dont have
any other slave, I can control the drive in </font><font
color="#6600cc">"Cyclic synchronous position" mode without a
problem.</font><br>
<br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<blockquote type="cite">
<pre wrap="">
2. If I use DC (without configuring IO devices), I can't go to
operational at first initialisation. But If I re-run the config
sequence I can control the drive.
</pre>
</blockquote>
<pre wrap="">Which devices, drives do you use?
How do you bring up the devices in operational state?
What is done in your configuration sequence?</pre>
</blockquote>
<font color="#3333ff"><br>
<font color="#6600cc">I have:<br>
One ServoOne junior servo motor driver and it's motor. A demo
case from LT-I<br>
One EK1100 for the bus master<br>
One EL2008 Output module from Beckhoff<br>
One EL1008 Input module from Beckhoff<br>
<br>
I use pretty much the examples for PDO configuration and domain
assignments. <br>
I implement the program as a kernel module. <br>
I have one periodic RT task and several non periodic RT tasks. <br>
I also use one standart linux kernel task for ethercat master
start, stop, SDO download upload functions. Thanks to Graeme.<br>
Here is a pseudo code of what I do. I'm writing the one domain
version. Two domain is almost the same:<br>
<br>
<tt>In the Init module section:<br>
</tt><tt>{<br>
</tt><tt> ...<br>
Ethercat_init<br>
{<br>
rt_sem_init(master_sem)<br>
master = ecrt_request_master(0)<br>
ecrt_master_callbacks<br>
domain = ecrt_master_create_domain(master)<br>
domain_pd = ecrt_domain_data(domain)<br>
}<br>
...<br>
<br>
create linux kernel task<br>
create one periodic task (1ms interval)<br>
create several non periodic tasks.<br>
...<br>
}<br>
<br>
</tt>In one of the non periodic tasks which responsible from
communication with user interface:<tt><br>
{<br>
...<br>
</tt><tt> Configure EK1100<br>
{<br>
// </tt><tt>BeckhOFF_EK1100 vendor ID and product
code is copied from examples<br>
</tt><tt> sc = ecrt_master_slave_config(master, alias,
position, BeckhOFF_EK1100)<br>
}<br>
<br>
</tt><tt> Configure EL2008<br>
{<br>
...<br>
// </tt><tt>BeckhOFF_EL2008 vendor ID and product
code is copied from examples<br>
</tt><tt> sc = ecrt_master_slave_config(master, alias,
position, BeckhOFF_EL2008)<br>
// </tt><tt>el2008_syncs struct definitions are
gathered by ethercat tool, "cstruct" command<br>
</tt><tt> ecrt_slave_config_pdos(SC, EC_END,
el2008_syncs)<br>
el2008_PdoOffset = ecrt_slave_config_reg_pdo_entry(sc,
0x7000, 1, domain, NULL)<br>
}<br>
<br>
</tt><tt> Configure servoOne<br>
{<br>
...<br>
// </tt><tt>LTI_ServoOne</tt><tt> vendor ID and
product code is copied from ethercat tool cstruct output<br>
</tt><tt> sc = ecrt_master_slave_config(master, alias,
position, LTI_ServoOne)<br>
// </tt><tt>so_syncs</tt><tt> struct definitions are
gathered by ethercat tool, "cstruct" command<br>
// Then I got XML config file and updated to use
"cyclic synch. pos" mode.<br>
</tt><tt> ecrt_slave_config_pdos(SC, EC_END, so_syncs)<br>
<br>
so_controlWOffset =
ecrt_slave_config_reg_pdo_entry(sc, 0x6040, 0, domain, NULL)<br>
</tt><tt>
so_refPosOffset = ecrt_slave_config_reg_pdo_entry(sc,
0x607A, 0, domain, NULL)<br>
</tt><tt>
so_statusOffset = ecrt_slave_config_reg_pdo_entry(sc,
0x6041, 0, domain, NULL)<br>
</tt><tt>
so_actPosOffset = ecrt_slave_config_reg_pdo_entry(sc,
0x6064, 0, domain, NULL)<br>
<font color="#000099"><br>
</font><font color="#000099"> <font color="#6600cc"> //
Configure DC usage for th</font></font></tt></font></font><font
color="#6600cc"><tt><b>is drive</b></tt></font><br>
<font color="#3333ff"><font color="#6600cc"><tt> <b><font
color="#ff6600">ecrt_slave_config_dc(sc, 0x0300, 1000000,
440000,0,0)</font><br>
</b><br>
// Do many SDO configuration by
ecrt_master_sdo_download()<br>
// Use linux kernel task for SDO operations.<br>
</tt><tt> }<br>
<br>
// Activate master<br>
// Linux kernel thread does the job in parallel<br>
</tt><tt> activate_master_using_LinuxKernel_thread <br>
</tt><tt><br>
// Parallel Periodic task sees master has been activated.<br>
// Starts cyclic processing <br>
<br>
Enable servoOne<br>
{<br>
// using PDO, write to the control register of the
drive<br>
// Reset Fault,<br>
// Do state transition to "operation enabled" <br>
}<br>
}<br>
<br>
=============================================================<br>
In Parallel Periodic task:<br>
{<br>
if master activated<br>
{<br>
begining_of_cycle<br>
{<br>
sem_Wait<br>
ecrt_master_receive(master)<br>
ecrt_domain_processs(domain)<br>
sem_Signal<br>
<br>
check_domain_state<br>
check_master_state<br>
}<br>
<br>
...<br>
// Do some stuff<br>
...<br>
<br>
end_of_cycle<br>
{<br>
sem_wait<br>
ecrt_master_application_time()<br>
ecrt_sync_reference_clock()<br>
ecrt_master_sync_slave_clock()<br>
ecrt_domain_queue()<br>
ecrt_master_send()<br>
sem_signal<br>
}<br>
}<br>
}<br>
<br>
=======================================================<br>
In parallel linux kernel task<br>
{<br>
...<br>
</tt><tt> activate_master_using_LinuxKernel_thread <br>
{<br>
ecrt_master_activate(master)<br>
</tt></font></font><font color="#6600cc"><tt>domain_pd =
ecrt_domain_data(domain)<br>
}<br>
...<br>
} <br>
</tt></font>
<br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<blockquote type="cite">
<pre wrap="">
3. If I connect and configure the IO devices next to the drive, at
first I can set the outputs of the device. But due to the problem
above I can not control the device.
</pre>
</blockquote>
<pre wrap="">Which problem above exact you mean?</pre>
</blockquote>
<font color="#3333ff"><br>
</font>
<pre wrap=""><font color="#6600cc">If I use DC (without configuring IO devices), I can't go to operational at first initialisation. I need to re-init the same sequence again.
If I don't use DC I can go to operational at first initialisation.</font></pre>
<br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">
4. If I re-run init sequence, this time my process domain information
some how corrupts. IO device outputs are no longer in the process data.
</pre>
</blockquote>
<pre wrap="">What is done in your init sequence?
There must be something wrong with it.</pre>
</blockquote>
<font color="#6600cc"><br>
I wrote a pseudo code of the init sequence above. Infact I can
send some of the real code also. But I'm not sure if you have
time. <br>
Because I will cut the pieces from many different files, it will
not be easy to follow :(<br>
</font><br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">
5. Regarding to a post by Graeme, I introduced two domains. One for
writing, one for reading. The behaviour remained same.
<a class="moz-txt-link-freetext" href="http://lists.etherlab.org/pipermail/etherlab-users/2012/001737.html">http://lists.etherlab.org/pipermail/etherlab-users/2012/001737.html</a>
</pre>
</blockquote>
<pre wrap="">We do the same here.</pre>
</blockquote>
<font color="#6600cc"><br>
</font><font color="#6600cc">Do you know why we should seperate the
domains? Howmany domains do you use for all the system?<br>
</font><br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">
6. Then I seperated the domains one for IO device, one for motor
driver. Now my controller task suspends with Trap Handler: vector 14
message.
</pre>
</blockquote>
<pre wrap="">I have no idea what the Trap Handler 14 means, we are working on a
mipsel based motion controller.
I assume there must be something wrong with your pdo-sync-setup.</pre>
</blockquote>
<br>
<font color="#6600cc">I get this error when I do some NULL pointer
reference. But I couldn't locate the problem.<br>
If I comment out "ecrt_slave_config_dc" for the drive, I dont get
trap 14 error.</font><br>
<br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<blockquote type="cite">
<pre wrap="">
What is it I'm missing? How should I use DC?
</pre>
</blockquote>
<pre wrap="">Each DC capable device should be setup correct (AssignActivate).
Other non DC capable devices can be used in same domain(s) where DC
devices locate but without synch to real time bus cycle.
General question:
Do you watch your warning and error messages (dmsg) ?
In case of error you will find a lot of helpful information from
etherlab master.</pre>
</blockquote>
<font color="#6600cc"><br>
Yes I check the messages but I didn't notice anything special.
I'll look for it again.<br>
I hope the pseudo code above can tell something to locate the
problem.</font><br>
<br>
<blockquote cite="mid:4FF68AF5.2030606@cantastic.org" type="cite">
<pre wrap="">
regards
Ralf
<font color="#6600cc">
</font></pre>
</blockquote>
<font color="#6600cc">Best regards,<br>
Oguz.</font><br>
<br>
</body>
</html>