Hello, I would like to add an EtherCAT IO device. What should I do

More
6 months 4 weeks ago #345102 by cekaa
Is there a place to learn how to use XML?


ceka@debian:~$ ethercat pdos

=== Master 0, Slave 2 ===
SM0: PhysAddr 0x1000, DefaultSize   64, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1100, DefaultSize   64, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1200, DefaultSize    6, ControlRegister 0x64, Enable 1
SM3: PhysAddr 0x1400, DefaultSize   12, ControlRegister 0x20, Enable 1
=== Master 0, Slave 3 ===
SM0: PhysAddr 0x1000, DefaultSize  128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1400, DefaultSize  128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1800, DefaultSize    5, ControlRegister 0x64, Enable 1
  RxPDO 0x1600 "RxPDO0-Map"
    PDO entry 0x7000:01, 16 bit, "OUT"
SM3: PhysAddr 0x1c00, DefaultSize    7, ControlRegister 0x20, Enable 1
  TxPDO 0x1a00 "TxPDO1-Map"
    PDO entry 0x6000:01, 16 bit, "IN"
ceka@debian:~$

 

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #345134 by Marcos DC
This is not really an XML problem.

The XML is just a configuration layer for PDO mapping.

What you actually need to understand is:

PDO structure (Rx/Tx)
Sync managers
How lcec interprets the XML

A good workflow is:

1 - Use ethercat pdos to discover the device
2 - Reproduce exactly the same structure in XML
3 - Only then refine HAL mapping

Quick question:

Your device reports:
PDO entry 0x6000:01, 16 bit

But in your XML you configured:
bitLen="32"

What do you think happens if the device expects 16 bits,
but the master tries to map 32 bits?

Also, check this:

<pdo idx="0x1a00,">
<pdoEntry idx="0x6000,">

Notice anything unusual there?

I would suggest:
- match the bit length exactly (16)
- remove the trailing commas
- start with a minimal mapping (no complexEntry)

Once it reaches OP, then split into bits.
The following user(s) said Thank You: cekaa, NWE

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #345146 by cekaa
I struggled a lot because it was a topic I didn't understand at all. I added the pdos and the lcec_configgen result, but I didn't understand what kind of structure I was supposed to create.
When 32 bit = 16 bit
ceka@debian:~$ ethercat slave
0 0:0 OP + XINJE-DS5C1 EtherCAT(CoE) Drive Rev4.0 v3.7.70
1 0:1 OP + XINJE-DS5C1 EtherCAT(CoE) Drive Rev4.0 v3.7.70
2 0:2 OP + XINJE-DS5C1 EtherCAT(CoE) Drive Rev4.0 v3.7.70
3 0:3 SAFEOP+ERROR E EM32DX-E4   ????????????????????????????????????????????
ceka@debian:~$

SAFEOP+ERROR E EM32DX-E4

old now

ceka@debian:~$ ethercat pdos
=== Master 0, Slave 3 ===
SM0: PhysAddr 0x1000, DefaultSize  128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1400, DefaultSize  128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1800, DefaultSize    5, ControlRegister 0x64, Enable 1
  RxPDO 0x1600 "RxPDO0-Map"
    PDO entry 0x7000:01, 16 bit, "OUT"
SM3: PhysAddr 0x1c00, DefaultSize    7, ControlRegister 0x20, Enable 1
  TxPDO 0x1a00 "TxPDO1-Map"
    PDO entry 0x6000:01, 16 bit, "IN"
ceka@debian:~$

lcec_configgen
<slave idx="3" type="generic" vid="0x00004321" pid="0x01100073" name="D4">
      <!--EM32DX-E4-->
      <syncManager idx="0" dir="in"/>
      <syncManager idx="1" dir="out"/>
      <syncManager idx="2" dir="out">
        <pdo idx="1600">
          <!--RxPDO0-Map-->
          <pdoEntry idx="7000" subIdx="01" bitLen="16" halPin="out" halType="u32"/>
        </pdo>
      </syncManager>
      <syncManager idx="3" dir="in">
        <pdo idx="1a00">
          <!--TxPDO1-Map-->
          <pdoEntry idx="6000" subIdx="01" bitLen="16" halPin="in" halType="u32"/>
        </pdo>
      </syncManager>
    </slave>
  </master>
</masters>
ceka@debian:~$


Would the `lcec_configgen` command help? Could someone write the correct configuration for me?


 

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #345147 by Marcos DC
from your latest output, both PDO entries are clearly 16-bit and your XML uses bitLen="16", so that part looks correct.

also, halType="u32" does not mean the PDO is 32-bit. It only affects how the value is exposed in HAL.

it doesn't look like a bit length issue anymore.

given that, I would focus on:

- XML syntax issues (even a small typo can break it, and LinuxCNC may stay silent — checking dmesg helps here)
- verifying that the PDO/SM structure matches exactly what `ethercat pdos` reports
- keeping the mapping minimal until it reaches OP

once it reaches OP, then refine the mapping.
The following user(s) said Thank You: cekaa

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #345155 by cekaa
sudo dmesg -wH
[Apr 4 07:43] EtherCAT 0: Master thread exited.
[  +0.000016] EtherCAT 0: Starting EtherCAT-IDLE thread.
[  +0.000038] EtherCAT ERROR 0-3: Failed to receive AL state datagram: Datagram initialized.
[  +0.000017] EtherCAT 0: Releasing master...
[  +0.000001] EtherCAT 0: Released.
[  +0.024165] EtherCAT ERROR 0-0: AL status message 0x001A: "Synchronization error".
[  +0.001309] EtherCAT 0-0: Acknowledged state SAFEOP.
[  +0.014483] EtherCAT ERROR 0-1: AL status message 0x001A: "Synchronization error".
[  +0.001578] EtherCAT 0-1: Acknowledged state SAFEOP.
[  +0.010458] EtherCAT ERROR 0-2: AL status message 0x001A: "Synchronization error".
[  +0.000839] EtherCAT 0-2: Acknowledged state SAFEOP.
[  +0.011212] EtherCAT ERROR 0-3: AL status message 0x002D: "No Sync Error".
[  +0.000528] EtherCAT 0-3: Acknowledged state SAFEOP.
[  +0.007163] EtherCAT 0: Slave states on main device: PREOP.
[  +0.783938] EtherCAT WARNING: Datagram 000000007d6dd556 (master-fsm) was SKIPPED 1 time.
[ +12.203295] EtherCAT: Requesting master 0...
[  +0.000003] EtherCAT: Successfully requested master 0.
[  +0.001335] EtherCAT 0: Domain0: Logical address 0x00000000, 112 byte, expected working counter 12.
[  +0.000003] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 112 byte, type LRW.
[  +0.000009] EtherCAT 0: Master thread exited.
[  +0.000002] EtherCAT 0: Starting EtherCAT-OP thread.
[  +0.000030] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[  +5.267792] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
[  +6.879988] EtherCAT ERROR 0-3: Timeout while setting state OP.
[  +0.007489] EtherCAT 0: Slave states on main device: SAFEOP, OP.
[  +3.132001] EtherCAT 0: Slave states on main device: SAFEOP, OP + ERROR.



 

Please Log in or Create an account to join the conversation.

More
6 months 4 weeks ago #345156 by cekaa
That's all the information in the PDF.

Please Log in or Create an account to join the conversation.

Time to create page: 0.122 seconds
Powered by Kunena Forum