Ethercat HAL driver

More
18 May 2020 18:09 - 18 May 2020 18:35 #168174 by chimeno
Hi @theshade

I will receive the ECT60 drives next week and I am not in a rush, but how and where do I export the .xml from twincat3 or do I need to I need to do anything else in it like configure drives parameters or such?

you have to add to the "startup" tab the configuration that changes from the default, then export the .xml file description, attached a couple of images to guide you.

The ethercat-conf.xml I use in linux CNC looks currently like this and it works in linuxCNC for the Beckhoff modules, I understand I will need to add the 4x ECT60 to it with SDOs and PDOs definitions

I am attaching a screenshot of where the PDOs are located and I am also attaching a new general configuration file for linuxcnc-ethercat, things are missing so you can fill it yourself.

resguard
Chimeno
Last edit: 18 May 2020 18:35 by chimeno. Reason: Edit PDO
The following user(s) said Thank You: theshade

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

More
18 May 2020 21:16 #168191 by theshade
Thank you Chimeno for your example and time,

I think I understand,
the .xml will setup the registers at startup (steps, modes, etc..) and also define the "PDO telegram"
Now I know how to start experimenting...

Thank you again,
Cheers

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

More
21 May 2020 03:14 #168462 by CORBETT
Replied by CORBETT on topic Ethercat HAL driver
@Chimeno
@sqmathlete
and anyone else

Albert and Dan,
Ok, I have been reading and learning TC3 and can hook up my EK1100 with EL5152 terminal, then in config mode go online, and do a Scan, and under the IO tab pull up the EK1100 & EL5152.

I have been able to set up a virtual PLC and then in ladder programming build a simple motor contactor with a start push button and stop push button. Also have been learning to link a few things together in Structured Text programming, but still have a lot to learn.

The main goal is to get my EL5152 commissioned so that I can see the encoder counts and make sure all of my EL5151’s and the 5152 are good and not junk terminals. I simply believe all of them have been setup in another type of mode and that is why I cannot get any of them working in LinuxCNC.

What I thought to do in TC3 was to setup a Virtual PLC and build a simple conveyor program in ladder logic so that I could simulate the conveyor movement when turning the encoder shaft.

BUT this sounds like a lot of work as compared to simply building one NC PTP axis under the MOTION tab to link the encoder and see the counts this way. I am not sure what is the best approach so if you guy’s have a better idea, then please let me know your thoughts.

Albert, I haven’t flashed the EPROM yet as I would like to learn how to configure the EL515x terminal so that I can “SEE” the encoder working in TwinCAT. As Dan said in the past, you need TwinCAT to be able to fix or tweak any of the terminals and I would like to figure this all out for future problems even though this is really the only terminal that I am having problems with. Beckhoff seems to have done a really good job with TC3, it is much better to get working than TC2 in my opinion.

Thanks,
Robert

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

More
21 May 2020 20:11 - 21 May 2020 20:12 #168521 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hi @CORBETT
I think you don't need to do all that to know if it works correctly, which would be to reset the factory settings, since linuxcnc-ethercat uses the default function, then you see if the device has the correct name, it is in OP mode and what if You connect an encoder to it, count the values, I hope you are lucky.

reguard
Chimeno
Attachments:
Last edit: 21 May 2020 20:12 by chimeno.
The following user(s) said Thank You: CORBETT

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

More
21 May 2020 23:19 #168552 by CORBETT
Replied by CORBETT on topic Ethercat HAL driver
Ok excellent. I have been to the areas you have screenshots of and mine was not making counts, so I need to focus on resetting the terminal. I will work on this tonight, thanks for sending me in the right direction.

Thanks,
Robert

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

More
22 May 2020 03:39 #168558 by CORBETT
Replied by CORBETT on topic Ethercat HAL driver
@Chimeno

Things are not looking good for me.... I did everything as you listed to reset the terminal and I am still getting 0 for the counter value as you can see in the attached screenshot. By the way, your list was perfect as it worked exactly as you stated:

1 - "ethercat" tab of the device
2 - "advanced settings" tab
3 - "ESC ACCESS" tab
4 - "EPROM" tab
5 - "HEX EDITOR" tab
6 - "download from list" tab
7 - select the device
8 - "Ok" ... recording image.

After selecting the correct model number device and hitting OK, you could see the bar pop up at the bottom of the screen and it would fill up green as it was downloading to the terminal. It did this twice, and the second time was pretty quick. Then the box would disappear and I didn't get any errors in the "errors" box after the process. I did both the EL5151and 52 with no change to either afterwards when going online and checking them out.

