<div dir="ltr"><div><div>Thank you Thomas for sharing your code :) In my code I'm doing
 almost the same, except that I do encode the configuration bytes 
directly in an array instead of converting it from a string.<br><br>Also
 I do not have to configure CANOpen-Slaves. The only slave listening on 
the CAN-Bus expects "raw"(Layer2)-CAN-Messages and do not understand the
 higher-level CANOpen-Protocol. When I configure it that way, I always 
get <br><span class="im"><br> EtherCAT ERROR 0-1: Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).<br></span><span class="im"> EtherCAT ERROR 0-1: Unknown AL status code 0xF101<br></span></div><div><br></div><div>PS: I just dumped the device info via ethercat slaves -v. I got:<br></div><br><br>General:<br>  Group: Communication<br>  Image name:<br>  Order number: EL6751<br>  Device name: EL6751 CANopen Master<br>  CoE details:<br>    Enable SDO: yes<br>    Enable SDO Info: yes<br>    Enable PDO Assign: no<br>    Enable PDO Configuration: no<br>    Enable Upload at startup: no<br>    Enable SDO complete access: yes<br>  Flags:<br>    Enable SafeOp: no<br>    Enable notLRW: no<br>  Current consumption: 300 mA<br><br><br></div>So
 flags are saying, that SafeOp is not enabled. Does that mean that 
