Well, of course.  Unless otherwise indicated by the device vendor, PDOs and 
SDOs are both in RAM only so will naturally revert to defaults if you reboot 
the device.

 

Regarding your other issue, does your program actually exit immediately after 
calling ecrt_slave_config_pdos?  I assumed that you had a complete application 
and you had just edited the rest out.

 

If so, that won’t work.  The various ecrt_slave_config_* functions just specify 
to the master library what you would like the configuration to be – nothing 
actually changes on the network until you call ecrt_master_activate afterwards. 
 Additionally, PDOs are only actually exchanged while you have a master loop 
running.  Have a look at the example programs included with EtherLab.

 

(If you just want to verify the configuration manually without actually running 
an application loop, then you can call ecrt_master_activate and then 
immediately release the master and exit if you like, but to actually accomplish 
anything useful you need an application loop.)

 

From: j.sikor...@utwente.nl [mailto:j.sikor...@utwente.nl] 
Sent: Thursday, 16 June 2016 00:06
To: Gavin Lambert <gavin.lamb...@compacsort.com>
Cc: etherlab-users@etherlab.org
Subject: Re: [etherlab-users] I cannot proceed with configuration of PDOs using 
Libethercat.

 

Dear Gavin,

 

Oh, and I forgot. Any changes I introduce using "sudo ethercat download" ​are 
reverted once the I reboot (power off - power on) my controllers.

 

Yours sincerely,

Jakub Sikorski

  _____  

From: etherlab-users <etherlab-users-boun...@etherlab.org 
<mailto:etherlab-users-boun...@etherlab.org> > on behalf of 
j.sikor...@utwente.nl <mailto:j.sikor...@utwente.nl>  <j.sikor...@utwente.nl 
<mailto:j.sikor...@utwente.nl> >
Sent: 15 June 2016 13:59
To: gav...@compacsort.com <mailto:gav...@compacsort.com> 
Cc: etherlab-users@etherlab.org <mailto:etherlab-users@etherlab.org> 
Subject: Re: [etherlab-users] I cannot proceed with configuration of PDOs using 
Libethercat. 

 

Dear Gavin,

 

Thank you very, very much for your help!

 

According to the manual of my slave I should be able to map 0x2058 to PDO. What 
is puzzling me is that it seems that I have done that, using the following 
series of console commands:

 

 

sudo ethercat download -a 0 0x1a00 00 0x00

 

sudo ethercat download -a 0 0x1a00 01 0x20580010

 

sudo ethercat download -a 0 0x1a00 00 0x0​2

 

Now polling the slave with:

 

sudo ethercat upload -a 0 0x1a00 01

 

gives me:

 

0x20580010 542638096

 

However, if I execute ethercat cstruct -a 0, the field corresponding to 0x1a00 
01 is still:

 

{0x6041, 0x00, 16}

 

which was the previous value.

 

Running the ecrt_slave_config_pdos changes nothing in the slave config, as 
inspected later on by sudo ethercat upload.

But do I understand correctly, that it should alter the configuration of the 
slave automatically, using the slave config, to the mapping I specified ealier 
in the file? Or do I have to run ecrt_master_activate(master) first so that all 
my actions are implemented?

 


I thought that all of this might also be caused by ec_slave_config_t passed on 
to ecrt_slave_config_pdos not being correct. I tried to dereference and output 
it, after it was generated by ecrt_master_slave_config, but I failed to compile 
such code.


This realisation was brought to me, as command:

 

sudo ethercat config 

 

gives no visible output for any for my slaves.

 

 

I will be grateful for any more feedback.

 

Yours sincerely,

Jakub Sikorski

 

 

 

 

 

 

 

 

 

 

From: Gavin Lambert [mailto:gav...@compacsort.com] 
Sent: woensdag 15 juni 2016 1:31
To: Sikorski, J. (CTW) <j.sikor...@utwente.nl <mailto:j.sikor...@utwente.nl> >
Cc: etherlab-users@etherlab.org <mailto:etherlab-users@etherlab.org> 
Subject: RE: [etherlab-users] I cannot proceed with configuration of PDOs using 
Libethercat.

 

Hi Jakub,

 

Most EtherCAT slaves do not allow you to arbitrarily remap the contents of PDOs 
(the entries in the 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).

 

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.

 

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.

 

From: etherlab-users [ <mailto:etherlab-users-boun...@etherlab.org> 
mailto:etherlab-users-boun...@etherlab.org] On Behalf Of  
<mailto:j.sikor...@utwente.nl> j.sikor...@utwente.nl
Sent: Wednesday, 15 June 2016 06:40
To:  <mailto:etherlab-users@etherlab.org> etherlab-users@etherlab.org
Subject: [etherlab-users] I cannot proceed with configuration of PDOs using 
Libethercat.

 

