Hi,

Sometimes a piece of code is better than explanations ...
Here is mine, which configures the PDO of the CanOpen side on my EL6731

static int err_code;
static int cnt;
static int x, y, z, i, num_config_lines;
static char app_str[1024];
static unsigned char pb_config_buf[2048];
static int ecrt_retval;
uint32_t    value_to_write;
uint32_t    abort_code;

struct config_item {
    unsigned int slave_pos;
    unsigned short address;
    char * config_string;
};

// 6 Atos Hydraulic valves without rxpdo2
const config_item config [] = {

        // EL67xx CoE Init Cmd 2 (F800:00)
{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"},
        // EL67xx CoE Init Cmd 3 (8000:00)
{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"},
        // EL67xx CoE Init Cmd 4 (8006:00)
{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"},
        // EL67xx CoE Init Cmd 5 (8008:00)
{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"},
        // EL67xx CoE Init Cmd 6 (8003:00)
{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"},
        // EL67xx CoE Init Cmd 7 (8010:00)
{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"},
        // EL67xx CoE Init Cmd 8 (8016:00)
{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"},
        // EL67xx CoE Init Cmd 9 (8018:00)
{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"},
        // EL67xx CoE Init Cmd 10 (8013:00)
{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"},
        // EL67xx CoE Init Cmd 11 (8020:00)
{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"},
        // EL67xx CoE Init Cmd 12 (8026:00)
{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"},
        // EL67xx CoE Init Cmd 13 (8028:00)
{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"},
        // EL67xx CoE Init Cmd 14 (8023:00)
{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"},
        // EL67xx CoE Init Cmd 15 (8030:00)
{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"},
        // EL67xx CoE Init Cmd 16 (8036:00)
{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"},
        // EL67xx CoE Init Cmd 17 (8038:00)
{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"},
        // EL67xx CoE Init Cmd 18 (8033:00)
{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"},
        // EL67xx CoE Init Cmd 19 (8040:00)
{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"},
        // EL67xx CoE Init Cmd 20 (8046:00)
{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"},
        // EL67xx CoE Init Cmd 21 (8048:00)
{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"},
        // EL67xx CoE Init Cmd 22 (8043:00)
{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"},
        // EL67xx CoE Init Cmd 23 (8050:00)
{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"},
        // EL67xx CoE Init Cmd 24 (8056:00)
{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"},
        // EL67xx CoE Init Cmd 25 (8058:00)
{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"},
        // EL67xx CoE Init Cmd 26 (8053:00)
{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"},
        // download pdo 0x1C12 index
        {19, 0x1C12, "06 00 00 16 01 16 02 16 03 16 04 16 05 16"},
        // download pdo 0x1C13 index
{19, 0x1C13, "0A 00 00 1A 01 1A 02 1A 03 1A 04 1A 05 1A 81 1A 82 1A 83 1A 84 1A"}
};

num_config_lines = sizeof(config)/sizeof(config_item);

for (x=0 ; x<num_config_lines ; x++ ) {
cout << "Downloading obj " << config[x].address << " " << config[x].config_string << " \n";
    y=0;
for (z=0 ; z<strlen(config[x].config_string) ; z++) if (config[x].config_string[z] != ' ') app_str[y++]=config[x].config_string[z];

    app_str[y]='\0';
    cnt = strToCharArray(app_str, pb_config_buf);
if ((err_code = ecrt_slave_config_complete_sdo(slave_config_list[config[x].slave_pos], config[x].address, pb_config_buf, cnt)) != 0) { // if ((err_code = ecrt_slave_config_complete_sdo(config[x].slave_pos, config[x].address, pb_config_buf, cnt)) != 0) { cout << "Object configuration failed " << config[x].address << " Errocode = " << err_code << "\n";
        cout << "Data is: " << pb_config_buf  << "\n";
        cout << "Data size is: " << cnt  << "\n";
        exit(-1);
    } else {
cout << "Downloading obj " << config[x].address << " " << app_str << " OK\n";
    }
}


On 19/01/2016 16:05, Matze Thias wrote:
Hello,

I am trying to configure the EL6751 at the moment, so that I am able to send raw CAN messages over ethercat(http://infosys.beckhoff.com/content/1033/el6751/html/el6751_layer2_statemachine.htm?id=10857). 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?

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:

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). Jan 19 15:50:06 e-node8 kernel: [611927.059801] EtherCAT ERROR 0-1: Unknown AL status code 0xF101.

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 :) ?

Greetings,

Matze Thias



_______________________________________________
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users

_______________________________________________
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users

Reply via email to