SafeOP does not exist? Considering the error message is there any 
correlation? How can I fix this?</div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-20 12:44 GMT+01:00 Thomas Paoloni <span dir="ltr"><<a href="mailto:thomas@digithom.it" target="_blank">thomas@digithom.it</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Hi,<br>
      <br>
      Sometimes a piece of code is better than explanations ...<br>
      Here is mine, which configures the PDO of the CanOpen side on my
      EL6731<br>
      <br>
      static int err_code;<br>
      static int cnt;<br>
      static int x, y, z, i, num_config_lines;<br>
      static char app_str[1024];<br>
      static unsigned char pb_config_buf[2048];<br>
      static int ecrt_retval;<br>
      uint32_t    value_to_write;<br>
      uint32_t    abort_code;<br>
      <br>
      struct config_item {<br>
          unsigned int slave_pos;<br>
          unsigned short address;<br>
          char * config_string;<br>
      };<br>
      <br>
      // 6 Atos Hydraulic valves without rxpdo2<br>
      const config_item config [] = {<br>
      <br>
              // EL67xx CoE Init Cmd 2 (F800:00)<br>
              {19, 0xF800, "11 00 7F 06 80 00 10 27 00 00 00 00 00 00 00
      1E 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 3 (8000:00)<br>
              {19, 0x8000, "2E 00 01 00 98 01 00 07 F4 00 00 00 02 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64
      00 03 00 D0 07 D0 07 05 00 0A 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 4 (8006:00)<br>
              {19, 0x8006, "03 00 81 01 00 00 FF 02 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00"},<br>
              // EL67xx CoE Init Cmd 5 (8008:00)<br>
              {19, 0x8008, "04 00 01 02 00 00 FF 02 00 00 00 00 00 00 01
      03 00 00 FF 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 6 (8003:00)<br>
              {19, 0x8003, "0E 00 00 18 01 04 00 81 01 00 00 00 18 02 01
      00 FF 01 18 01 04 00 81 03 00 00 01 18 02 01 00 FF 02 18 01 04 00
      81 04 00 00 02 18 02 01 00 FF 00 14 01 04 00 01 02 00 00 00 14 02
      01 00 FF 01 14 01 04 00 01 03 00 00 01 14 02 01 00 FF 02 14 01 04
      00 01 04 00 00 02 14 02 01 00 FF 03 14 01 04 00 01 05 00 00 03 14
      02 01 00 FF"},<br>
              // EL67xx CoE Init Cmd 7 (8010:00)<br>
              {19, 0x8010, "2E 00 02 00 98 01 00 07 F4 00 00 00 02 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64
      00 03 00 D0 07 D0 07 05 00 0A 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 8 (8016:00)<br>
              {19, 0x8016, "03 00 82 01 00 00 FF 02 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00"},<br>
              // EL67xx CoE Init Cmd 9 (8018:00)<br>
              {19, 0x8018, "04 00 02 02 00 00 FF 02 00 00 00 00 00 00 02
      03 00 00 FF 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 10 (8013:00)<br>
              {19, 0x8013, "0E 00 00 18 01 04 00 82 01 00 00 00 18 02 01
      00 FF 01 18 01 04 00 82 03 00 00 01 18 02 01 00 FF 02 18 01 04 00
      82 04 00 00 02 18 02 01 00 FF 00 14 01 04 00 02 02 00 00 00 14 02
      01 00 FF 01 14 01 04 00 02 03 00 00 01 14 02 01 00 FF 02 14 01 04
      00 02 04 00 00 02 14 02 01 00 FF 03 14 01 04 00 02 05 00 00 03 14
      02 01 00 FF"},<br>
              // EL67xx CoE Init Cmd 11 (8020:00)<br>
              {19, 0x8020, "2E 00 03 00 98 01 00 07 F4 00 00 00 02 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64
      00 03 00 D0 07 D0 07 05 00 0A 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 12 (8026:00)<br>
              {19, 0x8026, "03 00 83 01 00 00 FF 02 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00"},<br>
              // EL67xx CoE Init Cmd 13 (8028:00)<br>
              {19, 0x8028, "04 00 03 02 00 00 FF 02 00 00 00 00 00 00 03
      03 00 00 FF 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 14 (8023:00)<br>
              {19, 0x8023, "0E 00 00 18 01 04 00 83 01 00 00 00 18 02 01
      00 FF 01 18 01 04 00 83 03 00 00 01 18 02 01 00 FF 02 18 01 04 00
      83 04 00 00 02 18 02 01 00 FF 00 14 01 04 00 03 02 00 00 00 14 02
      01 00 FF 01 14 01 04 00 03 03 00 00 01 14 02 01 00 FF 02 14 01 04
      00 03 04 00 00 02 14 02 01 00 FF 03 14 01 04 00 03 05 00 00 03 14
      02 01 00 FF"},<br>
              // EL67xx CoE Init Cmd 15 (8030:00)<br>
              {19, 0x8030, "2E 00 04 00 98 01 00 07 F4 00 00 00 02 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64
      00 03 00 D0 07 D0 07 05 00 0A 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 16 (8036:00)<br>
              {19, 0x8036, "03 00 84 01 00 00 FF 02 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00"},<br>
              // EL67xx CoE Init Cmd 17 (8038:00)<br>
              {19, 0x8038, "04 00 04 02 00 00 FF 02 00 00 00 00 00 00 04
      03 00 00 FF 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 18 (8033:00)<br>
              {19, 0x8033, "0E 00 00 18 01 04 00 84 01 00 00 00 18 02 01
      00 FF 01 18 01 04 00 84 03 00 00 01 18 02 01 00 FF 02 18 01 04 00
      84 04 00 00 02 18 02 01 00 FF 00 14 01 04 00 04 02 00 00 00 14 02
      01 00 FF 01 14 01 04 00 04 03 00 00 01 14 02 01 00 FF 02 14 01 04
      00 04 04 00 00 02 14 02 01 00 FF 03 14 01 04 00 04 05 00 00 03 14
      02 01 00 FF"},<br>
              // EL67xx CoE Init Cmd 19 (8040:00)<br>
              {19, 0x8040, "2E 00 05 00 98 01 00 07 F4 00 00 00 02 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64
      00 03 00 D0 07 D0 07 05 00 0A 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 20 (8046:00)<br>
              {19, 0x8046, "03 00 85 01 00 00 FF 02 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00"},<br>
              // EL67xx CoE Init Cmd 21 (8048:00)<br>
              {19, 0x8048, "04 00 05 02 00 00 FF 02 00 00 00 00 00 00 05
      03 00 00 FF 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 22 (8043:00)<br>
              {19, 0x8043, "0E 00 00 18 01 04 00 85 01 00 00 00 18 02 01
      00 FF 01 18 01 04 00 85 03 00 00 01 18 02 01 00 FF 02 18 01 04 00
      85 04 00 00 02 18 02 01 00 FF 00 14 01 04 00 05 02 00 00 00 14 02
      01 00 FF 01 14 01 04 00 05 03 00 00 01 14 02 01 00 FF 02 14 01 04
      00 05 04 00 00 02 14 02 01 00 FF 03 14 01 04 00 05 05 00 00 03 14
      02 01 00 FF"},<br>
              // EL67xx CoE Init Cmd 23 (8050:00)<br>
              {19, 0x8050, "2E 00 06 00 98 01 00 07 F4 00 00 00 02 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 64
      00 03 00 D0 07 D0 07 05 00 0A 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 24 (8056:00)<br>
              {19, 0x8056, "03 00 86 01 00 00 FF 02 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00"},<br>
              // EL67xx CoE Init Cmd 25 (8058:00)<br>
              {19, 0x8058, "04 00 06 02 00 00 FF 02 00 00 00 00 00 00 06
      03 00 00 FF 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      00 00 00 00 00 00 00 00 00 00 00 00 00"},<br>
              // EL67xx CoE Init Cmd 26 (8053:00)<br>
              {19, 0x8053, "0E 00 00 18 01 04 00 86 01 00 00 00 18 02 01
      00 FF 01 18 01 04 00 86 03 00 00 01 18 02 01 00 FF 02 18 01 04 00
      86 04 00 00 02 18 02 01 00 FF 00 14 01 04 00 06 02 00 00 00 14 02
      01 00 FF 01 14 01 04 00 06 03 00 00 01 14 02 01 00 FF 02 14 01 04
      00 06 04 00 00 02 14 02 01 00 FF 03 14 01 04 00 06 05 00 00 03 14
      02 01 00 FF"},<br>
              // download pdo 0x1C12 index<br>
              {19, 0x1C12, "06 00 00 16 01 16 02 16 03 16 04 16 05 16"},<br>
              // download pdo 0x1C13 index<br>
              {19, 0x1C13, "0A 00 00 1A 01 1A 02 1A 03 1A 04 1A 05 1A 81
      1A 82 1A 83 1A 84 1A"}<br>
      };<br>
      <br>
      num_config_lines = sizeof(config)/sizeof(config_item);<br>
      <br>
      for (x=0 ; x<num_config_lines ; x++ ) {<br>
          cout << "Downloading obj " << config[x].address
      << " " << config[x].config_string << "   \n";<br>
          y=0;<br>
          for (z=0 ; z<strlen(config[x].config_string) ; z++) if
      (config[x].config_string[z] != ' ')
      app_str[y++]=config[x].config_string[z];<br>
       <br>
          app_str[y]='\0';<br>
          cnt = strToCharArray(app_str, pb_config_buf);<br>
          if ((err_code =
      ecrt_slave_config_complete_sdo(slave_config_list[config[x].slave_pos],
      config[x].address, pb_config_buf, cnt)) != 0) {<br>
      //    if ((err_code =
      ecrt_slave_config_complete_sdo(config[x].slave_pos,
      config[x].address, pb_config_buf, cnt)) != 0) {<br>
              cout << "Object configuration failed " <<
      config[x].address << " Errocode = " << err_code
      << "\n";<br>
              cout << "Data is: " << pb_config_buf  <<
      "\n";<br>
              cout << "Data size is: " << cnt  <<
      "\n";<br>
              exit(-1);<br>
          } else {<br>
              cout << "Downloading obj " <<
      config[x].address << " " << app_str << "  
      OK\n";<div><div class="h5"><br>
          }<br>
      }<br>
      <br>
      <br>
      On 19/01/2016 16:05, Matze Thias wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>
          <div>Hello,<br>
            <br>
          </div>
          I am trying to configure the EL6751 at the moment, so that I
          am able to send raw CAN messages over ethercat(<a href="http://infosys.beckhoff.com/content/1033/el6751/html/el6751_layer2_statemachine.htm?id=10857" target="_blank">http://infosys.beckhoff.com/content/1033/el6751/html/el6751_layer2_statemachine.htm?id=10857</a>).<br>
          I took the configuration, which is done in terms of
          sdo-startup-downloads, from one of the twincat dialogs. Which
          method for sdo configuration is the right to choose?<br>
          <br>
        </div>
        <div>If I use ecrt_master_sdo_download_complete for the
          different SDO-Objects to upload, nothing happens. When using
          ecrt_slave_config_complete_sdo the device error-led starts
          blinking(indicating, that some configuration is in progress)
          but at the same time I get this:<br>
          <br>
          Jan 19 15:50:06 e-node8 kernel: [611927.053364] EtherCAT ERROR
          0-1: Failed to set SAFEOP state, slave refused state change
          (PREOP + ERROR).<br>
          Jan 19 15:50:06 e-node8 kernel: [611927.059801] EtherCAT ERROR
          0-1: Unknown AL status code 0xF101.<br>
          <br>
        </div>
        <div>Can anyone explain the error and has a solution for this?
          Maybe someone has experience in getting the el6751 configured
          and work-ready for this scenario and can share his insights :)
          ?<br>
          <br>
        </div>
        <div>Greetings,<br>
          <br>
        </div>
        <div>Matze Thias<br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
etherlab-users mailing list
<a href="mailto:etherlab-users@etherlab.org" target="_blank">etherlab-users@etherlab.org</a>
<a href="http://lists.etherlab.org/mailman/listinfo/etherlab-users" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a>
</pre>
    </blockquote>
    <br>
  </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" rel="noreferrer" target="_blank">http://lists.etherlab.org/mailman/listinfo/etherlab-users</a><br>
<br></blockquote></div><br></div>