- Posts: 446
- Thank you received: 0
Ethercat HAL driver
So the cycle time is probably in units of 1 µs?
Please Log in to join the conversation.
Please Log in to join the conversation.
db1981 wrote: hello,
0x1006 is the com cycle time = 500ns this is equal to your ethercat app cycle time
0x60C2 is the interpolation time, it's also 50ms * 10^ -5 = 500ns.
is your servo_period in the ini (thread which executes lcec_read/write) also set to 500ns (2khz) ?
This is my hal line with the periods:
loadrt [KINS]KINEMATICS
loadrt motmod base_period_nsec=500000 servo_period_nsec=1000000 traj_period_nsec=100000
when i try to change the servo period linuxcnc did not start anymore.
Please Log in to join the conversation.
In which of this threads the lcecs are called (addf)
can you attach the hal file, seems there is something strange with the bus cycle time and the dcconf.
In the Indramat manual is written, that for an position control cycle at 0,25ms (fix for this drive) the communcation period should be min. 1ms.
Please Log in to join the conversation.
db1981 wrote: thats an servo_period of 1ms,
In which of this threads the lcecs are called (addf)
can you attach the hal file, seems there is something strange with the bus cycle time and the dcconf.
In the Indramat manual is written, that for an position control cycle at 0,25ms (fix for this drive) the communcation period should be min. 1ms.
This is my halfile where lcec is loaded
Attachment not found
Please Log in to join the conversation.
this does not match the drivers pdo. If this is an used device (ebay etc.. ) the card may be is configured for 16 Bit Mode. Factory standart would be 32 Bit mode (MDP511), for this the driver is configured.
Is this exactly an EL5151 or an special type EL5151-00XX ?.
Do you have acces to twincat? this would be much faster then configure the Card with sdo commands.
Please Log in to join the conversation.
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.
Please Log in to join the conversation.
+ 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.
Please Log in to join the conversation.
activate Configuration
Please Log in to join the conversation.
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.
Please Log in to join the conversation.
