This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM6421: EtherCAT subdevice:

Part Number: AM6421

Tool/software:

Used SDK: ind_comms_sdk_am64x_09_02_00_15 (with several patches from TI to improve behaviour of MappingChanged callback)

In our tests, we noticed that the callback for mapping changes (registered by EC_API_SLV_PDO_registerMappingChanges()) is not reliably called by the stack to the application.

During the initial connection setup, everything works fine. However, when I change PDOs (mapping) and SyncManager (assignment) in TwinCAT, it sometimes happens that the process data image of the application and the stack no longer match.

In these cases, I identified that the contents of the PDOs differ. The root cause is the missing invocation of the mapping change callback.

Unfortunately, I cannot yet provide a precise pattern for when this mismatch occurs. Could you please check your code again to ensure that every change to the PDOs triggers this callback?

  • Hello Kai Schröder,

    When the PDO mapping is changed (add/remove PDOs or PDO size) then only the callback attached using API EC_API_SLV_PDO_registerMappingChanges() is triggered and when the PDO assignment is changed then the callback attached using the API EC_API_SLV_PDO_registerAssignmentChanges() is triggered.

    If you could provide your PDO configurations details such as if you are using API EC_API_SLV_PDO_addPadding() to add padded bytes to PDO, number of PDOs and PDO sizes, then we could try to reproduce the same behavior at my end.

    Also, I will once again test these callbacks with Simple demo PDO configurations.

    Kind Regards,

  • Hello Harsha,

    here are some details on my PDOs:

    I use 10 PDOs for Input and 10 PDOs for Output.

    A PDO is always refering to a fix SDO (Index and Subindex does not change) but the size can be changed by the ECAT master. Sizes are in a range from 1 byte up to 32 bytes, therefore also padding is used.

    The configuration after power up is always working. When I start reconfiguring serveral times the missmatch occurs.

    One question: Is the Mapping changed callback of a PDO triggered in any case or only when this PDO is assigned in a syncManager? Is there a way to get the write callbacks of PDOs directly in a object write callback?

    BR
    Kai

  • Hello Kai Schröder,

    The Mapping changed callback attached using API EC_API_SLV_PDO_registerMappingChanges() is triggered only when this PDO is assigned to Sync Manager using PDO assignment object.

    Kind Regards,

  • Hello Harsha,

    do you have any feedback of your tests with the simple demo configuration?

    I still have this issue and the stack is a black box to me so I cannot debug into this.

    And do you have an answer to my question above if it is somehow possible to get the object write callback for PDOs (like the the callback used for CoE Variables EC_API_SLV_CBObjWrite_t).

  • Hello Kai Schröder,

    I could not reproduce the issue that you have mentioned. The callbacks are called when I modify the PDO mappings in TwinCAT.

    Yes. You can register a read/write callback function of type EC_API_SLV_CBObjRead_t, EC_API_SLV_CBObjWrite_t when creating a Variable/Array/Record object. 

    Callback function EC_API_SLV_CBObjWrite_t, is called when the EtherCAT Master (TwinCAT) sends an object write request. If no callback function is registered, then the value pointed to by pData is directly written to the object entry. If a callback function is registered, then it is the responsibility of the callback function to copy the value pointed by pData to the object entry.

    Callback function EC_API_SLV_CBObjRead_tis called when the EtherCAT Master sends an object read request. If no callback function is registered, then the value contained in the object is returned. If a callback function is registered it is the responsibility of the callback function to update the value pointed to by pData. This pData is returned within the SDO Response datagram.

    Kind Regards,

  • Sorry for that confusion, I asked for an callback of the PDO.

  • Hello Kai Schröder,

    The object read/write callbacks for PDOs are not available.

    Kind Regards,

  • Did you also use a PDO configuration with several PDOs and variable size for the PDOs in your tests?

  • Hello Kai Schröder,

    Yes. I tested with several PDOs with different sizes.

    As you said, the configuration always works after power up and when you start reconfiguring several times the mismatch occurs. I would like to know,

    Did mismatch occur after the first-time reconfiguration anytime? or always after several times?

    How often the reconfiguration is done? Is it done too quickly? Can you add a delay between the reconfiguration cycles, just for testing, to check if the same behavior is observed?

    Could you please share the debug logs from the stack here?

    Kind Regards,

  • Hello Harsha,

    I did some more investigation:

    A missmatch occurs when a PDO that is not assigned to a SyncManager gets assigned and configured (here different size).

    TwinCAT will first write the PDO content and then the SyncMgr:

    The ECAT stack does not send a callback for the Mapping change but only for the assignment change:

    When I "activate the configuration" again in TWINCAT (going from Preop again to OP) the PDD mapping callback is called correct:

    So the issue seems to be in the decision of the stack when to update PDOs

  • Hello Kai Schröder,

    Thanks for the information.
    As I specified earlier, the PDO mapping changed callback is triggered only when this PDO is assigned to Sync Manager using PDO assignment object. The EtherCAT slave expects that the PDO is assigned first and then the PDO is reconfigured. In that case, the PDO assignment changed callback is triggered first and then the PDO mapping changed callback is triggered. 

    If I understand correctly, in your case the PDO is reconfigured before it is assigned to SM and then only PDO assignment callback is triggered. 
    Could you please assign the PDO first and then reconfigure assigned PDO and test?

    Kind Regards,

  • Hello Harsha,

    yes, it is looking like you said.

    I have not the possibility to test doing it the other way around because TwinCAT is arranging PDOs and SyncMgr setting in the startup commands on its own.

    But I guess the slave implementation should be able to deal with Beckhoff/ TwinCAT so a rework at the stack makes sense anyway.

  • Hello Kai Schröder,

    Noted. In that case, PDO mapping changed callback will be triggered for all PDO's reconfiguration, irrespective of whether the PDO is assigned or not. Thanks. 

    Kind Regards,

  • Hello Harsha, when will a fix be available?

  • Hello Kai Schröder,

    We were not able to reproduce the issue you mentioned. I did reconfigure a PDO which is not assigned to sync manager and then I assigned this reconfigured PDO to sync manager in TwinCAT. We observed that the PDO mapping changed callback is triggered first and then PDO assignment change callback is triggered as expected.

    Could you please share the logs when only a PDO assignment change callback is triggered?

    Kind Regards,

  • Hello Harsha, 

    just to be sure, the reconfiguration of the PDO in my case changed only the size.

    The index and subindex did not change. Have you tried the same in your tests?

  • Hello Kai Schröder,

    Yes. PDO reconfiguration was done only with the size change. 
    I created a PDO with Index 0x1602 which had only one subindex of size 32bits. I change only the size and assigned this PDO to sync manager assignment object 0x1C12. 

    Kind regards,

  • Hello Kai Schröder,

    It would be helpful if you could try to reproduce this issue with the SDK EtherCAT Simple demo example? 

    You can also create one additional RxPDO or TxPDO and change its size and test it.

    Kind Regards,