- Posts: 790
- Thank you received: 276
Ethercat HAL driver
- db1981
- Offline
- Platinum Member
-
Less
More
5 years 8 months ago #199443
by db1981
Replied by db1981 on topic Ethercat HAL driver
okay....
usually there is no need for a second thread if you don't need an Step Generator. Putting the Ethercat read and write in an faster thread then the calculations is the same as to putting water in an river.
and waste ressources.
delete "base_period_nsec=500000" and put the lcec functions in the servo thread, change the apptimecycle_period in the ec_conf to 1000000. that's it for timing.....
but theres annother big Problem :
execution order !!!
the running order of your functions is wrong. You are reading Inputs and writing directly the outputs without any action or calculations, without pids this will not be very terrible, but every command is 1 cycle delayed (f-error will be high).
So think about the execution order like we are using an normal PLC or programming an realtime function. the functions are executed like you have arranged them in hal file. So if an function needs the outputs from annother function it has to be called after this.
reading inputs
.
.
functions (IO Control, Motion, PLC)
.
.
calculations (pids always after motion, kinematics before motion)
writing Outputs
lcec.read_all (reading from hardware) has to be the first addf line in the hal.
lcec.write_all (write to hardware) must be the last addf line in the hal.
usually there is no need for a second thread if you don't need an Step Generator. Putting the Ethercat read and write in an faster thread then the calculations is the same as to putting water in an river.
delete "base_period_nsec=500000" and put the lcec functions in the servo thread, change the apptimecycle_period in the ec_conf to 1000000. that's it for timing.....
but theres annother big Problem :
execution order !!!
the running order of your functions is wrong. You are reading Inputs and writing directly the outputs without any action or calculations, without pids this will not be very terrible, but every command is 1 cycle delayed (f-error will be high).
So think about the execution order like we are using an normal PLC or programming an realtime function. the functions are executed like you have arranged them in hal file. So if an function needs the outputs from annother function it has to be called after this.
reading inputs
.
.
functions (IO Control, Motion, PLC)
.
.
calculations (pids always after motion, kinematics before motion)
writing Outputs
lcec.read_all (reading from hardware) has to be the first addf line in the hal.
lcec.write_all (write to hardware) must be the last addf line in the hal.
The following user(s) said Thank You: Nico2017, jc2ktr, Stormholt, Dimitri
- bkt
- Offline
- Platinum Member
-
Less
More
- Posts: 1111
- Thank you received: 114
5 years 8 months ago - 5 years 8 months ago #199450
by bkt
Replied by bkt on topic Ethercat HAL driver
@db1981 Yea I have acces ....but not know the right procedure for factory reset .... I try later
+ I must add pudh-pull resistor .... now led of el5151 blink .... so for sure is work. It need more than 15V signal on A-B signal so my NPN encored not reach that signal level .... but adding 2Kohm led blink ...now I must reset the unit.
+ I must add pudh-pull resistor .... now led of el5151 blink .... so for sure is work. It need more than 15V signal on A-B signal so my NPN encored not reach that signal level .... but adding 2Kohm led blink ...now I must reset the unit.
Last edit: 5 years 8 months ago by bkt.
- db1981
- Offline
- Platinum Member
-
Less
More
- Posts: 790
- Thank you received: 276
5 years 8 months ago #199454
by db1981
Replied by db1981 on topic Ethercat HAL driver
in Twincat, TAB Process Data, predefiened PDO Assignment, "Standart 32 Bit",
activate Configuration
activate Configuration
The following user(s) said Thank You: bkt
- jc2ktr
- Offline
- Premium Member
-
Less
More
- Posts: 87
- Thank you received: 17
5 years 8 months ago - 5 years 8 months ago #199455
by jc2ktr
when you put it like that it makes a lot of sense
I snucked my hal configuration from multiple sources together, without fully understanding how it works.
I will adapt my hal config and let you know how it behaves then, could only get better from now on, have so many learned in the last days/weeks.
@db1981 after your mentioned Changes of the HAL-Config the Axis runs super smooth and noise free. Only one problem is still there. When i do a cyclic position loop like G1 F2000 X0 to G1 F2000 X100 with 20 repeats. after a short time The drive gets in Error state with F2037 Excessive position command difference, In TwinCAT is this no Problem since now.
Replied by jc2ktr on topic Ethercat HAL driver
db1981 wrote: okay....
lcec.read_all (reading from hardware) has to be the first addf line in the hal.
lcec.write_all (write to hardware) must be the last addf line in the hal.
when you put it like that it makes a lot of sense
I snucked my hal configuration from multiple sources together, without fully understanding how it works.
I will adapt my hal config and let you know how it behaves then, could only get better from now on, have so many learned in the last days/weeks.
@db1981 after your mentioned Changes of the HAL-Config the Axis runs super smooth and noise free. Only one problem is still there. When i do a cyclic position loop like G1 F2000 X0 to G1 F2000 X100 with 20 repeats. after a short time The drive gets in Error state with F2037 Excessive position command difference, In TwinCAT is this no Problem since now.
Last edit: 5 years 8 months ago by jc2ktr. Reason: Edit
- bkt
- Offline
- Platinum Member
-
Less
More
- Posts: 1111
- Thank you received: 114
5 years 8 months ago #199723
by bkt
Replied by bkt on topic Ethercat HAL driver
@db1981 It is el5151 00x0 twincat configurator see it as el5151 0000 0025 and I see there are 2 configuration "1600/1601 - 1A00/1A01" these seems ok ... but not see any value changing inside online tab on twincat configurator (I use twincat configurator because more easy than twincat3). On twincat configurator I can send el5151 in OP mode ... but in linuxcnc is anytime on PREOP when all other slaves is in OP mode.
There are any reasons? Is only because is not set the right xml or there are other reasons?
regards
There are any reasons? Is only because is not set the right xml or there are other reasons?
regards
- db1981
- Offline
- Platinum Member
-
Less
More
- Posts: 790
- Thank you received: 276
5 years 8 months ago - 5 years 8 months ago #199735
by db1981
Replied by db1981 on topic Ethercat HAL driver
under the tab "process Data" , is an button "predefined PDO Assignment" there choose "standart 32 Bit" and run the configuration. this will change the pdo content of 1A00.
After this it should work with linuxcnc.
at the moment this is obiviously configured as "standart 16 Bit"...
After this it should work with linuxcnc.
at the moment this is obiviously configured as "standart 16 Bit"...
Last edit: 5 years 8 months ago by db1981.
Time to create page: 0.587 seconds