Hi, I am new in the ethercat community and am trying to configure my devices. My
configuration :

$ ethercat slaves
0  1:0  PREOP  +  EK1100 EtherCAT-Koppler (2A E-Bus)
1  1:1  PREOP  +  EL2008 8Ch. Dig. Output 24V, 0.5A
2  1:2  PREOP  E  EL3102 2K. Ana. Eingang +/-10V, DIFF

I am testing the devices using the example code available in /example/user/main.c in the main package.

When I launch it without modifying it, I get this :

Configuring PDOs...
Activating master...
pd: 0
Starting timer...
Started.
3 slave(s).
AL states: 0x02.
Link is up.
AL states: 0x0A.

After the modification of position of my modules according to their physical position (especially for the EL3102 AnaInSlavePos ):

#define BusCouplerPos  0, 0
#define DigOutSlavePos 0, 1
#define AnaInSlavePos  0, 2
#define AnaOutSlavePos 0, 4

, I get this, which is a pretty good result :

Configuring PDOs...
Activating master...
pd: 0
Starting timer...
Started.
3 slave(s).
AL states: 0x03.
Link is up.
AnaIn: State 0x01.
AnaIn: online.
Domain1: WC 1.
Domain1: State 1.
AL states: 0x0A.
AnaIn: State 0x08.
AnaIn: operational.

So the EL3102 module is detected and operationnal.

Now my aim is to get the same result with my EL2008 module. The example code is using a EL2004 module, which is the same only with 8 outputs. To do this, I generate the module configuration using

$ ethercat -p1 cstruct
/* Slave 1, "EL2008"
 * Vendor ID:       0x00000002
 * Product code:    0x07d83052
 * Revision number: 0x00100000
 */

ec_pdo_entry_info_t slave_1_pdo_entries[] = {
   {0x7000, 0x01, 1}, /* Output */
   {0x7010, 0x01, 1}, /* Output */
   {0x7020, 0x01, 1}, /* Output */
   {0x7030, 0x01, 1}, /* Output */
   {0x7040, 0x01, 1}, /* Output */
   {0x7050, 0x01, 1}, /* Output */
   {0x7060, 0x01, 1}, /* Output */
   {0x7070, 0x01, 1}, /* Output */
};

ec_pdo_info_t slave_1_pdos[] = {
   {0x1600, 1, slave_1_pdo_entries + 0}, /* Channel 1 */
   {0x1601, 1, slave_1_pdo_entries + 1}, /* Channel 2 */
   {0x1602, 1, slave_1_pdo_entries + 2}, /* Channel 3 */
   {0x1603, 1, slave_1_pdo_entries + 3}, /* Channel 4 */
   {0x1604, 1, slave_1_pdo_entries + 4}, /* Channel 5 */
   {0x1605, 1, slave_1_pdo_entries + 5}, /* Channel 6 */
   {0x1606, 1, slave_1_pdo_entries + 6}, /* Channel 7 */
   {0x1607, 1, slave_1_pdo_entries + 7}, /* Channel 8 */
};

ec_sync_info_t slave_1_syncs[] = {
   {0, EC_DIR_OUTPUT, 8, slave_1_pdos + 0, EC_WD_ENABLE},
};

So now I replace the product code ID in my code, and the configuration part of the EL2004 by this one, to get the following configuration (I keep the el2004 names):

#if CONFIGURE_PDOS

// Analog in --------------------------

static ec_pdo_entry_info_t el3102_pdo_entries[] = {
    {0x3101, 1,  8}, // channel 1 status
    {0x3101, 2, 16}, // channel 1 value
    {0x3102, 1,  8}, // channel 2 status
    {0x3102, 2, 16}, // channel 2 value
    {0x6401, 1, 16}, // channel 1 value (alt.)
    {0x6401, 2, 16}  // channel 2 value (alt.)
};

static ec_pdo_info_t el3102_pdos[] = {
    {0x1A00, 2, el3102_pdo_entries},
    {0x1A01, 2, el3102_pdo_entries + 2}
};

static ec_sync_info_t el3102_syncs[] = {
    {2, EC_DIR_OUTPUT},
    {3, EC_DIR_INPUT, 2, el3102_pdos},
    {0xff}
};

// Analog out -------------------------

static ec_pdo_entry_info_t el4102_pdo_entries[] = {
    {0x3001, 1, 16}, // channel 1 value
    {0x3002, 1, 16}, // channel 2 value
};

static ec_pdo_info_t el4102_pdos[] = {
    {0x1600, 1, el4102_pdo_entries},
    {0x1601, 1, el4102_pdo_entries + 1}
};

static ec_sync_info_t el4102_syncs[] = {
    {2, EC_DIR_OUTPUT, 2, el4102_pdos},
    {3, EC_DIR_INPUT},
    {0xff}
};

// Digital out ------------------------

static ec_pdo_entry_info_t el2004_channels[] = {
    {0x7000, 0x01, 1},
   {0x7010, 0x01, 1},
   {0x7020, 0x01, 1},
   {0x7030, 0x01, 1},
   {0x7040, 0x01, 1},
   {0x7050, 0x01, 1},
   {0x7060, 0x01, 1},
   {0x7070, 0x01, 1}
};

static ec_pdo_info_t el2004_pdos[] = {
    {0x1600, 1, &el2004_channels[0]},
   {0x1601, 1, &el2004_channels[1]},
   {0x1602, 1, &el2004_channels[2]},
   {0x1603, 1, &el2004_channels[3]},
   {0x1604, 1, &el2004_channels[4]},
   {0x1605, 1, &el2004_channels[5]},
   {0x1606, 1, &el2004_channels[6]},
   {0x1607, 1, &el2004_channels[7]}
};

static ec_sync_info_t el2004_syncs[] = {
    {0, EC_DIR_OUTPUT, 8, el2004_pdos, EC_WD_ENABLE},
    {0xff}
};
//*************************************

#endif

But now I get the following error :

Configuring PDOs...
Failed to register PDO entry: No such file or directory
PDO entry registration failed!

I don't understand this error. Indeed, when using the configuration of the device I do not have, there is no problem, and when I replace it by the code directly generated by my device, I meet this problem...

What do you think about it ? Did i forgot something ?

Thank you in advance !

Roland


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

Reply via email to