[etherlab-users] EL2252: SII eeprom and XML config mismatch

hamelin.philippe at ireq.ca hamelin.philippe at ireq.ca
Tue Jan 22 21:07:28 CET 2013


Hello,

I think I've finally found the problem but I'm not sure about the best fix. First, here is a summary of the problem:

The control registers of both SM0 and SM1 in the SII data report that these sync managers are inputs (because ControlRegister = 0). Indeed, here is a snippet of the XML description file for this device:

[...]
	<Sm StartAddress="#x0981" Virtual="true">Outputs</Sm>
	<Sm StartAddress="#x0990" Virtual="true">Outputs</Sm>
	<Sm StartAddress="#x0f00" ControlByte="#x44" Enable="1" OpOnly="1">Outputs</Sm>
	<Sm StartAddress="#x0910" Virtual="true">Inputs</Sm>
	<Sm StartAddress="#x1000" Virtual="true">Inputs</Sm>
[...]

As we can see, only SM2 (0x0f00) has a non-null ControlByte, where bit 2 means that this is an output. Altough the SM control registers of SII data wrongly reports SM0 and SM1 as inputs, this is correct with respect to the XML file. The problem is that using bit 2 of control register doesn't seem to be a robust way to determine the sync manager direction. In fact, byte 0x0007 (Sync Manager Type) of the SII SyncM category seems to be much more reliable (at least in this case). However, maybe this way of deducing the direction is only used in the command line tool for display purpose?

The obvious fix that I see is to add a 'sync_type' member in the 'ec_sync_t' structure, which will be initialized with the value at the 0x0007 address (Sync Manager Type) of this particular SM in the SII SyncM category. What do you think about that? 

One thing that I don't know and probably only Florian may answer is: is there somewhere in the code that the direction is also deduced from the control register?

Philippe

-----Message d'origine-----
De : etherlab-users-bounces at etherlab.org [mailto:etherlab-users-bounces at etherlab.org] De la part de hamelin.philippe at ireq.ca
Envoyé : 22 janvier 2013 14:22
À : mbec at gmto.org
Cc : etherlab-users at etherlab.org
Objet : Re: [etherlab-users] EL2252: SII eeprom and XML config mismatch

Hello,

I'm still investigating the problem, but I think I've found some part of the problem. I traced the code which reads TxPDO/RxPDO (slave.c : ec_slave_fetch_sii_pdos(...)) from the SII and this seems correct:

TxPDO found (SII category 0x32):
 - 0x1a00 'SysTime'
 - 0x1a01 'Feedback'

RxPDO found (SII category 0x33): 
 - 0x1602 'DC Sync Activate' mapped to SM0
 - 0x1603 'DC Sync Start' mapped to SM1
 - 0x1600 'Channel 1' mapped to SM2
 - 0x1601 'Channel 2' mapped to SM2

However, when using the command line tool I get the following:

$ ethercat -p1 pdo
SM0: PhysAddr 0x0981, DefaultSize    0, ControlRegister 0x00, Enable 12
  TxPDO 0x1602 "DC Sync Activate"
    PDO entry 0x1d09:81,  8 bit, "Activate"
SM1: PhysAddr 0x0990, DefaultSize    0, ControlRegister 0x00, Enable 4
  TxPDO 0x1603 "DC Sync Start"
    PDO entry 0x1d09:90, 64 bit, "StartTime"
SM2: PhysAddr 0x0f00, DefaultSize    0, ControlRegister 0x44, Enable 9
  RxPDO 0x1600 "Channel 1"
    PDO entry 0x7000:01,  1 bit, "Output"
    PDO entry 0x7000:02,  1 bit, "TriState"
  RxPDO 0x1601 "Channel 2"
    PDO entry 0x7010:01,  1 bit, "Output"
    PDO entry 0x7010:02,  1 bit, "TriState"
    PDO entry 0x0000:00,  4 bit, ""
  RxPDO 0x1604 "Reserved"
SM3: PhysAddr 0x0910, DefaultSize    0, ControlRegister 0x00, Enable 4
SM4: PhysAddr 0x1000, DefaultSize    0, ControlRegister 0x00, Enable 4


As we can see, 0x1602 and 0x1603 are reported as TxPDO instead of RxPDO. Moreover, 0x1602 and 0x1603 are not in the valid address range for TxPDO (0x1a00 -> 0x1bff). Looking at the command line tool source code, the direction (RxPDO vs. TxPDO) is deduced from the bit 2 of the sync manager 'Control Register'. I'm currently trying to validate that, but for the moment I think that the SII control register reports SM0 and SM1 as 'Inputs' (TxPDO) while the associated PDOs are rather RxPDO.

Thank you for your help!

Philippe

-----Message d'origine-----
De : Matthieu Bec [mailto:mbec at gmto.org] Envoyé : 22 janvier 2013 13:55 À : Hamelin, Philippe Cc : etherlab-users at etherlab.org Objet : Re: [etherlab-users] EL2252: SII eeprom and XML config mismatch

Hello Philippe,

see Gavin's reply for clarification on in/out and Rx/Tx

> Outputs:
> - SM0: DC Sync Activate
> - SM1: DC Sync Start
> - SM2: Channel 1 & 2 outputs

