[etherlab-users] Bi Directional Modules

Matthieu Bec mbec at gmto.org
Mon Jan 30 19:19:09 CET 2012


Hello Mark,

I don't have an EP2318-0001 to test this, but running our catalog 
extraction tool for the ep2318 produces:

static ec_pdo_entry_info_t pdo_entries[] = {
   {0x0000, 0x0000,  4},  //
   {0x7040, 0x0001,  1},  // Output (bool)
   {0x7050, 0x0001,  1},  // Output (bool)
   {0x7060, 0x0001,  1},  // Output (bool)
   {0x7070, 0x0001,  1},  // Output (bool)
   {0x6000, 0x0001,  1},  // Input (bool)
   {0x6010, 0x0001,  1},  // Input (bool)
   {0x6020, 0x0001,  1},  // Input (bool)
   {0x6030, 0x0001,  1},  // Input (bool)
   {0x0000, 0x0000,  4},  //
};

static ec_pdo_info_t pdos[] = {
   {0x1604,  2, pdo_entries +  0},  // Channel 5
   {0x1605,  1, pdo_entries +  2},  // Channel 6
   {0x1606,  1, pdo_entries +  3},  // Channel 7
   {0x1607,  1, pdo_entries +  4},  // Channel 8
   {0x1a00,  1, pdo_entries +  5},  // Channel 1
   {0x1a01,  1, pdo_entries +  6},  // Channel 2
   {0x1a02,  1, pdo_entries +  7},  // Channel 3
   {0x1a03,  2, pdo_entries +  8},  // Channel 4
};

static ec_sync_info_t syncs[] = {
   {0, EC_DIR_OUTPUT,  4, pdos +  0 },
   {1, EC_DIR_INPUT ,  4, pdos +  4 },
   {2, EC_DIR_INPUT ,  0, NULL },
   {3, EC_DIR_INPUT ,  0, NULL },
   {0xff}
};

that should look reasonably close to what ethercat cstruct gives you, at 
least with version stable-1.5

the code snippet you sent has both EP2318 and EL2004, maybe that's the 
issue. adapt to your setup, something along:

const static ec_pdo_entry_reg_t domain1_regs[] = {
  {EP2318Pos,  Beckhoff_EP2318, 0x6000, 0x0001, &off_di0, &bit_di0},
  {EP2318Pos,  Beckhoff_EP2318, 0x7040, 0x0001, &off_do0, &bit_do0},
  {}
}

Regards,
Matthieu



On 01/30/12 09:13, Mark Olson wrote:
> 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
>
>
>
>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users


-- 
Matthieu Bec                GMTO Corp.
cell:  +1 626 354 9367      P.O. Box 90933
phone: +1 626 204 0527      Pasadena, CA 91109-0933




More information about the Etherlab-users mailing list