[etherlab-users] Strange PDO configuration behavior [solved]

Mirco Cremasco mirco at cremasco.eu
Fri May 8 18:42:57 CEST 2020


Sorry, it was a stupid mistake in my code,
I was using wrong slave config when calling ecrt_slave_config_pdos

Bye

On 08/05/20 17:40, Mirco Cremasco wrote:
> Hallo all,
> I'm testing a setup with 3 modules, EL1018 (input) EL2008 (output) and 
> a EL5151-0021 (encoder).
> After succesfull configuring  PDO using information gathered with 
> "ethercat cstruct" command (see pdo_entry struct below) ,
> when I  write to digital output with
> EC_WRITE_U8(domain1_pd + off_dig_out, outval);
> it doesn't work!
> meanwhile EL1018 end El5151 work correctly.
> If I leave EL5151 unconfigured  (USE_ENC21 undefined)  EL2008 works 
> properly.
> What I noted is in the output of "ethercat domains --verbose" the  
> digital output slave has size  14
> while it should be equal to 1
>
> Can anyone help me?
> Thanks
> Mirco
>
> #ethercat domains --verbose
> Domain0: LogBaseAddr 0x00000000, Size  47, WorkingCounter 4/6
>   SlaveConfig 0:1, SM2 (Output), LogAddr 0x00000000, Size 14
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00
>   SlaveConfig 0:1, SM3 ( Input), LogAddr 0x0000000e, Size 18
>     00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>     00 00
>   SlaveConfig 0:2, SM0 ( Input), LogAddr 0x00000020, Size 1
>     00
>   SlaveConfig 0:3, SM2 (Output), LogAddr 0x00000021, Size 14
>     20 00 00 00 00 00 00 00 00 00 00 00 00 00
> #ethercat domains --verbose
> Domain0: LogBaseAddr 0x00000000, Size   2, WorkingCounter 3/3
>   SlaveConfig 0:2, SM0 ( Input), LogAddr 0x00000000, Size 1
>     00
>   SlaveConfig 0:3, SM0 (Output), LogAddr 0x00000001, Size 1
>     00
>
>
>
> const static ec_pdo_entry_reg_t domain1_regs[] = {
> #ifdef USE_ENC21
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x1, 
> &offw_5151_ctrl, &bit_enable_latchC}, //EC_WRITE_BIT(DATA, POS, VAL)
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x2, 
> &offw_5151_ctrl, &bit_enable_exTlatch_pos},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x3, 
> &offw_5151_ctrl, &bit_set_counter},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x4, 
> &offw_5151_ctrl, &bit_enable_extlatch_neg},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x5, 
> &offw_5151_ctrl, &bit_set_output},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x6, 
> &offw_5151_ctrl, &bit_enable_output_func},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x7, 
> &offw_5151_ctrl, &bit_enable_measure},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x8, 
> &offw_5151_ctrl, &bit_set_counter_on_latchC},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x11, 
> &offw_5151_set_counter_value},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x12, 
> &offw_5151_set_on_thr_value},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x7000, 0x13, 
> &offw_5151_set_off_thr_value},
>
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x1, 
> &offr_5151_status1, &bit_latchC_valid},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x2, 
> &offr_5151_status1, &bit_exTlatch_valid},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x3, 
> &offr_5151_status1, &bit_set_counter_done},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6001, 0x2, 
> &offr_5151_status3, &bit_measurement_done},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x9, 
> &offr_5151_status2, &bit_A_status},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0xa, 
> &offr_5151_status2, &bit_B_status},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0xb, 
> &offr_5151_status2, &bit_C_status},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6001, 0x1, 
> &offr_5151_status4, &bit_output_status},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0xd, 
> &offr_5151_status2, &bit_exTlatch_status},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0xe, 
> &offr_5151_status5, &bit_counter_high},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x10, 
> &offr_5151_status6, &bit_txpod_toggle},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x11, 
> &offr_5151_couter_value},
>     {EncTrgSlavePos, Beckhoff_EL5151_0021, 0x6000, 0x12, 
> &offr_5151_latch_value},
> #endif
>     {DigInSlavePos, Beckhoff_EL1018, 0x6000, 1, &off_dig_in,NULL},
>     {DigOutSlavePos, Beckhoff_EL2008, 0x7000, 1, &off_dig_out,NULL},
>     {}
> };
>
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20200508/15d982bb/attachment-0004.htm>


More information about the Etherlab-users mailing list