To List,<div><br></div><div><br></div><div>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. </div>
<div><br></div><div><br></div><div><br></div><div>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?</div>
<div><br></div><div><div><div><br class="Apple-interchange-newline"><br></div><div>#define FPBlockSlavePos 0, 4</div><div>#define DigOutSlavePos 0, 2</div><div>#define DigOutSlavePos1 0, 3</div><div><br></div><div>#define Beckhoff_EL2004 0x00000002, 0x07D43052</div>
<div>#define Beckhoff_EL3162 0x00000002, 0x0C5A3052</div><div>#define Beckhoff_EP2318 0x00000002, 0x090e4052</div><div><br></div><div>static unsigned int off_dig_bi; // offsets for PDO entries</div><div>static unsigned int off_dig_out;</div>
<div><br></div><div>static unsigned int bit_offset1 ;</div><div>static unsigned int bit_offset2 ;</div><div><br></div><div>const static ec_pdo_entry_reg_t domain1_regs[] = {</div><div> {FPBlockSlavePos, Beckhoff_EP2318, 0x6000, 1, &off_dig_bi,&bit_offset2},</div>
<div>// {DigOutSlavePos, Beckhoff_EL2004, 0x3001, 1, &off_dig_out,&bit_offset1},</div><div> {DigOutSlavePos1, Beckhoff_EL2004, 0x7000, 1, &off_dig_bi,&bit_offset2},</div><div> {}</div><div>};</div>
<div><br></div></div></div><div><br></div><div>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. </div>
<div><br></div><div>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)</div>
<div><br></div><div><div> printk(KERN_INFO PFX "Registering PDO entries...\n");</div><div> if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {</div><div> printk(KERN_ERR PFX "PDO entry registration failed!\n");</div>
<div> goto out_release_master;</div><div> }</div><div><br></div><div> printk(KERN_INFO PFX " offset %d:%d and %d:%d\n",</div><div> off_dig_out,bit_offset1,</div><div> off_dig_bi,bit_offset2) ;</div>
<div><br></div><div> printk(KERN_INFO PFX "Activating master...\n");</div><div> if (ecrt_master_activate(master)) {</div><div> printk(KERN_ERR PFX "Failed to activate master!\n");</div><div>
goto out_release_master;</div><div> }</div><div><br></div><div> // Get internal process data for domain</div><div> domain1_pd = ecrt_domain_data(domain1);</div></div><div><br></div><div><br></div><div>Suggestions?</div>
<div><br></div><div><br></div><div>Thanks in advance,</div><div><br></div><div>Mark Olson</div><div><div><br></div></div><div><br></div>