[etherlab-users] Bi Directional Modules
Mark Olson
molson at numinagroup.com
Mon Jan 30 18:13:14 CET 2012
To List,
Last week I posted a short notice indicating I was having difficulty
getting bi-directional modules to work, for example the EP2318-0001 (four
digital inputs, four digital outputs). If I get it to work in both input
and output directions I'm certain I can get that module integrated into our
industrial application.
Below is the block from rtai_sample.c modiificed for the EP2318. One
concern is (and admittedly has been) the discrepancy between the published
values of the offset parameter (0x6000, 0x7000 vs 0x3001) which has to be
changed from what is described in the output by running "ethercat pdos" and
that described listed in the xml published by Beckhoff (and where the
0x3001 comes from as used in the distributed rtai_sample.c). For single
directions in that parameter in the ec_pdo_entry_reg_t I had been using
output from "ethercat pdos" to locate the value to use for the offset. Is
that wrong? What method should be used?
#define FPBlockSlavePos 0, 4
#define DigOutSlavePos 0, 2
#define DigOutSlavePos1 0, 3
#define Beckhoff_EL2004 0x00000002, 0x07D43052
#define Beckhoff_EL3162 0x00000002, 0x0C5A3052
#define Beckhoff_EP2318 0x00000002, 0x090e4052
static unsigned int off_dig_bi; // offsets for PDO entries
static unsigned int off_dig_out;
static unsigned int bit_offset1 ;
static unsigned int bit_offset2 ;
const static ec_pdo_entry_reg_t domain1_regs[] = {
{FPBlockSlavePos, Beckhoff_EP2318, 0x6000, 1, &off_dig_bi,&bit_offset2},
// {DigOutSlavePos, Beckhoff_EL2004, 0x3001, 1,
&off_dig_out,&bit_offset1},
{DigOutSlavePos1, Beckhoff_EL2004, 0x7000, 1, &off_dig_bi,&bit_offset2},
{}
};
Last week it was suggested I use the output of "ethercat cstruct" to get
the bi-directional comms working. Yet, the output of cstruct only gives SDO
structure data, which is listed as "optional" in the rtai_sample.c When
compiled in it makes no difference in the produced data, although it
produces no errors.
Question? Has anyone out there gotten bi directional communications working
with Etherlab/Ethercat with RTAI for modules which have both inputs and
outputs? Do you have to do more setup work to the domain besides using
ecrt_domain_red_pdo_entry_list()? (as below)
printk(KERN_INFO PFX "Registering PDO entries...\n");
if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
printk(KERN_ERR PFX "PDO entry registration failed!\n");
goto out_release_master;
}
printk(KERN_INFO PFX " offset %d:%d and %d:%d\n",
off_dig_out,bit_offset1,
off_dig_bi,bit_offset2) ;
printk(KERN_INFO PFX "Activating master...\n");
if (ecrt_master_activate(master)) {
printk(KERN_ERR PFX "Failed to activate master!\n");
goto out_release_master;
}
// Get internal process data for domain
domain1_pd = ecrt_domain_data(domain1);
Suggestions?
Thanks in advance,
Mark Olson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20120130/a4149c1d/attachment-0003.htm>
More information about the Etherlab-users
mailing list