Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libethercat for sercos drive #15

Open
marcfir opened this issue Aug 22, 2024 · 5 comments
Open

libethercat for sercos drive #15

marcfir opened this issue Aug 22, 2024 · 5 comments

Comments

@marcfir
Copy link
Contributor

marcfir commented Aug 22, 2024

Hi Robert,
I am trying to control a Rexroth IndraDrive. But get a C0108 on the drive when switching to SafeOp. The cycle time is 1ms which is correctly configured in S-0-0002 to 1000us.

Any idea? Is the jitter too high?
The EL7211-0010 works fine without the IndraDrives.

log_ecat.log

Best
Marc

@robert-burger
Copy link
Owner

robert-burger commented Aug 23, 2024

Hi Marc,

First of all, unfortunately I did never have a Rexroth IndraDrive so i can only guess whats happening here. I did ask google a little bit and think this is a motor amplifier talking/configured via SoE (Sercos/ServoDrive). In my opinion SoE is very bad documented by the ETG/Beckhoff but the implemention from libethercat is tested with Beckhoff AX5000 amplifiers so this should work. At DLR we own the full old Sercos spec because we used Sercos-I/II (fiber, not the Ethernet based Sercos-III) in our lightweigth robots (LWR-III).

i assume it is slave idx 4 (starting from 0) in your log file. The problem i see here is following:

When configuring the system to use DCs every slaves clock should be set to 0 (First step switching from PEROP->SAFEOP here). After that every slave supporting DC is programmed with it's cycletimes, mode and starttime. The starttime is assumed to be one second in the future (here). In your log you can see that between setting clocks to zero and configuring slave 4 clock there's only a delay of less than 0.2 seconds.

But the problem with that slave is printed here:

2024-08-22T16:47:47.680Z INFO  [libethercat_rs] DC_SYNC             : slave  4: dc_systime 0.161615594 s, dc_start 1.162115594 s, slv dc_time 3.484867040 s

The slaves time (for whatever reason) is already at 3.48 seconds (see other slaves, all at 0.15 seconds). In this case the start time is smaller than current time and the DC will never start. This results in the timing error you got.

The jitter does not have any influence to this. I think you have to figure out why the dc time is already that big, maybe play around with the start time. Maybe it's also neccessary to send more FPWR/BWR datagrams synchronizing the clock here.

Do you know what EtherCAT slaves ASIC/chip is inside the Rexroth?

What dc mode are you using? Reference Clock in Slave, or EtherCAT masters clock?

Edit: Sorry, i just read the issue title right now. Yes we are talking about a SoE drive ;-)

@marcfir
Copy link
Contributor Author

marcfir commented Aug 23, 2024

Hi Robert,
Thanks for the fast response.
So there are actually 3 Drives, but I removed for testing the other 2 from the EtherCAT:
I could not find out which EtherCAT slave is inside but asked the support for that information.

I used MasterAsRefClock with Sync01 cycletime0=1ms and shift=500us

Slave 0: EK1100
Slave 1: EL1018
Slave 2: EL2024
Slave 3: EL7211-0010
Slave 4: KOMPAKTUMRICHTER HCS01.1E-W0013-A-02-B-ET-EC-NN-NN-NN-FW with firmware MPB-18V18-D5-1-NNN-NN
Slave 5..6: ..

@marcfir
Copy link
Contributor Author

marcfir commented Aug 23, 2024

If all drives are connected to the bus, I also found some reported wiring errors. I checked the wiring and sure enough, In and Out were reversed on the drives (normally the In is the top connector, but on the drives it is reversed). Very interesting that the wiring works with TwinCAT.

DC_CONFIG : slave 4: entry port is not the first port, check wiring order!
DC_CONFIG : slave 4: sysdelay 581366604

Here the log with wrong wiring

