<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 15 (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:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri",sans-serif;}
span.emailstyle17
{mso-style-name:emailstyle17;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.spelle
{mso-style-name:spelle;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle23
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
@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 bgcolor=white lang=EN-NZ link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hi </span><span style='font-size:12.0pt'>Jakub,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt'>Most EtherCAT slaves do not allow you to arbitrarily remap the contents of PDOs (the entries in the <span style='color:black'>ec_pdo_entry_info_t); only to select between different predefined groups of PDOs via the ec_pdo_info_t. Some don’t support even that and just have a fixed layout (especially devices that don’t support CoE).<o:p></o:p></span></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Have a look in the manual for your slave device to see what combinations it supports. Also note that indexes outside the 0x6000 or 0xA000 range are rarely available to be mapped as PDOs; you may need to access it as an SDO instead. If this is for a one-time startup configuration setting rather than for cyclic data, then look at the ecrt_slave_config_sdo* family of functions.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Another thing that you can look at is to look in the syslog after running your application; if you’re trying to change a PDO and the device does not support this then it should log a warning. You might need to set “ethercat debug 1” before running your application – this includes quite a bit of extra detail about the slave configuration process.</span><span style='mso-fareast-language:EN-US'><o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D;mso-fareast-language:EN-US'><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 #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> etherlab-users [mailto:etherlab-users-bounces@etherlab.org] <b>On Behalf Of </b>j.sikorski@utwente.nl<br><b>Sent:</b> Wednesday, 15 June 2016 06:40<br><b>To:</b> etherlab-users@etherlab.org<br><b>Subject:</b> [etherlab-users] I cannot proceed with configuration of PDOs using Libethercat.<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal><span style='color:black'>Dear <span class=spelle>EtherLab</span> Users,<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:black'>I installed the IgH EtherCAT master, and to educate myself how to implement the communication, I set up a small network comprising of IgH master and one Technosoft Motion iPOS4808 drive.<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:black'>The ./ethercat slaves command detects it.<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:black'>The ./ethercat cstruct gives me the following configuration:<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>ec_pdo_entry_info_t slave_0_pdo_entries[] = {<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x6040, 0x00, 16},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x607a, 0x00, 32},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x6041, 0x00, 16},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x6064, 0x00, 32},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x6077, 0x00, 16},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x60f4, 0x00, 32},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x60fd, 0x00, 32},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>};<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>ec_pdo_info_t slave_0_pdos[] = {<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x1600, 2, slave_0_pdo_entries + 0},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x1a00, 3, slave_0_pdo_entries + 2},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0x1a01, 2, slave_0_pdo_entries + 5},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>};<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>ec_sync_info_t slave_0_syncs[] = {<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_DISABLE},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {3, EC_DIR_INPUT, 2, slave_0_pdos + 1, EC_WD_DISABLE},<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'> {0xff}<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>};<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Now I want to use C++ functions, to change the value outputted at 0x1a00 x02 to the object 0x2058 x00 with size 16 bit.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Hence, based on the cstruct file, as well as ~/ethercat-1.5.2/example/user/main.c , I write the following code (spread over main.h and main.cpp) to achieve this.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><pre><span style='color:navy'>#include</span><span style='color:silver'> </span><span style='color:green'>"auxfun.h"</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>Application</span><span style='color:silver'> </span><span style='color:green'>parameters</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:navy'>#define</span><span style='color:silver'> </span><span style='color:navy'>FREQUENCY</span><span style='color:silver'> </span><span style='color:navy'>100</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:navy'>#define</span><span style='color:silver'> </span><span style='color:navy'>PRIORITY</span><span style='color:silver'> </span><span style='color:navy'>1</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>Optional</span><span style='color:silver'> </span><span style='color:green'>features</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:navy'>#define</span><span style='color:silver'> </span><span style='color:navy'>CONFIGURE_PDOS</span><span style='color:silver'> </span><span style='color:navy'>1</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:navy'>#define</span><span style='color:silver'> </span><span style='color:navy'>SDO_ACCESS</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>EtherCAT</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_master_t</span><span style='color:silver'> </span><span style='color:black'>*master</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:navy'>NULL</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_master_state_t</span><span style='color:silver'> </span><span style='color:black'>master_state</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_domain_t</span><span style='color:silver'> </span><span style='color:black'>*domain1</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:navy'>NULL</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_domain_state_t</span><span style='color:silver'> </span><span style='color:black'>domain1_state</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_slave_config_t</span><span style='color:silver'> </span><span style='color:black'>*sc_iPOS0</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:navy'>NULL</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_slave_config_state_t</span><span style='color:silver'> </span><span style='color:black'>sc_iPOS0_state</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>Timer</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:olive'>unsigned</span><span style='color:silver'> </span><span style='color:olive'>int</span><span style='color:silver'> </span><span style='color:black'>sig_alarms</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:olive'>unsigned</span><span style='color:silver'> </span><span style='color:olive'>int</span><span style='color:silver'> </span><span style='color:black'>user_alarms</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>/****************************************************************************/</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>process</span><span style='color:silver'> </span><span style='color:green'>data</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:black'>uint8_t</span><span style='color:silver'> </span><span style='color:black'>*domain1_pd</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:navy'>NULL</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:navy'>#define</span><span style='color:silver'> </span><span style='color:navy'>AxisBotPos</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:silver'> </span><span style='color:green'>//Bottom</span><span style='color:silver'> </span><span style='color:green'>frame</span><span style='color:silver'> </span><span style='color:green'>iPOS</span><span style='color:silver'> </span><span style='color:green'>Alias</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:navy'>#define</span><span style='color:silver'> </span><span style='color:navy'>IPOS4808BX_CAT</span><span style='color:silver'> </span><span style='color:navy'>0x000001a3</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x019f418d</span><span style='color:silver'> </span><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>Vendor</span><span style='color:silver'> </span><span style='color:green'>ID,</span><span style='color:silver'> </span><span style='color:green'>Product</span><span style='color:silver'> </span><span style='color:green'>Code</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:olive'>const</span><span style='color:silver'> </span><span style='color:olive'>static</span><span style='color:silver'> </span><span style='color:purple'>ec_pdo_entry_reg_t</span><span style='color:silver'> </span><span style='color:black'>domain1_regs[]</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>AxisBotPos</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>IPOS4808BX_CAT</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x6060</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>&off_iPOS0_Rx},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>AxisBotPos</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>IPOS4808BX_CAT</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x2058</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>&off_iPOS0_Tx},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{}<o:p></o:p></span></pre><pre><span style='color:black'>};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>//</span><span style='color:silver'> </span><span style='color:green'>Analog</span><span style='color:silver'> </span><span style='color:green'>in</span><span style='color:silver'> </span><span style='color:green'>--------------------------</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:purple'>ec_pdo_entry_info_t</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo_entries[]</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x6040</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>16</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x6060</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>8</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x6041</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>16</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x2058</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>16</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x6077</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>16</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x60f4</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>32</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x60fd</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0x00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>32</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:black'>};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:purple'>ec_pdo_info_t</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo[]</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x1600</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>2</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo_entries</span><span style='color:silver'> </span><span style='color:black'>+</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x1a00</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>3</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo_entries</span><span style='color:silver'> </span><span style='color:black'>+</span><span style='color:silver'> </span><span style='color:navy'>2</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0x1a01</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>2</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo_entries</span><span style='color:silver'> </span><span style='color:black'>+</span><span style='color:silver'> </span><span style='color:navy'>5</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:black'>};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:purple'>ec_sync_info_t</span><span style='color:silver'> </span><span style='color:black'>iPOS0_syncs[]</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_DIR_OUTPUT</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>NULL</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_WD_DISABLE</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>1</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_DIR_INPUT</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>NULL</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_WD_DISABLE</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>2</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_DIR_OUTPUT</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>1</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo</span><span style='color:silver'> </span><span style='color:black'>+</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_WD_DISABLE</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>3</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_DIR_INPUT</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>2</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>iPOS0_pdo</span><span style='color:silver'> </span><span style='color:black'>+</span><span style='color:silver'> </span><span style='color:navy'>1</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:purple'>EC_WD_DISABLE</span><span style='color:black'>},<o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>{</span><span style='color:navy'>0xff</span><span style='color:black'>}<o:p></o:p></span></pre><pre><span style='color:black'>};<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:navy'>#include</span><span style='color:silver'> </span><span style='color:green'>"main.h"</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:green'>/****************************************************************************/</span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:olive'>int</span><span style='color:silver'> </span><span style='color:black'>main(</span><span style='color:olive'>int</span><span style='color:silver'> </span><span style='color:black'>argc,</span><span style='color:silver'> </span><span style='color:olive'>char</span><span style='color:silver'> </span><span style='color:black'>**argv)<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='font-family:"Cambria Math",serif;color:black'></span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>struct</span><span style='color:silver'> </span><span style='color:purple'>itimerval</span><span style='color:silver'> </span><span style='color:black'>tv;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>master</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>ecrt_request_master(</span><span style='color:navy'>0</span><span style='color:black'>);<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>if</span><span style='color:silver'> </span><span style='color:black'>(!master)<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>return</span><span style='color:silver'> </span><span style='color:black'>-</span><span style='color:navy'>1</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='font-family:"Cambria Math",serif;color:black'></span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>domain1</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>ecrt_master_create_domain(master);<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>if</span><span style='color:silver'> </span><span style='color:black'>(!domain1)<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>return</span><span style='color:silver'> </span><span style='color:black'>-</span><span style='color:navy'>1</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>if</span><span style='color:silver'> </span><span style='color:black'>(!(sc_iPOS0</span><span style='color:silver'> </span><span style='color:black'>=</span><span style='color:silver'> </span><span style='color:black'>ecrt_master_slave_config(<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>master,</span><span style='color:silver'> </span><span style='color:navy'>AxisBotPos</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:navy'>IPOS4808BX_CAT</span><span style='color:black'>)))</span><span style='color:silver'> </span><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>fprintf(stderr,</span><span style='color:silver'> </span><span style='color:green'>"Failed</span><span style='color:silver'> </span><span style='color:green'>to</span><span style='color:silver'> </span><span style='color:green'>get</span><span style='color:silver'> </span><span style='color:green'>slave</span><span style='color:silver'> </span><span style='color:green'>configuration.\n"</span><span style='color:black'>);<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>return</span><span style='color:silver'> </span><span style='color:black'>-</span><span style='color:navy'>1</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>}<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>printf(</span><span style='color:green'>"Configuring</span><span style='color:silver'> </span><span style='color:green'>PDOs...\n"</span><span style='color:black'>);<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>if</span><span style='color:silver'> </span><span style='color:black'>(ecrt_slave_config_pdos(sc_iPOS0,</span><span style='color:silver'> </span><span style='color:navy'>4</span><span style='color:black'>,</span><span style='color:silver'> </span><span style='color:black'>iPOS0_syncs))</span><span style='color:silver'> </span><span style='color:black'>{<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>fprintf(stderr,</span><span style='color:silver'> </span><span style='color:green'>"Failed</span><span style='color:silver'> </span><span style='color:green'>to</span><span style='color:silver'> </span><span style='color:green'>configure</span><span style='color:silver'> </span><span style='color:green'>PDOs.\n"</span><span style='color:black'>);<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:olive'>return</span><span style='color:silver'> </span><span style='color:black'>-</span><span style='color:navy'>1</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>}<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:silver'> </span><span style='color:black'>cout</span><span style='color:silver'> </span><span style='color:black'><<</span><span style='color:silver'> </span><span style='color:green'>"Done"</span><span style='color:silver'> </span><span style='color:black'><<</span><span style='color:silver'> </span><span style='color:black'>endl;<o:p></o:p></span></pre><pre><span style='color:olive'>return</span><span style='color:silver'> </span><span style='color:navy'>0</span><span style='color:black'>;<o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><pre><span style='color:black'>}</span><span style='font-family:"Cambria Math",serif;color:black'></span><span style='color:black'><o:p></o:p></span></pre><pre><span style='color:black'><o:p> </o:p></span></pre><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>I run the code above. It executes with no problem.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Now, I checked, using: <o:p></o:p></span></p></div><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>sudo ethercat upload -a 0 0x1a00 01<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>whether the introduced mapping modification worked. Unfortunately it seems that it is not the case and I get the same variable that was in ./ethercat cstruct at that position.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Then I tried to change the variable manually using ./ethercat download <span style='background:white'>-a 0 0x1a00 01 </span>0x20580010. This worked, at least in the console (confirmed by ./ethercat upload). However, cstruct still outputs previous values. I also tried the same procedure with other PDO variables to the same effect, my C++ code changes nothing in the mapping.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>If anyone of you could look into the code and tell me whether what I am doing is correct (or wrong), I would be exteremely grateful. I mostly do not know where even to start debugging right now.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Thank you a lot in advance.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Yours faithfully,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;color:black'>Jakub Sikorski<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:black'><o:p> </o:p></span></p></div></div></div></body></html>