Do you have any other thoughts of what to try next?

Thanks,
Robert
Attachments:

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

More
22 May 2020 16:50 - 23 May 2020 00:13 #168587 by theshade
Dear @Chimeno,

I am still a little lost I think. I received the drives this morning and loaded the ECT60 description file in TWINCAT and I have managed to move the motors using the NC so this is good.


And I have a working config and pdo in twincat. It curently uses CSP (cyclic dynamic position mode). I tried to change to PP but it doesn't work when I do....

Now when I export the "startup" which is much more full of data...


it saves a very generic file with almost no info:
test.xml

File Attachment:

File Name: test.xml
File Size:0 KB

So I don't yet understand what I should export in xml from twincat..
Also I don't know how to export pdo's there is no export to xml in this window...



Sorry I can't understand what I need to do to export the two xml files from twincat...
I guess one is for PDOs and one for startup config.
1. Do I need to write the files by hand because export from twincat doesn't seem to work? Did you write the example files you sent me manually?
2. or how did you export them from twincat? Maybe I missunderstood and twincat is only for experimenting on the settings.

Thank you again so much in advance and sorry for being slow to understand.

So I edited manually the .xml from my current understanding:
I only added the PDO with SM2 and SM3... I don't know really know if the others pdo idx are useful, nor the reason they exist in twincat.
So I loaded this xml in linuxcnc and after a few trials I still do get errors which are probably due to the fact that I don't really know what to put in the DC sync config and ref clock sync cycles...
In twincat it seems to work at 2000us...



So I changed to:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
<dcConf assignActivate="500" sync0Cycle="2000000" sync0Shift="1000000"/>
according to the thread here:
forum.linuxcnc.org/38-general-linuxcnc-q...rcat-sync-dc-problem

but then I get this:
[ 2350.778194] EtherCAT WARNING: Datagram e64197b9 (master-fsm) was SKIPPED 1 time.
[ 2385.334576] EtherCAT: Requesting master 0...
[ 2385.334592] EtherCAT: Successfully requested master 0.
[ 2385.335248] EtherCAT 0: Domain0: Logical address 0x00000000, 18 byte, expected working counter 3.
[ 2385.335256] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 18 byte, type LRW.
[ 2385.335411] EtherCAT 0: Master thread exited.
[ 2385.335422] EtherCAT 0: Starting EtherCAT-OP thread.
[ 2385.335562] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[ 2385.494210] EtherCAT ERROR 0-0: Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).
[ 2385.496263] EtherCAT ERROR 0-0: AL status message 0x001E: "Invalid input configuration".
[ 2385.500254] EtherCAT 0-0: Acknowledged state PREOP.
Attachments:
Last edit: 23 May 2020 00:13 by theshade. Reason: update

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

More
23 May 2020 16:53 #168701 by chimeno
Replied by chimeno on topic Ethercat HAL driver
Hi @CORBETT
The device seems to be working properly and is in OP mode, that's good, have you connected an encoder to the A / B / C port? Could the encoder not work? Remove the encoder and place a cable making several contacts between the pins port C (pin4) + 24v (pin6), see as in the image that I enclose the status of port C, if this works surely you have the encoder in bad condition.

reguard
Chimeno
Attachments:
The following user(s) said Thank You: CORBETT

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

More
23 May 2020 17:06 - 23 May 2020 17:46 #168703 by chimeno
Hi @theshade
You are progressing a lot, I'm very happy !!

So I changed to:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
<dcConf assignActivate="500" sync0Cycle="2000000" sync0Shift="1000000"/>
according to the thread here:

DC mode is sometimes a bit troublesome, try this configuration it helps.
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
<dcConf assignActivate="1000" sync0Cycle="*1" sync0Shift="0"/>

Can it works in another SM-MODE mode ?? no cal activate DC mode

Also check that the PID and VID are correct, you can get them from the terminal
ethercat slave -v

Also check the PDOs that are correct with the terminal.
ethercat pdos

it saves a very generic file with almost no info:
test.xml

You just have to export the configuration that changes from the default, it is blue.

[ 2385.496263] EtherCAT ERROR 0-0: AL status message 0x001E: "Invalid input configuration".

This is an error in the PDO registry, some are not well defined

reguard
Chimeno
Attachments:
Last edit: 23 May 2020 17:46 by chimeno. Reason: Edit

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

More
23 May 2020 19:03 - 23 May 2020 20:37 #168711 by theshade
Hi @chimeno, most of my progress are thanks to you...

