Beckhoff ethercat 64 with bit linuxcnc, How to install.

More
19 Feb 2021 20:53 - 20 Feb 2021 08:06 #199477 by chimeno
Hello @V-max,

Thank you very much for naming my name, but I have no merit, I just try to help where I can

Do you know where to find the headers for 4.19.0.09?

I don't know if you mean these headers, using the command
sudo apt install linux-headers-$(uname -r)
you have to replace this (uname -r) with the version you have.

@Chimeno , Is the ax5203 config file correct,? Any clue or documentation recommended?

your .xml file has to bring the device to OP, if you don't have an AX5801 card installed as in the photo

Change this setting
<InitCmd>
<Transition>PS</Transition>
<Comment>
<![CDATA[ Configured safety option ]]>
</Comment>
<Timeout>0</Timeout>
<OpCode>3</OpCode>
<DriveNo>0</DriveNo>
<IDN>34768</IDN>
<Elements>64</Elements>
<Attribute>0</Attribute>
<Data>0100</Data>
</InitCmd>

Change
<InitCmd>
<Transition>PS</Transition>
<Comment>
<![CDATA[ Configured safety option ]]>
</Comment>
<Timeout>0</Timeout>
<OpCode>3</OpCode>
<DriveNo>0</DriveNo>
<IDN>34768</IDN>
<Elements>64</Elements>
<Attribute>0</Attribute>
<Data>0000</Data>
</InitCmd>


I must also change this,
<InitCmd>
<Transition>PS</Transition>
<Comment>
<![CDATA[ DC link connection mode ]]>
</Comment>
<Timeout>0</Timeout>
<OpCode>3</OpCode>
<DriveNo>0</DriveNo>
<IDN>32982</IDN>
<Elements>64</Elements>
<Attribute>0</Attribute>
<Data>0300</Data>
</InitCmd>
change
<InitCmd>
<Transition>PS</Transition>
<Comment>
<![CDATA[ DC link connection mode ]]>
</Comment>
<Timeout>0</Timeout>
<OpCode>3</OpCode>
<DriveNo>0</DriveNo>
<IDN>32982</IDN>
<Elements>64</Elements>
<Attribute>0</Attribute>
<Data>0000</Data>
</InitCmd>

the
post_gui.hal
file would not be the best, it is best if you have it in a file
.hal

From here, you still need all the configuration in the motor and encoder .xml file and other options, you will have to have TWINCAT3 to make the configuration and then export it,


Here are a couple of interesting manuals.
download.beckhoff.com/download/document/...em_manual_hw2_en.pdf
download.beckhoff.com/download/document/...diag_messages_en.pdf
download.beckhoff.com/download/document/...-descriptions_en.pdf


the usury @db1981 can help you much more than me

Greeting
Chimeno
Attachments:
Last edit: 20 Feb 2021 08:06 by chimeno. Reason: add manuals

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

More
26 Feb 2021 11:22 #200184 by V-max
The problem which headers: typing "sudo apt install linux-headers-$(uname -r)" you are looking for a file in an external (debian) server, this headers version is obsolete for Debian and deleted it. The way recommended to solve the problem is to update the kernel but I'm not sure that the new kernel is completely supported by linuxcnc. Here(linuxcnc) the kernel seems to be important due to the rt environment.
I have a safety AX5801 card installed, enabled, and electrically bridged because I had troubles unabling it due to the driver, I think, needs a dummy card if you unmount it.
The DC-link was shit by my side.I have a safety Ax5801 card installed, enabled, and electrically bridged because I had troubles unabling it due to the driver, I think, needs a dummy card if you unmount it. Safety issues,,,
The DC-link was shit from me.
Thanks!

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

More
26 Feb 2021 11:25 #200185 by V-max
..........and one week later.
Thanks a lot for giving me away your time answering rookie questions. Your answers allowed me to understand concepts and bad procedures.
Im going to increase the level of my questions.

@db1982
loadusr -W /home/avc/linuxcnc-ethercat/src/lcec_conf /home/avc/linuxcnc/configs/sim.axis/ethercat-conf.xml
I don't understand what lcec_conf does then ¿what has to be inside the ethercat-conf.xml?, The whole list of idns exported from TC3? The startup list? Is it needed to do any transformation of the XML files? A new one XML within different things?

The attached files come from a TC3 configuration that works(in TC3), but I suppose that is needed to adapt some parameters related to the communication with linuxcnc-ethercat/src/lcec-ax5200 and the EtherCAT environment. Right? Which are?

Speaking about lcec-ax5000, what it do? Has the whole driver mapped, a part or nothing? Is needed any special configuration f.e control mode: velocity or position control.

And speaking about control modes the LAST QUESTION ...for today.....jejeje , I'm trying to implement PID control only because I have seen it surfing. Do you think that it is the right mode? Are there more ways? What do you recommend using EtherCAT, an AX5203 drive, and trying to use de lcec_ax5200 to simplify?[/size]

Thanks a lot

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

More
26 Feb 2021 11:40 #200186 by V-max
Sorry I didn't do the help request......
I have problems passing to op state in the drive, I have attached above the dmesg file printed, there are several SoE problems, I suppose related above questions.
I have done "#define EC_AL_STATE_CHANGE_TIMEOUT 5 to
+#define EC_AL_STATE_CHANGE_TIMEOUT 25
and recompiled the EtherCAT driver" as told in another thread.
The XMLs used were the startup list directly exported from TC3 and the whole list. I have more or less the same problem with both XML.
Thanks.

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

More
26 Feb 2021 12:46 - 26 Feb 2021 12:53 #200190 by db1981
Hello V-max. i try to answer but my english writing has sleept a few years......

loadusr -W /home/avc/linuxcnc-ethercat/src/lcec_conf /home/avc/linuxcnc/configs/sim.axis/ethercat-conf.xml

I don't understand what lcec_conf does then ¿what has to be inside the ethercat-conf.xml?, The whole list of idns exported from TC3? The startup list? Is it needed to do any transformation of the XML files? A new one XML within different things?


lcec_conf is an userspace component and does the configuration of your ethercat system, it tells the master all needed informations to get the slaves and the communication configured.
-settings for the master, which slaves, Dc clock config, which pdo has to be mapped etc.

It also mapps the hal-pins you want to assign to the available ethercat pdos.
this can be done manually with the "generic driver" (configpdo etc. ...) or with an native programmed driver like (el2008, ax5200 ...)
the advantage for the native drivers are, that you able to integrate logic and code into them like scaling, enable state machines, error handling etc..

For each master an read and an write function is created (lcec.read_all / .write_all), this functions then has one read or write function per slave (coded in the driver).

The realtime part lcec then is called at every cycle of your thread. Usually at first the read_function, then motion, pids, calculations, plc, etc. and at last the write_function to put data back to ethercat.

your attached config_xml has the right format.

The whole list of idns exported from TC3? The startup list? The attached files come from a TC3 configuration that works(in TC3), but I suppose that is needed to adapt some parameters related to the communication with linuxcnc-ethercat/src/lcec-ax5200 and the EtherCAT environment. Right? Which are?


AX5000 are SoE Drives with no internal stored parameter, so this devices like all other Sercos Drives i know, are configured at startup from the master. This has the advantage that in the field you can change an defective device simple without the need to configure it with the manufactures software or paramter papers that had been stored in a cabinet and the key is lost....
Etherlab / linuxcnc ethercat can do these ethercat mailbox stuff like SoE, CoE, EoE, FoE etc .. you can tell the master this with singles lines in the ethercat conf.xml or put them in an extern file and tell the master that this parameters has to been sent to an slave (initcms line in the config xml)..

your file startup_original...xml has the correct format for this, it has to be the snippet <EtherCATMailbox><SoE><InitCmds> .. from the twincat export. you have to adapt the "Control unit cycle time (TNcyc)" Parameter to your linuxcnc-ethercat configuration, but about that i will talk later.

Speaking about lcec-ax5000, what it do? Has the whole driver mapped, a part or nothing? Is needed any special configuration f.e control mode: velocity or position control.


That depends on how the native driver is coded. The ax5x00 driver in lcnc-ethercat is actually coded for velocity control, that meens current and velocity controller runs in the ax5000 and position control is done by linuxcncs pids... The PDO Mapping corresponds to the beckhoff standart mapping for velocity control with an additional txPDO for torque information.

this is the coded mapping:
static ec_pdo_entry_info_t lcec_ax5200_in_a[] = {
{0x0087, 0x01, 16}, // status word
{0x0033, 0x01, 32}, // position feedback
{0x0054, 0x01, 16} // torque feedback
};
static ec_pdo_entry_info_t lcec_ax5200_out_a[] = {
{0x0086, 0x01, 16}, // control-word
{0x0018, 0x01, 32}, // velo-command
};

I'm trying to implement PID control only because I have seen it surfing. Do you think that it is the right mode? Are there more ways?


If you want to use the stable preprogrammed driver this should be the way you go....

About your actual problem:
-first you have to set drive mode to velocity control and attach the torque feedback to the pdo list. that is needed for an equal
configuration with the lcec driver. This has to be done for both Axis.
-if you don't want to edit later by hand, set your TC SAF and IO Cycle time to 1ms like your servo thread in linuxcnc is configured
-tune your velocity loop with twincat
-export the Initcmds again and create an xml file.
-try again with lcec to get the drive in op state, if you have an good PC with an Intel NIC this should work. AX are very sensitive with the DC CLOCK may be there are some changes neccesary. but furthermore about this in an next post.....
Last edit: 26 Feb 2021 12:53 by db1981.

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

More
26 Feb 2021 19:37 #200218 by db1981
by viewing your log file, i noticed there is something wrong with you Nic driver or the installation, ethercat link is many times lost.

Linuxcnc ver ?
kernel?
rtpreempt ?

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

More
27 Feb 2021 12:57 #200288 by V-max
Hi db1981

What a Masterclass of linuxcnc, EtherCAT drivers........wou!!! Thanks for me and others!
You are faster answering than me checking your answer! I'm sorry.

Linuxcnc 2.8.1

#1 SMP PREEMPT RT Debian 4.19.171-2 (2021-01-30)

4.19.0-14rt-amd64

The kernel was updated by me right after installation.
I was unable to update the headers (The headers for the linuxcnc official download link are obsolete and unavailable)(On the Debian website at least). Then I had to update the Kernel and installing the headers.
I chose between update Kernel with headers instead of Kernel tested without headers. Did I wrong?

Thanks!!

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

More
27 Feb 2021 13:22 - 27 Feb 2021 13:24 #200291 by db1981
Hi,

i will check for the versions when i am back in office...

but in youre log we can see that you have an realtek 8169nic , is this an laptop or normal mainboard? i have often got timming issues with realtek exspecially on notebooks.

please change your driver in /etc/default/ethercat from the generic to the RLT8169 driver, after this do an sudo update-ethercat-config and reboot.

then start an ethercat thread again and check if these lines in your log still appears:

Feb 26 08:57:47 debian kernel: [ 240.211305] Generic PHY r8169-800:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=r8169-800:00, irq=IGNORE)
Feb 26 08:57:47 debian kernel: [ 240.216249] EtherCAT 0: Link state of ecm0 changed to DOWN.
Feb 26 08:57:47 debian kernel: [ 240.326999] r8169 0000:08:00.0 enp8s0: Link is Down
Feb 26 08:57:48 debian kernel: [ 240.554915] Generic PHY r8169-800:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=r8169-800:00, irq=IGNORE)
F

Last edit: 27 Feb 2021 13:24 by db1981.

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

More
01 Mar 2021 10:49 #200609 by V-max
Hi
I have had troubles when I tried to change:
DEVICES_MODULES="generic" to r8189 or RLT8169.It complain about "Module ec_RLT8169 not found".
Nevertheless, I'm really using an AsusPrime B450M-K(AMD Ryzen 7 2700x + AMD Vega 56), the network card is Realtek® RTL8111H, I have read about troubles when the system installs as default R8169 and I updated to "github.com/mtorromeo/r8168" the most similar that I found.
I think the problem that you mentioned is now solved. But there are others, attached dmesg out and the resume of the errors.
Reading the attention part of the "DEVICE_MODULES=....." of the file
/etc/default/ethercat, I have thought that would be good:
LINK_DEVICES="eth0"
LINK_DEVICES="enp8s0".
And did it.

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

More
01 Mar 2021 13:43 #200690 by db1981
Hi,

there still seems to be some config errors with the network card. but i'm not really shure at the moment.

Your IDN Config is still for position mode, that will not work.

AX5203, Hardware V1. right ?
If (true) then
unplug your motor and feedback connectors;
and use the attached IDN file, its designed for 2x asynchron Motor without feedback. Only for testing, to get the communciaton running.

File Attachment:

File Name: ax5203_2x_asm.xml
File Size:20 KB

repost the dmesg output.
Attachments:

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

Time to create page: 0.130 seconds
Powered by Kunena Forum