DC_CONFIG           : slave  1: receive time port 0 is 2896665054
DC_CONFIG           : slave  1: receive time port 1 is 2896665644
DC_CONFIG           : slave  1: available_ports 0x3, entry_port 0
DC_CONFIG           : slave  1: parent 0
DISTRIBUTED_CLOCK   : slave  1: delay_childs 590, delay_slave 155, delay_parent_previous_slaves 0, delay_with_childs 880
DC_CONFIG           : slave  1: sysdelay 123508
DC_CONFIG           : slave  2: receive time port 0 is 2898984982
DC_CONFIG           : slave  2: receive time port 1 is 2898985291
DC_CONFIG           : slave  2: available_ports 0x3, entry_port 0
DC_CONFIG           : slave  2: checking parent 1, dc 0xFC
DC_CONFIG           : slave  2: parent 1
DISTRIBUTED_CLOCK   : slave  2: delay_childs 309, delay_slave 150, delay_parent_previous_slaves 0, delay_with_childs 590
DC_CONFIG           : slave  2: sysdelay 123658
DC_CONFIG           : slave  3: receive time port 0 is 869611245
DC_CONFIG           : slave  3: available_ports 0x1, entry_port 0
DC_CONFIG           : slave  3: checking parent 2, dc 0xFC
DC_CONFIG           : slave  3: parent 2
DISTRIBUTED_CLOCK   : slave  3: delay_childs 0, delay_slave 164, delay_parent_previous_slaves 0, delay_with_childs 309
DC_CONFIG           : slave  3: sysdelay 123822
DC_CONFIG           : slave  4: receive time port 1 is 2964162581
DC_CONFIG           : slave  4: entry port is not the first port, check wiring order!
DC_CONFIG           : slave  4: available_ports 0x2, entry_port 1
DC_CONFIG           : slave  4: parent 0
DISTRIBUTED_CLOCK   : slave  4: delay_childs 0, delay_slave 1890, delay_parent_previous_slaves 880, delay_with_childs 3760
DC_CONFIG           : slave  4: sysdelay 581366604
DC_CONFIG           : slave  5: receive time port 0 is 2691440005
DC_CONFIG           : slave  5: receive time port 1 is 2691438725
DC_CONFIG           : slave  5: entry port is not the first port, check wiring order!
DC_CONFIG           : slave  5: available_ports 0x3, entry_port 1
DC_CONFIG           : slave  5: parent 0
DISTRIBUTED_CLOCK   : slave  5: delay_childs 1280, delay_slave 1690, delay_parent_previous_slaves 4640, delay_with_childs 4640
DC_CONFIG           : slave  5: sysdelay 123983
DC_CONFIG           : slave  6: receive time port 0 is 2933811793
DC_CONFIG           : slave  6: receive time port 1 is 2933809233
DC_CONFIG           : slave  6: entry port is not the first port, check wiring order!
DC_CONFIG           : slave  6: available_ports 0x3, entry_port 1
DC_CONFIG           : slave  6: checking parent 5, dc 0x84
DC_CONFIG           : slave  6: parent 5
DISTRIBUTED_CLOCK   : slave  6: delay_childs 2560, delay_slave 630, delay_parent_previous_slaves 0, delay_with_childs 1280
DC_CONFIG           : slave  6: sysdelay 125253

Fixing the wiring solves the slv dc_time . But still I get C0108
Here the log with correct wiring

EC_STATE_SAFEOP     : slave 4, with_group 1, assigned 0
EC_STATE_SAFEOP     : setting state for slave 4
PREOP_2_SAFEOP      : slave  4 executing transition 204
PREOP_2_SAFEOP      : slave  4: configuring dc sync 01, cycle_times 1000000/1000000, cycle_shift 0
DC_SYNC             : slave  4: dc_systime 0.195504416 s, dc_start 1.194502278 s, slv dc_time 0.196875622 s
DC_SYNC             : slave  4: cycletime_0 1000000, cycletime_1 1000000, dc_active 7
PREOP_2_SAFEOP      : slave  4: sm2, adr 0x1000, len   7, flags 0x00010064
PREOP_2_SAFEOP      : slave  4: sm3, adr 0x1100, len  10, flags 0x00010062
PREOP_2_SAFEOP      : slave  4: log0 0x00010008/0/7, len   7, phys 0x1000/0, type 2, active 1
PREOP_2_SAFEOP      : slave  4: log1 0x00010008/0/7, len  10, phys 0x1100/0, type 1, active 1
PREOP_2_SAFEOP      : slave  4: log2 0x09000000/1/1, len   1, phys 0x080D/3, type 1, active 1
PREOP_2_SAFEOP      : slave  4: SAFE-OPERATIONAL state requested
PREOP_2_SAFEOP      : slave  4: state switch to 4 failed, alstatcode 0x0001 : unspecified error
PREOP_2_PREOP       : slave  4: resetting seems to have succeeded, wkc 1

