<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-NZ link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Jun,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>While that patch looks like an improvement, it will still have the same trouble if the master service is restarted between runs, or if an application wants to include a PDO that is not assigned by default.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I think having ecrt_slave_config_pdos (or actually ec_slave_config_load_default_mapping) upload the mapping from the slave is actually the better solution and not ugly at all, in theory. Bear in mind that this should only happen if the slave is online and if the mapping was not already found in the application-supplied mappings or the previously-read cache. (Though note that the current code structure would do it regardless of whether the application supplied mappings or not, as an unfortunate consequence of the API structure. But it will meet the other two conditions.)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>And it would only be one SDO upload if the slave supports Complete Access, which the master should already know at that point. (Although that’s an optimisation missing from the current PDO configuration code as well.)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Gavin Lambert<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Jun Yuan [mailto:j.yuan@rtleaders.com] <br><b>Sent:</b> Saturday, 31 May 2014 04:24<br><b>To:</b> Gavin Lambert<br><b>Cc:</b> etherlab-users@etherlab.org<br><b>Subject:</b> Re: [etherlab-users] Error reassigning removed PDO<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>Hi Gavin,<o:p></o:p></p></div><p class=MsoNormal style='margin-bottom:12.0pt'>I have a gift for you. The attached patch should make your scenario with different PDOs of interest in different apps working. The problem was that the master always makes the last PDO assign in SyncManager as the default PDO assign, and it don't remember any older PDO assignment. I made a patch to get a memory for the PDO mappings, and it always merge the new PDO mapping list into the old list, instead of throw the old list away. It remembers things. <br><br>It is still not so smart like you said to fetch the PDO assign using their index via CoE automatically. I don't know if it's a good idea for the master to do it blindly. The question is when should the master fetch it. If the master fetches all the PDO mappings during the bus scan, isn't that a waste of time, because most of the time we don't need all of them? If fetch it when needed, the master needs to call several ecrt_master_sdo_upload() in the function ecrt_slave_config_pdos() to fetch the mapping, which makes the code quite ugly. And actually the app can do it itself, and then provides the correct default PDO mapping to the master.<br><br>Hope you enjoy it!<o:p></o:p></p></div><p class=MsoNormal>Regards,<o:p></o:p></p></div><p class=MsoNormal>Jun<o:p></o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p></div></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On 22 April 2014 09:33, Gavin Lambert <<a href="mailto:gavinl@compacsort.com" target="_blank">gavinl@compacsort.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Hi all,<br><br>TLDR: when reassigning PDOs, why doesn't the master read mappings from the<br>slave via CoE?<br><br>I have a (custom) slave that provides a number of different PDOs. I have a<br>couple of different master applications which are interested in different<br>subsets of these PDOs. As an example, let's say that the slave has an RxPDO<br>at 0x1600 that points to 0x7000:0x00:0x20, and one app wants to use this<br>value and the other doesn't.<br><br>If the master apps just use ecrt_domain_reg_pdo_entry_list to register the<br>PDOs of interest, then they both work (assuming that the slave has all the<br>required PDOs assigned by default), but it wastes space in the packet as the<br>whole SM is transferred even if some of the data is not of interest to that<br>particular master app. (And in the case of outputs, it forces the master<br>app to write something even when it doesn't want to, lest the slave get<br>uninitialized data and think it needs to do something with it.)<br><br>If the master apps use ecrt_slave_config_pdos to select the PDOs of<br>interest, then things get troublesome. If the master apps specify the full<br>mappings explicitly, then again things work, but as the slave does not<br>support remapping (just reassignment) this generates warnings, and it just<br>seems ugly to me to have to specify all this data that the slave already<br>knows. (And it makes things more brittle, as if the mapping is changed in a<br>future version of the slave it will generate an error instead of just<br>working, as it would if it had loaded the slave's current mappings.)<br><br>If the master apps don't specify the full mappings, however (just the sync<br>manager -> PDO assignments, which seems like it's a supported scenario given<br>the docs and examples), then results are mixed. If the slave is rebooted<br>prior to running either master app, it works. If not, then the master app<br>that wants the extra PDO will fail to run.<br><br>The problem case seems to be:<br> - slave boots, has all PDOs in SII and CoE PDO assign.<br> - first app runs, specifies PDO Assign to not include 0x1600.<br> - runs successfully.<br> - PDO Assign is updated in the actual slave.<br> - second app runs, specifies PDO Assign to include 0x1600.<br> - fails at ecrt_reg_pdo_entry_list as it cannot find a mapping for<br>0x7000:0x00.<br> - problem is "Loading default mapping for PDO 0x1600." - "No default<br>mapping found."<br> - PDO Assign of the actual slave is never actually updated in this case<br>as it fails before it activates the slave configs.<br> - "ethercat rescan" / "ethercat pdos" at this point does not show 0x1600.<br> - it requires rebooting the slave, or manually updating PDO Assign (and<br>rescanning) before the master will admit that it exists again.<br><br>Shouldn't this scenario work? The PDO is always specified in the SII, even<br>if not presently in PDO Assign, so the master ought to know that it exists.<br>And failing that, it could just try to read the mappings directly from the<br>slave (if CoE is available) when unable to load default mapping from its<br>cache. (I think part of the problem is that the CoE data appears to be<br>replacing the SII data in the master's PDO cache.)<br><br>I'm also a little puzzled as to why (if it wants to have a cache of PDO<br>mappings) it seems to limit itself to reading only the currently assigned<br>PDOs during the initial scan, instead of fetching all of them. They<br>shouldn't be hard to find -- they can be identified purely by their index.<br><br>It shouldn't be all that uncommon to have a slave that provides PDOs that<br>aren't in the default PDO Assign, or to provide more information than needed<br>for particular master apps. Is it just expected that master apps always<br>hard-code the full mappings, instead of fetching the mappings from the<br>slave? Or is this something missing from the library at present?<br><br>Regards,<br>Gavin Lambert<br><br><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><o:p></o:p></p></div><p class=MsoNormal><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>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ü. <o:p></o:p></p></div></div></div></body></html>