So I changed PID to
pi@raspberrypi:~ $ ethercat slave -v
=== Master 0, Slave 0 ===
Device: Main
State: OP
Flag: +
Identity:
  Vendor Id:       0x00000a88
  Product code:    [b]0x0a880002[/b]
  Revision number: 0x00000202
  Serial number:   0x00000000
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             -   1832565252           0           0
   1  MII   down  closed  no              -            -           -           -
   2  N/A   down  closed  no              -            -           -           -
   3  N/A   down  closed  no              -            -           -           -
Mailboxes:
  Bootstrap RX: 0x0000/0, TX: 0x0000/0
  Standard  RX: 0x1000/128, TX: 0x1080/128
  Supported protocols: CoE
General:
  Group: Stepper servo Driver
  Image name: 
  Order number: ECT60
  Device name: ECT60(COE)
  CoE details:
    Enable SDO: yes
    Enable SDO Info: yes
    Enable PDO Assign: yes
    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

and ethercat pdo seem to match my xml except the 0x6040 and 0x6041 are 16bit but the haltype is u32
SM0: PhysAddr 0x1000, DefaultSize  128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1080, DefaultSize  128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1100, DefaultSize    0, ControlRegister 0x64, Enable 1
  RxPDO 0x1600 "RXPDO 1 Mapping Parameter"
    PDO entry 0x6040:00, 16 bit, ""
    PDO entry 0x6060:00,  8 bit, ""
    PDO entry 0x607a:00, 32 bit, ""
SM3: PhysAddr 0x1400, DefaultSize    0, ControlRegister 0x20, Enable 1
  TxPDO 0x1a00 "TXPDO 1 Mapping Parameter "
    PDO entry 0x6041:00, 16 bit, ""
    PDO entry 0x6061:00,  8 bit, ""
    PDO entry 0x6064:00, 32 bit, ""
    PDO entry 0x60fd:00, 32 bit, ""
when I type ethercat xml I get the file here:

File Attachment:

File Name: slave.xml
File Size:2 KB


I don't know how to change DC mode but I changed the timings according to what you suggested and finally got this:
pi@raspberrypi:~ $ dmesg 
[   24.004482] bcmgenet fd580000.genet eth0: Link is Up - 100Mbps/Full - flow control off
[   24.004552] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   24.014151] EtherCAT 0: Link state of ecm0 changed to UP.
[   24.034186] EtherCAT 0: 1 slave(s) responding on main device.
[   24.034207] EtherCAT 0: Slave states on main device: PREOP.
[   24.034638] EtherCAT 0: Scanning bus.
[   24.120643] EtherCAT 0: Bus scanning completed in 80 ms.
[   24.120666] EtherCAT 0: Using slave 0 as DC reference clock.
[   24.846575] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   24.846586] Bluetooth: BNEP filters: protocol multicast
[   24.846607] Bluetooth: BNEP socket layer initialized
[   25.002811] Bluetooth: RFCOMM TTY layer initialized
[   25.002841] Bluetooth: RFCOMM socket layer initialized
[   25.002870] Bluetooth: RFCOMM ver 1.11
[   25.976010] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   31.208886] fuse init (API version 7.27)
[  104.729860] EtherCAT: Requesting master 0...
[  104.729877] EtherCAT: Successfully requested master 0.
[  104.730574] EtherCAT 0: Domain0: Logical address 0x00000000, 18 byte, expected working counter 3.
[  104.730582] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 18 byte, type LRW.
[  104.730738] EtherCAT 0: Master thread exited.
[  104.730750] EtherCAT 0: Starting EtherCAT-OP thread.
[  109.926466] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms.
[  109.933261] EtherCAT 0: Domain 0: Working counter changed to 3/3
[  109.933269] .
[  109.955538] EtherCAT 0: Slave states on main device: OP.
pi@raspberrypi:~ $ 

and the servo light is solid green so I think I am OP. I think this is all good news. but it doesn't seem to be able to sync...
So can you go to OP and not have a sync???
I don't know where to go next... but I went to HAL monitor and found that lcec.0.0.actpos was moving when I rotate the axis with my hand.

Probably I need to change my hal file. ( I only have 1 axis attached so far for testing)
and I see there is a lcec.0.0.poscmd a bit lower but I don't really know how to give it a new position to have the motor move.
Attachments:
Last edit: 23 May 2020 20:37 by theshade. Reason: added .xml file
The following user(s) said Thank You: besriworld, thefabricator03

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

Time to create page: 1.925 seconds
Powered by Kunena Forum