EL5112: Change PDO assignments via LinuxCNC?
- thomaseg
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 5
29 Dec 2024 20:08 #317637
by thomaseg
EL5112: Change PDO assignments via LinuxCNC? was created by thomaseg
Hi,
I've been struggling with getting an EL5112 encoder to work. I've spent most of the day battling this and i think i need some input/assistance.
The module is this one: www.beckhoff.com/da-dk/products/i-o/ethe...surement/el5112.html
The manual is here: download.beckhoff.com/download/Document/...rminals/el5112en.pdf
The module is an encoder ane it can run as either "1xABC" or "2xAB" encoder(s). I need it to run as "1xAB" encoder, not using the 2nd channel. However, its factory default set to "1xABC". If i look in the manual i find this regarding the "Predefined PDO assignment":
...and what i can gather from the manual is that i need to use 0x1A02 for input and 0x1602 for output. I've tried that with this configuration:...and if i run a command to see the pdos i also get what i expect with regards to "0x1600/0x1a00" vs. "0x1602/0x1a02"(1xABC vs 2xAB):
...so far so good....but it ain't working:(note the "PREOP" at pos 1)
If i look at dmesg this is what i get:
..."Invalid input configuration"...
So my question is: Does this "PDO assignment" in TwinCAT do anything else behind the scene that i need to do in my setup aswell? I don't use/have TwinCAT anywhere and i actually don't have a PC that can run it in my workshop, otherwise i would have testet it. But i was hoping others have had similar issues, maybe with other devices that support multiple "modes"...
Have i missed anything obvious?
/Thomas
I've been struggling with getting an EL5112 encoder to work. I've spent most of the day battling this and i think i need some input/assistance.
The module is this one: www.beckhoff.com/da-dk/products/i-o/ethe...surement/el5112.html
The manual is here: download.beckhoff.com/download/Document/...rminals/el5112en.pdf
The module is an encoder ane it can run as either "1xABC" or "2xAB" encoder(s). I need it to run as "1xAB" encoder, not using the 2nd channel. However, its factory default set to "1xABC". If i look in the manual i find this regarding the "Predefined PDO assignment":
...and what i can gather from the manual is that i need to use 0x1A02 for input and 0x1602 for output. I've tried that with this configuration:
<slave idx="1" type="generic" vid="00000002" pid="13F83052" configPdos="true" name="ENC1">
<syncManager idx="2" dir="out">
<pdo idx="1602">
<pdoEntry idx="7000" subIdx="02" bitLen="1" halPin="cmd-EnableLatchPosEdge" halType="bit"/>
<pdoEntry idx="7000" subIdx="03" bitLen="1" halPin="cmd-SetCounter" halType="bit"/>
<pdoEntry idx="7000" subIdx="04" bitLen="1" halPin="cmd-EnableLatchNegEdge" halType="bit"/>
<pdoEntry idx="7000" subIdx="09" bitLen="1" halPin="cmd-SetSoftwareGate" halType="bit"/>
<pdoEntry idx="7000" subIdx="0a" bitLen="1" halPin="cmd-SetCounterLatchPosEdge" halType="bit"/>
<pdoEntry idx="7000" subIdx="0b" bitLen="1" halPin="cmd-SetCounterLatchNegEdge" halType="bit"/>
<pdoEntry idx="7000" subIdx="11" bitLen="32" halPin="cmd-SetCounterValue" halType="s32"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a02">
<pdoEntry idx="6000" subIdx="02" bitLen="1" halPin="sta-LatchExtValid" halType="bit"/>
<pdoEntry idx="6000" subIdx="03" bitLen="1" halPin="sta-SetCounterDone" halType="bit"/>
<pdoEntry idx="6000" subIdx="04" bitLen="1" halPin="sta-CounterUnderflow" halType="bit"/>
<pdoEntry idx="6000" subIdx="05" bitLen="1" halPin="sta-CounterOverflow" halType="bit"/>
<pdoEntry idx="6000" subIdx="07" bitLen="1" halPin="sta-OpenCircuit" halType="bit"/>
<pdoEntry idx="6000" subIdx="09" bitLen="1" halPin="sta-StatusInputA" halType="bit"/>
<pdoEntry idx="6000" subIdx="0a" bitLen="1" halPin="sta-StatusInputB" halType="bit"/>
<pdoEntry idx="6000" subIdx="0c" bitLen="1" halPin="sta-StatusInputGate" halType="bit"/>
<pdoEntry idx="6002" subIdx="0d" bitLen="1" halPin="sta-Diag" halType="bit"/>
<pdoEntry idx="6002" subIdx="0e" bitLen="1" halPin="sta-TxPDOState" halType="bit"/>
<pdoEntry idx="6002" subIdx="0f" bitLen="2" halPin="sta-InputCycleCounter" halType="u32"/>
<pdoEntry idx="6002" subIdx="11" bitLen="1" halPin="sta-SoftwareGateValid" halType="bit"/>
<pdoEntry idx="6002" subIdx="15" bitLen="1" halPin="sta-CounterValueOutOfRange" halType="bit"/>
<pdoEntry idx="6000" subIdx="11" bitLen="32" halPin="sta-CounterValue" halType="s32"/>
<pdoEntry idx="6000" subIdx="12" bitLen="32" halPin="sta-LatchValue" halType="s32"/>
</pdo>
</syncManager>
</slave>
$ ethercat pdos -p 1
SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1100, DefaultSize 128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1200, DefaultSize 6, ControlRegister 0x24, Enable 1
RxPDO 0x1602 "ENC RxPDO-Map Control Ch.1"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x7000:02, 1 bit, "Enable latch extern on positive edge"
PDO entry 0x7000:03, 1 bit, "Set counter"
PDO entry 0x7000:04, 1 bit, "Enable latch extern on negative edge"
PDO entry 0x0000:00, 4 bit, "Gap"
PDO entry 0x7000:09, 1 bit, "Set software gate"
PDO entry 0x7000:0a, 1 bit, "Set counter on latch extern on positive edge"
PDO entry 0x7000:0b, 1 bit, "Set counter on latch extern on negative edge"
PDO entry 0x0000:00, 5 bit, "Gap"
PDO entry 0x7000:11, 32 bit, "Set counter value"
SM3: PhysAddr 0x1300, DefaultSize 16, ControlRegister 0x20, Enable 1
TxPDO 0x1a02 "ENC TxPDO-Map Status Ch.1"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x6000:02, 1 bit, "Latch extern valid"
PDO entry 0x6000:03, 1 bit, "Set counter done"
PDO entry 0x6000:04, 1 bit, "Counter underflow"
PDO entry 0x6000:05, 1 bit, "Counter overflow"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x6000:07, 1 bit, "Open circuit"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x6000:09, 1 bit, "Status of input A"
PDO entry 0x6000:0a, 1 bit, "Status of input B"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x6000:0c, 1 bit, "Status of input gate"
PDO entry 0x6002:0d, 1 bit, "Diag"
PDO entry 0x6002:0e, 1 bit, "TxPDO State"
PDO entry 0x6002:0f, 2 bit, "Input cycle counter"
PDO entry 0x6002:11, 1 bit, "Software gate valid"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x0000:00, 1 bit, "Gap"
PDO entry 0x6002:15, 1 bit, "Counter value out of range"
PDO entry 0x0000:00, 11 bit, "Gap"
PDO entry 0x6000:11, 32 bit, "Counter value"
PDO entry 0x6000:12, 32 bit, "Latch value"
...so far so good....but it ain't working:
$ ethercat slaves
0 0:0 OP + EK1100 EtherCAT-Koppler (2A E-Bus)
1 0:1 PREOP E EL5112 2K. Inc. Encoder 5V (2xAB oder 1xABC RS422,TTL)
2 0:2 OP + EL3255 5K. Potentiometerauswertung mit Sensorversorgung
3 0:3 OP + EL1008 8K. Dig. Eingang 24V, 3ms
4 0:4 OP + EL1008 8K. Dig. Eingang 24V, 3ms
5 0:5 OP + EL2024 4K. Dig. Ausgang 24V, 2A
6 0:6 OP + EL1859 8K. Dig. Eingang 24V, 3ms, 8K. Dig. Ausgang 24V, 0.5A
7 0:7 OP + EL1859 8K. Dig. Eingang 24V, 3ms, 8K. Dig. Ausgang 24V, 0.5A
8 0:8 OP + EL1859 8K. Dig. Eingang 24V, 3ms, 8K. Dig. Ausgang 24V, 0.5A
9 0:9 OP + EK1100 EtherCAT-Koppler (2A E-Bus)
10 0:10 OP + EL1018 8K. Dig. Eingang 24V, 10▒s
11 0:11 OP + EL1018 8K. Dig. Eingang 24V, 10▒s
12 0:12 OP + EL1008 8K. Dig. Eingang 24V, 3ms
13 0:13 OP + EL1008 8K. Dig. Eingang 24V, 3ms
14 0:14 OP + EL3052 2K. Ana. Eingang 4-20mA
15 0:15 OP + EL3052 2K. Ana. Eingang 4-20mA
16 0:16 OP + EL2024 4Ch. Dig. Output 24V, 2A
17 0:17 OP + EL2024 4Ch. Dig. Output 24V, 2A
18 0:18 OP + EL2024 4Ch. Dig. Output 24V, 2A
19 0:19 OP + EL2008 8K. Dig. Ausgang 24V, 0.5A
If i look at dmesg this is what i get:
$ sudo dmesg | egrep EtherCAT
[...cut...]
[ 5920.784378] EtherCAT 0: Starting EtherCAT-IDLE thread.
[ 5920.784441] EtherCAT ERROR 0-9: Failed to receive AL state datagram: Datagram initialized.
[ 5920.784470] EtherCAT 0: Releasing master...
[ 5920.784474] EtherCAT 0: Released.
[ 5920.969712] EtherCAT 0: Slave states on main device: PREOP.
[ 5921.481681] EtherCAT WARNING: Datagram 000000000caaf331 (master-fsm) was SKIPPED 1 time.
[ 5921.996024] EtherCAT: Requesting master 0...
[ 5921.996031] EtherCAT: Successfully requested master 0.
[ 5922.006960] EtherCAT 0: Domain0: Logical address 0x00000000, 388 byte, expected working counter 43.
[ 5922.006965] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 388 byte, type LRW.
[ 5922.006988] EtherCAT 0: Master thread exited.
[ 5922.006991] EtherCAT 0: Starting EtherCAT-OP thread.
[ 5922.007052] EtherCAT WARNING 0: 9 datagrams UNMATCHED!
[ 5922.350569] EtherCAT ERROR 0-1: Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).
[ 5922.351567] EtherCAT ERROR 0-1: AL status message 0x001E: "Invalid input configuration".
[ 5922.353905] EtherCAT 0-1: Acknowledged state PREOP.
[ 5922.821510] EtherCAT 0: Slave states on main device: PREOP, OP.
[ 5923.009501] EtherCAT WARNING 0: 8 datagrams UNMATCHED!
..."Invalid input configuration"...
So my question is: Does this "PDO assignment" in TwinCAT do anything else behind the scene that i need to do in my setup aswell? I don't use/have TwinCAT anywhere and i actually don't have a PC that can run it in my workshop, otherwise i would have testet it. But i was hoping others have had similar issues, maybe with other devices that support multiple "modes"...
Have i missed anything obvious?
/Thomas
Attachments:
Please Log in or Create an account to join the conversation.
- thomaseg
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 5
30 Dec 2024 10:16 #317666
by thomaseg
Replied by thomaseg on topic EL5112: Change PDO assignments via LinuxCNC?
...or maybe there is a way of configuring devices that i don't know of? The manual does not seem to mention ANY configuration apart from this PDO assignment...
Please Log in or Create an account to join the conversation.
- Hakan
- Offline
- Platinum Member
Less
More
- Posts: 499
- Thank you received: 156
30 Dec 2024 11:51 #317672
by Hakan
Replied by Hakan on topic EL5112: Change PDO assignments via LinuxCNC?
No idea really, but you can always try the "lcec_configgen" command to see what lcec's guess of a config can look like.
EL5102 is available as a lcec device if you want to look at how it is done for that one. I is a similar encoder I think.
EL5102 is available as a lcec device if you want to look at how it is done for that one. I is a similar encoder I think.
Please Log in or Create an account to join the conversation.
- thomaseg
- Offline
- Junior Member
Less
More
- Posts: 37
- Thank you received: 5
30 Dec 2024 12:54 #317675
by thomaseg
However! I restart the module(power off/on) then the new config worked! I'm not quite sure why though, which annoys me quite a lot! I even managed to change the pdos to use 2xAB(with 0x1602/0x1A02) and it still works...and i'm getting proper data from my encoder... I ran a diff between the two configs and apart from the type-error and naming they are identical...
My current/best theory is that one of the configurations i've made yesterday somehow made the module go into an "error mode" of sorts and only a physical powercycle could get it out again. So i might have had it correct in one of my attempts, but since i never powercycled the modules i somehow kept getting "old errors" or something along those lines...jezz... anyways, it is working, so thanks!
/Thomas
Replied by thomaseg on topic EL5112: Change PDO assignments via LinuxCNC?
Oh, that was a neat tool! Thanks! That Scott-guy has been busy! The resulting config looks very similar to what i'm trying to do...apart from it defaulting to 1xABC aswell(0x1600/0x1A00) and then i got some of the types wrong(u32 vs. s32)...No idea really, but you can always try the "lcec_configgen" command to see what lcec's guess of a config can look like.
EL5102 is available as a lcec device if you want to look at how it is done for that one. I is a similar encoder I think.
However! I restart the module(power off/on) then the new config worked! I'm not quite sure why though, which annoys me quite a lot! I even managed to change the pdos to use 2xAB(with 0x1602/0x1A02) and it still works...and i'm getting proper data from my encoder... I ran a diff between the two configs and apart from the type-error and naming they are identical...
My current/best theory is that one of the configurations i've made yesterday somehow made the module go into an "error mode" of sorts and only a physical powercycle could get it out again. So i might have had it correct in one of my attempts, but since i never powercycled the modules i somehow kept getting "old errors" or something along those lines...jezz... anyways, it is working, so thanks!
/Thomas
Please Log in or Create an account to join the conversation.
Time to create page: 0.077 seconds