-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add simple example #7
base: master
Are you sure you want to change the base?
Conversation
I'm sorry, didn't see this before now. Will review during the weekend... |
The It may be that this is because the configured slaves don't match the actual slaves, but you have the check that I though was the right one (leading to the "Unable to configure slave" panic). It might also be possible that the Weidmüller hardware wants to be put into the OP state explicitly, while Beckhoff does it automatically while activating the master? (I think; I don't have a coupler with me to test ATM. I can do some tests tomorrow.) I assume you know about the |
examples/simple.rs
Outdated
master.domain(domain_handle).queue()?; | ||
master.send()?; | ||
|
||
thread::sleep(Duration::from_millis(500)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adapted the PDOs and IDs to my Beckhoff EK1100 test system. I first thought this didn't work either, but then let it run for longer once and saw that the al_states did go to OP at some point.
For that system, it needs about 35 communication cycles to do this here; if you lower the sleep you'll get to state 8 sooner. I don't know where the delay comes from :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to reduce the cycle time but no matter how long I'm waiting, it stays at al_states: 2
:(
Ok, I'll check the whole config again.
Yes I tried it. Running |
Can you post the result of |
sudo /opt/etherlab/bin/ethercat pdos
SM0: PhysAddr 0x1000, DefaultSize 512, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1400, DefaultSize 512, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1800, DefaultSize 0, ControlRegister 0x64, Enable 0
RxPDO 0x16ff ""
PDO entry 0xf200:01, 1 bit, ""
PDO entry 0xf200:02, 1 bit, ""
PDO entry 0xf200:03, 1 bit, ""
PDO entry 0xf200:04, 1 bit, ""
PDO entry 0xf200:05, 1 bit, ""
PDO entry 0xf200:06, 1 bit, ""
PDO entry 0xf200:07, 1 bit, ""
PDO entry 0xf200:08, 1 bit, ""
PDO entry 0xf200:09, 1 bit, ""
PDO entry 0xf200:0a, 1 bit, ""
PDO entry 0xf200:0b, 1 bit, ""
PDO entry 0xf200:0c, 1 bit, ""
PDO entry 0xf200:0d, 1 bit, ""
PDO entry 0xf200:0e, 1 bit, ""
PDO entry 0xf200:0f, 1 bit, ""
PDO entry 0xf200:10, 1 bit, ""
RxPDO 0x1600 ""
PDO entry 0x7000:01, 1 bit, ""
PDO entry 0x7000:02, 1 bit, ""
PDO entry 0x7000:03, 1 bit, ""
PDO entry 0x7000:04, 1 bit, ""
PDO entry 0x0000:00, 4 bit, "Gap"
RxPDO 0x1601 ""
PDO entry 0x7010:01, 1 bit, ""
PDO entry 0x7010:02, 1 bit, ""
PDO entry 0x7010:03, 1 bit, ""
PDO entry 0x7010:04, 1 bit, ""
PDO entry 0x7010:05, 1 bit, ""
PDO entry 0x7010:06, 1 bit, ""
PDO entry 0x7010:07, 1 bit, ""
PDO entry 0x7010:08, 1 bit, ""
PDO entry 0x7010:09, 1 bit, ""
PDO entry 0x7010:0a, 1 bit, ""
PDO entry 0x7010:0b, 1 bit, ""
PDO entry 0x7010:0c, 1 bit, ""
PDO entry 0x7010:0d, 1 bit, ""
PDO entry 0x7010:0e, 1 bit, ""
PDO entry 0x7010:0f, 1 bit, ""
PDO entry 0x7010:10, 1 bit, ""
SM3: PhysAddr 0x2400, DefaultSize 0, ControlRegister 0x20, Enable 0
TxPDO 0x1aff ""
PDO entry 0xf100:01, 1 bit, ""
PDO entry 0xf100:02, 1 bit, ""
PDO entry 0xf100:03, 1 bit, ""
PDO entry 0xf100:04, 1 bit, ""
PDO entry 0xf100:05, 1 bit, ""
PDO entry 0xf100:06, 1 bit, ""
PDO entry 0xf100:07, 1 bit, ""
PDO entry 0xf100:08, 1 bit, ""
PDO entry 0xf100:09, 1 bit, ""
PDO entry 0xf100:0a, 1 bit, ""
PDO entry 0xf100:0b, 1 bit, ""
PDO entry 0xf100:0c, 1 bit, ""
PDO entry 0xf100:0d, 1 bit, ""
PDO entry 0xf100:0e, 1 bit, ""
PDO entry 0xf100:0f, 1 bit, ""
PDO entry 0xf100:10, 1 bit, ""
TxPDO 0x1a00 ""
PDO entry 0x6000:01, 8 bit, ""
TxPDO 0x1a01 ""
PDO entry 0x6010:01, 8 bit, "" sudo /opt/etherlab/bin/ethercat slaves -v
=== Master 0, Slave 0 ===
Device: Main
State: PREOP
Flag: E
Identity:
Vendor Id: 0x00000230
Product code: 0x4f911c30
Revision number: 0x00011100
Serial number: 0x5021d6b0
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 0 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 MII up open yes - 1845499234 0 0
1 MII down closed no - - - -
2 N/A down closed no - - - -
3 N/A down closed no - - - -
Mailboxes:
Bootstrap RX: 0x1200/532, TX: 0x1500/532
Standard RX: 0x1000/512, TX: 0x1400/512
Supported protocols: EoE, CoE, FoE
General:
Group: Coupler
Image name:
Order number: UR20-FBC-EC
Device name: UR20-FBC-EC / 1334910000
CoE details:
Enable SDO: yes
Enable SDO Info: yes
Enable PDO Assign: no
Enable PDO Configuration: yes
Enable Upload at startup: no
Enable SDO complete access: yes
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 0 mA sudo /opt/etherlab/bin/ethercat config -v
Alias: 0
Position: 0
Vendor Id: 0x00000230
Product code: 0x4f911c30
Attached slave: 0 (PREOP)
Watchdog divider: (Default)
Watchdog intervals: (Default)
SM2, Dir: Output, Watchdog: Default
PDO 0x1600
PDO entry 0x7000:01, 1 bit
PDO entry 0x7000:04, 1 bit
SM3, Dir: Input, Watchdog: Default
PDO 0x1a00
PDO entry 0x6000:01, 8 bit
SDO configuration:
None.
IDN configuration:
None. |
Well, I'm a bit at a loss. You might also look in the dmesg for errors/warnings, maybe after calling Googling suggests that you may need to configure the DC feature before activating the master (calling |
That's actually a good idea! There are some errors and warnings, e.g.: [Fr Apr 17 13:06:15 2020] EtherCAT ERROR 0-0: SDO download 0x1600:00 (1 bytes) aborted.
[Fr Apr 17 13:06:15 2020] EtherCAT ERROR 0-0: SDO abort message 0x06010002: "Attempt to write a read-only object".
[Fr Apr 17 13:06:15 2020] EtherCAT WARNING 0-0: Failed to clear PDO mapping. [Fr Apr 17 13:06:15 2020] EtherCAT WARNING 0-0: Failed to configure mapping of PDO 0x1600.
[Fr Apr 17 13:06:15 2020] EtherCAT WARNING 0-0: Slave does not support assigning PDOs! [Fr Apr 17 13:06:15 2020] EtherCAT ERROR 0-0: SDO download 0x1A00:00 (1 bytes) aborted.
[Fr Apr 17 13:06:15 2020] EtherCAT ERROR 0-0: SDO abort message 0x06010002: "Attempt to write a read-only object".
[Fr Apr 17 13:06:15 2020] EtherCAT WARNING 0-0: Failed to clear PDO mapping. [Fr Apr 17 13:06:15 2020] EtherCAT ERROR 0-0: Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).
[Fr Apr 17 13:06:15 2020] EtherCAT ERROR 0-0: AL status message 0x001E: "Invalid input configuration". So it seems that I can't define my own custom mapping ( I tried to run an example with the SOEM-rs stack where I did not configure PDOs ... and it worked. |
Ah, then you probably have to configure the complete PDO (e.g. all 8 bits of 0x1600) for use in the domain. It might be enough to configure just index 0x7000:1 with a bit_length of 8; at least that has been the case with Beckhoff input terminals. |
that doesn't change anything :(
I'll try to configure all PDOs exactly like they are offered. |
@birkenfeld I try to make a simple example working but it doesn't work :(
Could you have look at this example?
Do I miss something?
The aim is simple: Toggle output 3