Hallo Maggie,<br><br>I don't think the design of the function ecrt_domain_reg_pdo_entry_list() takes PDO entries with identical index&subindex but different PDO index into consideration. Because normally it doesnot happen.<br>
<br>Although we can modify this function to take PDO index as an additional parameter, there is a much easier way for your application with AX5201, without changing the etherlab code.<br><br>There is a trick, when you register the first pdo entry into the domain, this domain already contains the complete pdo data of the corresponding sync manager. All you need to do is to calculate the correct offset by yourself to access the other pdo entries in the same sync manager. <br>
<br>i.e. when you register the first pdo entry "{0x0086, 0x00, 16}, /* Master control word */" into a domain, you get the offset_ctrl1 for the first pdo entry. Then the offset for the second pdo entry is :<br>offset_vel1 = offset_ctrl + the size of "Master control word" = offset_ctrl1 + 2;<br>
The offset for the third pdo entry, the second "Master control word" is :<br>offset_ctr2 = offset_vel1 + the size of "Velocity command value" = offset_vel1 + 4 = offset_ctrl1 + 6;<br><br>Of course, then you can do the same thing to AT "Drive status word", just notice that they(AT) are in another sync manager. So you'll need to register the first "Drive status word" into a domain to get the offset begin for that.<br>
<br>With these offsets, you can modify your cyclic data as usual.<br><br>P.S. ecrt_master_write_idn() is not for use in cycle.<br><br><br>Regards,<br>Jun Yuan<br><br><div class="gmail_quote">On Tue, Oct 23, 2012 at 9:24 AM, Min Yang <span dir="ltr"><<a href="mailto:yang.min@sibonac.com" target="_blank">yang.min@sibonac.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hello all,</div><div> </div><div>I am using Beckhoff AX5201(2 channel servo drive), the cstruct is:</div><div> </div>
<div> #/opt/etherlab/bin/ethercat cstruct -p1 <div> ec_pdo_entry_info_t slave_1_pdo_entries[] = {<br>
{0x0086, 0x00, 16}, /* Master control word */<br>{0x0024, 0x00, 32}, /* Velocity command value */<br>{0x0086, 0x00, 16}, /* Master control word */<br>{0x0024, 0x00, 32}, /* Velocity command value */<br>{0x0087, 0x00, 16}, /* Drive status word */<br>
{0x0033, 0x00, 32}, /* Position feedback 1 value */<br>{0x0087, 0x00, 16}, /* Drive status word */<br>{0x0033, 0x00, 32}, /* Position feedback 1 value */<br>};<br>ec_pdo_info_t slave_1_pdos[] = {<br>{0x0018, 2, slave_1_pdo_entries + 0}, /* MDT 1 */<br>
{0x1018, 2, slave_1_pdo_entries + 2}, /* MDT 2 */<br>{0x0010, 2, slave_1_pdo_entries + 4}, /* AT 1 */<br>{0x1010, 2, slave_1_pdo_entries + 6}, /* AT 2 */<br>};<br>ec_sync_info_t slave_1_syncs[] = {<br>{0, <font face="arial,helvetica,sans-serif">EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE</font>},<br>
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},<br>{2, EC_DIR_OUTPUT, 2, slave_1_pdos + 0, EC_WD_DISABLE},<br>{3, EC_DIR_INPUT, 2, slave_1_pdos + 2, EC_WD_DISABLE},<br>{0xff}<br>}; </div><div> </div><div>I need to write "Master control word "of 2 channels in cycle(because 1 channel controls 1 servo). But their pdo entries is the same, if I register both of them to domain with ecrt_slave_config_reg_pdo_entry(), how to distinguish them?</div>
<div>I also try to write them like this:</div><div>ecrt_master_write_idn(master, 0, 0, 0x86, pdata0, 2, error_code); //for channel 1 drive_no=0</div><div><div>ecrt_master_write_idn(master, 0, 1, 0x86, pdata0, 2, error_code); //for channel 2 drive_no=1</div>
<div>but when I put them in cycle, I got an error "<font style="background-color:rgb(255,255,102)">Failed to write IDN:Iput/output error</font>", then the drive stayed in INIT. Why I got this error? What's the best solution for my problem?</div>
<div> </div><div>Best Regards</div><div>Maggie</div></div></div>
<br>_______________________________________________<br>
etherlab-users mailing list<br>
<a href="mailto:etherlab-users@etherlab.org">etherlab-users@etherlab.org</a><br>
<a href="http://lists.etherlab.org/mailman/listinfo/etherlab-users" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Jun Yuan<br>[Aussprache: Djün Üän]<br><br>Robotics Technology Leaders GmbH<br>Am Loferfeld 58, D-81249 München<br>Tel: +49 89 189 0465 24<br>Mobile: +49 176 2176 5238<br>
Fax: +49 89 189 0465 11<br>mailto: <a href="mailto:j.yuan@rtleaders.com" target="_blank">j.yuan@rtleaders.com</a><br><br>Umlautregel in der chinesischen Lautschrift Pinyin: Nach den Anlauten y, j, q, und x wird u als ü ausgesprochen, z.B. yu => ü, ju => dschü, qu => tschü, xu => schü.<br>