log2.log

@robert-burger
Copy link
Owner

According to Bosch Rexroth docs that means

C0108 Zeitschlitzparameter > SERCOS-Zykluszeit
Bei der Ausführung des Kommandos "S‑0‑0127, C0100 Umschaltvorberei‐
tung auf Komm.-Phase 3" werden die Timingeinstellungen für die SERCOS-
Kommunikation überprüft. Dabei wurde ein Fehler erkannt.

As you already mentioned the sercos cycletime is set to 1000us (S-0-0002, hopefully also in S-0-0001) and i can see in your log that dc-sync0 and dc-sync-1 is also 1000us. Can you tell me which Sercos IDs you are writing in state transition PREOP->SAFEOP? I can only see in the log that there are some mapped bytes for ATs and MDTs (S-0-0016 and S-0-0024).

There should be an EtherCAT slave information XML (ESI) file from Bosch Rexroth. In most cases TwinCAT needs that. Is it possible to provide that file?

@marcfir
Copy link
Contributor Author

marcfir commented Aug 23, 2024

I do not write them in the PreOp phase because writing gives me the following error:

2024-08-23T14:09:37.234Z DEBUG [libethercat_rs] SOE_WRITE           : slave 4, atn 0, idn 1, elements 64, buf 0x7ffe83a37a54, len 2, left 2, mbx_len 224
2024-08-23T14:09:37.234Z DEBUG [libethercat_rs] SOE_WRITE           : E803
2024-08-23T14:09:37.234Z DEBUG [libethercat_rs] SOE_WRITE           : slave 4, atn 0, idn 1, elements 64: sending fragment len 2 (left 0)
2024-08-23T14:09:37.238Z DEBUG [libethercat_rs] SOE_WRITE           : got response: opcode 4, incomplete 0, error 0, atn 0, elements 64, idn 1
thread 'main' panicked at src/main.rs:165:18:
called `Result::unwrap()` on an `Err` value: MailboxTimeout(1052672)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

But the configuration as is should work. Reading in PreOp gives me the following values:

2024-08-23T14:11:06.540Z INFO  [libethercat_rs] Slv 4 S-0-1 (NC-Zykluszeit (TNcyc) ): 1000
2024-08-23T14:11:06.550Z INFO  [libethercat_rs] Slv 4 S-0-2 (sercos Zykluszeit (TScyc) ): 1000
2024-08-23T14:11:06.559Z INFO  [libethercat_rs] Slv 4 S-0-14 (Schnittstellen-Status ): 2
2024-08-23T14:11:06.574Z INFO  [libethercat_rs] Slv 5 S-0-1 (NC-Zykluszeit (TNcyc) ): 1000
2024-08-23T14:11:06.584Z INFO  [libethercat_rs] Slv 5 S-0-2 (sercos Zykluszeit (TScyc) ): 1000
2024-08-23T14:11:06.593Z INFO  [libethercat_rs] Slv 5 S-0-14 (Schnittstellen-Status ): 2
2024-08-23T14:11:06.607Z INFO  [libethercat_rs] Slv 6 S-0-1 (NC-Zykluszeit (TNcyc) ): 1000
2024-08-23T14:11:06.617Z INFO  [libethercat_rs] Slv 6 S-0-2 (sercos Zykluszeit (TScyc) ): 1000
2024-08-23T14:11:06.626Z INFO  [libethercat_rs] Slv 6 S-0-14 (Schnittstellen-Status ): 2

BoschRexroth_IndraDrive_ECAT_SoE_01V26.txt

According to this, which is for another drive, the S-0-0021 gives me the wrong parameters, but when I read the parameters the list is empty.

S-0-21: [0, 0, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]`

Interpreting the parameter based on this
means the list is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants