EtherCAT: How to use the dedicated OmrG5 lcec driver?

More
04 Jun 2020 18:54 #170118 by arvidb
I'm running linuxcnc with EtherCAT support installed according to Nico2017's instructions here . So, running bleeding edge linuxcnc-2.9.0~pre0 and latest linuxcnc-ethercat with latest commit from 2019-11-21 - "Add omron g5 support".

I have an Omron G5/R88D-KN04H-ECT servo drive. It is detected by 'ethercat slaves':
$ ethercat slaves
0  0:0  PREOP  +  R88D-KN04H-ECT G5 Series ServoDrive/Motor

I can read e.g. "Position actual value":
$ ethercat upload -p 0 -t int32 0x6064 0x0
0xfffde579 -137863


However the drive will not enter OP mode when I run these halrun commands:
loadrt threads name1=master period1=1000000
loadusr -W lcec_conf linuxcnc/configs/ecat-test.xml
loadrt lcec
addf lcec.read-all master
addf lcec.write-all master
start

... and the motor position is also not read correctly in HAL:
halcmd: getp lcec.0.0.pos-fb-raw
0

My ecat-test.xml file looks like this:
<masters>
        <master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
                <slave idx="0" type="OmrG5"/>
        </master>
</masters>

/var/log/messages looks like this after execulting the halrun commands above:
Jun  4 20:38:18 debian kernel: [ 2379.133439] EtherCAT: Requesting master 0...
Jun  4 20:38:18 debian kernel: [ 2379.133443] EtherCAT: Successfully requested master 0.
Jun  4 20:38:18 debian kernel: [ 2379.133566] EtherCAT 0: Domain0: Logical address 0x00000000, 40 byte, expected working counter 3.
Jun  4 20:38:18 debian kernel: [ 2379.133568] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 40 byte, type LRW at 0000000045db7704.
Jun  4 20:38:18 debian kernel: [ 2379.134668] EtherCAT 0: Master thread exited.
Jun  4 20:38:18 debian kernel: [ 2379.134671] EtherCAT 0: Starting EtherCAT-OP thread.
Jun  4 20:38:18 debian kernel: [ 2379.134743] EtherCAT WARNING 0: 1 datagram UNMATCHED!

Any idea what I'm doing wrong?

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

More
04 Jun 2020 19:42 #170121 by arvidb
Some further info: if I try to change state to SAFEOP using ethercat states:
$ ethercat states SAFEOP
... I get an error indication on the drive: error 90 - "Communications setting error".

When executing "start" in halrun above I do not get any reaction at all from the drive. Neither any error code nor the LED change that would correspond to SAFEOP or OP state - it just continues to show PREOP. The drive is supposed to enter OP state when "start" hal command is issued, right?

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

More
05 Jun 2020 20:20 #170275 by arvidb
I *think* the Communications setting error is because of wrong DC (distributed clock) Sync0 config. This is not possible to configure with the ethercat command line tool; it must be done with a client program though the etherlabmaster API.

But I found out what the problem is with the linuxcnc-ethercat omrg5 driver! After increasing the ethercat debug level by running 'ethercat debug 1' I found this in syslog when loading the bus config (lcec_conf ...) in halrun:
Jun  5 20:44:57 debian kernel: [10723.751423] EtherCAT DEBUG 0 0:0: Slave main-0 has no matching product code (0x00000007) for configuration (0x00000005).

*duh* Only the R88D-KN01H-ECT product ID (0x00000005) is defined in the linuxcnc-ethercat OmrG5 driver! After modifying the code to add all the G5 drives, my drive (an R88D-KN04H-ECT) now goes to OP state and responds to pos-cmd changes in halrun! Wohoo! :woohoo:

I will try to get the code upstream, but I attach my patch here in case someone wants to use the current commit (from 2019-11-21) of linuxcnc-ethercat with their G5 drives:

File Attachment:

File Name: omrg5-all-...ls.patch
File Size:7 KB


The bus config xml file looks like this:
<masters>
	<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
		<slave idx="0" type="R88D-KN04H-ECT">
			<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
			<watchdog divider="2498" intervals="1000"/>
		</slave>
	</master>
</masters>

The dcConf and watchdog values are from the manufacturer's device description file.
Attachments:
The following user(s) said Thank You: chimeno, CORBETT, DPFlex

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

More
07 Jul 2020 21:20 #173919 by Korbi
Hi can you tell me how you managed to get the drive in OP Mode. Iam faced with the same problem.

maybe you can upload your files

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

More
08 Jul 2020 02:51 #173946 by CORBETT
@arvidb

Awesome that you made this fix... I have several of these models that I have not had time to try yet.

Thanks,
Robert
The following user(s) said Thank You: arvidb

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

More
08 Jul 2020 12:02 #173970 by arvidb
I'm glad it helps! :)

I made a pull request to sittner's github repo a month ago: github.com/sittner/linuxcnc-ethercat/pull/89. Unfortunately I have gotten no reaction to that request yet. Hopefully he we accept it sooner or later.

Note that this driver configures the drives to use the default "258th PDO Mappings", i.e. cyclic synchronous position control only. Maybe it would be a good idea to use some other mapping that allows speed control (and feedback) as well.

Korbi: I'm not sure what else to tell you. I used the bus config file (.xml file) quoted above, and the modified omrG5 driver, as described.

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

More
11 Jul 2020 20:28 - 12 Jul 2020 16:29 #174326 by Korbi
Thanks for your very god work.
Iam now able to move my servo.

How did you change the scaling of the Encoder?
for me are
ENCODER_SCALE
INPUT_SCALE
SCALE
and so on, not working.

Found the solition, its in hal
Pos.scale 262144
Last edit: 12 Jul 2020 16:29 by Korbi.

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

More
14 Jul 2020 19:51 #174661 by arvidb
Glad you got it working!

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

More
08 Oct 2020 15:42 #185365 by arvidb
Today Sascha ("sittner") accepted my pull request into his linuxcnc-ethercat repo, so now users of Omron G5/Accurax EtherCAT drives can use that repo again, and keep up to date with his driver. Yay!
The following user(s) said Thank You: tommylight, CORBETT

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

More
17 Oct 2020 11:41 #186348 by Korbi
new reopo works fine.
I want to use an g5 servo as spindle motor.
has someone managed the same, and can post his files?

Or can someone tell me how to do that?

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

Time to create page: 0.129 seconds
Powered by Kunena Forum