Your `ethercat pdo` report seems in agreement

> Inputs:
> - SM3: SysTime and Feedback

Those show 'unticked' in my twcat by default (xml entries have no default SM). The mapping has to be done by hand, some
ecrt_slave_config_pdos() in your application startup.

Matthieu




On 1/22/13 7:39 AM, hamelin.philippe at ireq.ca wrote:
> Hi,
>  
> as far as I know, given that the device doesn't support CoE, the PDO 
> informations are fetched in the SII eeprom by Etherlab. Am I right?
>  
> So if TwinCat doesn't give me the same PDO informations are Etherlab, 
> there may be two reasons:
>  
> a) Etherlab doesn't interpret the SII correctly (I would be surprised 
> of
> that)
> b) TwinCAT doesn't interpret the SII, but the XML file which may be 
> more complete
>  
> Any comments are welcome, thank you!
>  
> Philippe
>  
> ----------------------------------------------------------------------
> -- *De :* etherlab-users-bounces at etherlab.org
> [mailto:etherlab-users-bounces at etherlab.org] *De la part de* 
> hamelin.philippe at ireq.ca *Envoyé :* 21 janvier 2013 16:42 *À :* 
> etherlab-users at etherlab.org *Objet :* Re: [etherlab-users] EL2252: SII 
> eeprom and XML config mismatch
> 
> Hi again,
>  
> let me correct my interpretation:
>  
> SM2 is and must be a RxPDO. The problem is rather on SM0 and SM1 which 
> should be also RxPDO. Also, I generated a SII binary file using 
> TwinCat, then uploaded the content to the slave. However, except that 
> the description of the slave is now in english instead of deutch, I 
> get the same result. It's very strange that the new SII didn't 
> resolved the problem. In TwinCat, the sync manager and pdo mapping is 
> correctly shown with respect to the XML file. However, it's like the 
> generated SII binary file doesn't match?
>  
> Thank you,
>  
> Philippe
> 
> ----------------------------------------------------------------------
> -- *De :* etherlab-users-bounces at etherlab.org
> [mailto:etherlab-users-bounces at etherlab.org] *De la part de* 
> hamelin.philippe at ireq.ca *Envoyé :* 21 janvier 2013 15:48 *À :* 
> etherlab-users at etherlab.org *Objet :* [etherlab-users] EL2252: SII 
> eeprom and XML config mismatch
> 
> Hi,
>  
> I'm having troubles using the Beckhoff EL2252 with Etherlab. According 
> to the documentation and the XML file, I should have 5 sync managers:
>  
> Outputs:
> - SM0: DC Sync Activate
> - SM1: DC Sync Start
> - SM2: Channel 1 & 2 outputs
>  
> Inputs:
> - SM3: SysTime and Feedback
>  
> However, when connecting the slave to the Etherlab master I get the 
> following config (which is fixed by the device):
>  
> $ ethercat -p 1 pdo
> SM0: PhysAddr 0x0981, DefaultSize    0, ControlRegister 0x00, Enable 12
>   TxPDO 0x1602 "DC Sync Activate"
>     PDO entry 0x1d09:81,  8 bit, "Activate"
> SM1: PhysAddr 0x0990, DefaultSize    0, ControlRegister 0x00, Enable 4
>   TxPDO 0x1603 "DC Sync Start"
>     PDO entry 0x1d09:90, 64 bit, "StartTime"
> SM2: PhysAddr 0x0f00, DefaultSize    0, ControlRegister 0x44, Enable 9
>   RxPDO 0x1600 "Channel 1"
>     PDO entry 0x7000:01,  1 bit, "Output"
>     PDO entry 0x7000:02,  1 bit, "TriState"
>   RxPDO 0x1601 "Channel 2"
>     PDO entry 0x7010:01,  1 bit, "Output"
>     PDO entry 0x7010:02,  1 bit, "TriState"
>     PDO entry 0x0000:00,  4 bit, ""
>   RxPDO 0x1604 "Reserved"
> SM3: PhysAddr 0x0910, DefaultSize    0, ControlRegister 0x00, Enable 4
> SM4: PhysAddr 0x1000, DefaultSize    0, ControlRegister 0x00, Enable 4
>  
> Is doesn't make any sense to me that SM2 is a RxPDO since this is the 
> output state that the master should provides. Moreover, the PDO 
> mapping is fixed by the device so I can't configure my own mapping. I 
> see two possibles problems:
>  
> a) The SII eeprom isn't correct;
> or,
> b) I don't understand the meaning of these lines :-)
>  
> Any ideas?
>  
> Thank you,
>  
> ------------------------------------
> Philippe Hamelin, ing., M. Ing
> Chercheur / Researcher
> 
> T: 450-652-8499 x2198
> F: 450-652-1316
> 
> Expertise robotique et civil
> Institut de recherche d'Hydro-Québec (IREQ) 1740, boul. Lionel-Boulet 
> Varennes (QC) J3X 1S1, Canada
>  
> 
> 
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users
> 
_______________________________________________
etherlab-users mailing list
etherlab-users at etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users



More information about the Etherlab-users mailing list