Dear EtherLab Users,

 

 

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.

 

The ./ethercat slaves command detects it.

 

The ./ethercat cstruct gives me the following configuration:

 

ec_pdo_entry_info_t slave_0_pdo_entries[] = {

    {0x6040, 0x00, 16},

    {0x607a, 0x00, 32},

    {0x6041, 0x00, 16},

    {0x6064, 0x00, 32},

    {0x6077, 0x00, 16},

    {0x60f4, 0x00, 32},

    {0x60fd, 0x00, 32},

};

 

ec_pdo_info_t slave_0_pdos[] = {

    {0x1600, 2, slave_0_pdo_entries + 0},

    {0x1a00, 3, slave_0_pdo_entries + 2},

    {0x1a01, 2, slave_0_pdo_entries + 5},

};

 

ec_sync_info_t slave_0_syncs[] = {

    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},

    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},

    {2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_DISABLE},

    {3, EC_DIR_INPUT, 2, slave_0_pdos + 1, EC_WD_DISABLE},

    {0xff}

};

 

Now I want to use C++ functions, to change the value outputted at 0x1a00 x02 to 
the object 0x2058 x00 with size 16 bit.

 

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.

 

#include "auxfun.h"
// Application parameters
#define FREQUENCY 100
#define PRIORITY 1
 
// Optional features
#define CONFIGURE_PDOS  1
#define SDO_ACCESS      0
 
 
// EtherCAT
static ec_master_t *master = NULL;
static ec_master_state_t master_state = {};
 
static ec_domain_t *domain1 = NULL;
static ec_domain_state_t domain1_state = {};
 
static ec_slave_config_t *sc_iPOS0 = NULL;
static ec_slave_config_state_t sc_iPOS0_state = {};
 
// Timer
static unsigned int sig_alarms = 0;
static unsigned int user_alarms = 0;
 
/****************************************************************************/
 
// process data
static uint8_t *domain1_pd = NULL;
 
#define AxisBotPos  0, 0 //Bottom frame iPOS Alias
 
#define IPOS4808BX_CAT 0x000001a3, 0x019f418d // Vendor ID, Product Code
 
 
const static ec_pdo_entry_reg_t domain1_regs[] = {
    {AxisBotPos,  IPOS4808BX_CAT, 0x6060, 0x00, &off_iPOS0_Rx},
    {AxisBotPos,  IPOS4808BX_CAT, 0x2058, 0x00, &off_iPOS0_Tx},
    {}
};
 
 
// Analog in --------------------------
ec_pdo_entry_info_t iPOS0_pdo_entries[] = {
    {0x6040, 0x00, 16},
    {0x6060, 0x00, 8},
    {0x6041, 0x00, 16},
    {0x2058, 0x00, 16},
    {0x6077, 0x00, 16},
    {0x60f4, 0x00, 32},
    {0x60fd, 0x00, 32},
};
 
ec_pdo_info_t iPOS0_pdo[] = {
    {0x1600, 2, iPOS0_pdo_entries + 0},
    {0x1a00, 3, iPOS0_pdo_entries + 2},
    {0x1a01, 2, iPOS0_pdo_entries + 5},
};
 
ec_sync_info_t iPOS0_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 1, iPOS0_pdo + 0, EC_WD_DISABLE},
    {3, EC_DIR_INPUT, 2, iPOS0_pdo + 1, EC_WD_DISABLE},
    {0xff}
};
 
 
 
#include "main.h"
 
 
 
/****************************************************************************/
 
int main(int argc, char **argv)
 
{
 
​​
    struct itimerval tv;
 
 
 
    master = ecrt_request_master(0);
 
    if (!master)
 
        return -1;
 
​
 
    domain1 = ecrt_master_create_domain(master);
 
    if (!domain1)
 
        return -1;
 
 
    if (!(sc_iPOS0 = ecrt_master_slave_config(
 
                    master, AxisBotPos, IPOS4808BX_CAT))) {
 
        fprintf(stderr, "Failed to get slave configuration.\n");
 
        return -1;
 
    }
 
    printf("Configuring PDOs...\n");
 
    if (ecrt_slave_config_pdos(sc_iPOS0, 4, iPOS0_syncs)) {
 
        fprintf(stderr, "Failed to configure PDOs.\n");
 
        return -1;
 
    }
 
    cout << "Done" << endl;
return 0;
 
 
}​
 

 

 

I run the code above. It executes with no problem.

 

Now, I checked, using: 

 

sudo ethercat upload -a 0 0x1a00 01

 

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.

 

Then I tried to change the variable manually using ./ethercat download -a 0 
0x1a00 01 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.

 

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.

 

Thank you a lot in advance.

 

Yours faithfully,

Jakub Sikorski

 

 

 

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

Reply via email to