ethercat config for a stepper motor
24 Aug 2024 14:23 #308536
by jssazores
ethercat config for a stepper motor was created by jssazores
Hello.
I am working on a project that involves controlling a stepper motor in linuxcnc. I wanted an ethercat configuration so I bought a TMCM-1310 from trinamic and a sanyo denki SF2424 motor. I managed to install ethercat using the instructions provided by rodw. But I am new to linuxcnc and I have no idea of how to create the .ini, .hal and ethercat-conf. My current configuration is giving me this error and I do not know how to proceed:
Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
LINUXCNC - 2.9.3
Machine configuration directory is '/home/joao/linuxcnc/configs/Stepper'
Machine configuration file is 'my_machine.ini'
INIFILE=/home/joao/linuxcnc/configs/Stepper/my_machine.ini
VERSION=2.9.3
check_config:
Unspecified [JOINT_0]MAX_VELOCITY, default used: 1.0
Unspecified [JOINT_0]MAX_ACCELERATION, default used: 1.0
PARAMETER_FILE=
TPMOD=
HOMEMOD=
TASK=
HALUI=
DISPLAY=
COORDINATES=
KINEMATICS=trivkins
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
[EMCIO] CYCLE_TIME not found in /home/joao/linuxcnc/configs/Stepper/my_machine.ini; using default 0.100000
libnml/buffer/shmem.cc 320: Shared memory buffers toolCmd and toolCmd may conflict. (key=1004(0x3EC))
libnml/buffer/shmem.cc 320: Shared memory buffers toolSts and toolSts may conflict. (key=1005(0x3ED))
libnml/buffer/shmem.cc 320: Shared memory buffers emcError and emcError may conflict. (key=1003(0x3EB))
emc/iotask/ioControl.cc 786: can't load tool table.
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Found file(REL): ./my_machine.hal
Shutting down and cleaning up LinuxCNC...
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Debug file information:
Can not find -sec RS274NGC -var PARAMETER_FILE -num 1
Can not find -sec TASK -var TASK -num 1
Can not find -sec DISPLAY -var DISPLAY -num 1
Can not find -sec TRAJ -var COORDINATES -num 1
Can not find -sec DISPLAY -var INTRO_GRAPHIC -num 1
Can not find -sec DISPLAY -var INTRO_TIME -num 1
Note: Using POSIX realtime
LCEC: lcec_conf is not loaded
LCEC: exiting
LCEC: returning -EINVAL
lcec: rtapi_app_main: Invalid argument (-22)
./my_machine.hal:3: waitpid failed /usr/bin/rtapi_app lcec
./my_machine.hal:3: /usr/bin/rtapi_app exited without becoming ready
./my_machine.hal:3: insmod for lcec failed, returned -1
11122
Stopping realtime threads
Unloading hal components
Note: Using POSIX realtime
I do have the master and slaves configuration:
Master0
Phase: Idle
Active: no
Slaves: 1
Ethernet devices:
Main: fc:45:96:84:19:28 (attached)
Link: UP
Tx frames: 1145777
Tx bytes: 68746748
Rx frames: 1145776
Rx bytes: 68746688
Tx errors: 0
Tx frame rate [1/s]: 122 119 119
Tx rate [KByte/s]: 7.1 6.9 7.0
Rx frame rate [1/s]: 122 119 119
Rx rate [KByte/s]: 7.1 6.9 7.0
Common:
Tx frames: 4236392
Tx bytes: 254184032
Rx frames: 4236369
Rx bytes: 254182652
Lost frames: 23
Tx frame rate [1/s]: 122 119 119
Tx rate [KByte/s]: 7.1 6.9 7.0
Rx frame rate [1/s]: 122 119 119
Rx rate [KByte/s]: 7.1 6.9 7.0
Loss rate [1/s]: 0 -0 0
Frame loss [%]: 0.0 -0.0 0.0
Distributed clocks:
Reference clock: None
DC reference time: 0
Application time: 0
2000-01-01 00:00:00.000000000
=== Master 0, Slave 0 ===
Device: Main
State: PREOP
Flag: +
Identity:
Vendor Id: 0x00000286
Product code: 0x00001001
Revision number: 0x00000000
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, delay measurement only
DC system time transmission delay: 0 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 MII up open yes - 1655340570 0 0
1 MII down closed no - - - -
2 N/A down closed no - - - -
3 N/A down closed no - - - -
Mailboxes:
Bootstrap RX: 0x1000/268, TX: 0x110c/32
Standard RX: 0x1200/8, TX: 0x1210/8
Supported protocols: FoE
General:
Group: T
Image name:
Order number: T
Device name: T
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 0 mA
Any insights would be helpful
thanks in advance
I am working on a project that involves controlling a stepper motor in linuxcnc. I wanted an ethercat configuration so I bought a TMCM-1310 from trinamic and a sanyo denki SF2424 motor. I managed to install ethercat using the instructions provided by rodw. But I am new to linuxcnc and I have no idea of how to create the .ini, .hal and ethercat-conf. My current configuration is giving me this error and I do not know how to proceed:
Print file information:
RUN_IN_PLACE=no
LINUXCNC_DIR=
LINUXCNC_BIN_DIR=/usr/bin
LINUXCNC_TCL_DIR=/usr/lib/tcltk/linuxcnc
LINUXCNC_SCRIPT_DIR=
LINUXCNC_RTLIB_DIR=/usr/lib/linuxcnc/modules
LINUXCNC_CONFIG_DIR=
LINUXCNC_LANG_DIR=/usr/lib/tcltk/linuxcnc/msgs
INIVAR=inivar
HALCMD=halcmd
LINUXCNC_EMCSH=/usr/bin/wish8.6
LINUXCNC - 2.9.3
Machine configuration directory is '/home/joao/linuxcnc/configs/Stepper'
Machine configuration file is 'my_machine.ini'
INIFILE=/home/joao/linuxcnc/configs/Stepper/my_machine.ini
VERSION=2.9.3
check_config:
Unspecified [JOINT_0]MAX_VELOCITY, default used: 1.0
Unspecified [JOINT_0]MAX_ACCELERATION, default used: 1.0
PARAMETER_FILE=
TPMOD=
HOMEMOD=
TASK=
HALUI=
DISPLAY=
COORDINATES=
KINEMATICS=trivkins
Starting LinuxCNC...
Starting LinuxCNC server program: linuxcncsvr
Loading Real Time OS, RTAPI, and HAL_LIB modules
Starting LinuxCNC IO program: io
[EMCIO] CYCLE_TIME not found in /home/joao/linuxcnc/configs/Stepper/my_machine.ini; using default 0.100000
libnml/buffer/shmem.cc 320: Shared memory buffers toolCmd and toolCmd may conflict. (key=1004(0x3EC))
libnml/buffer/shmem.cc 320: Shared memory buffers toolSts and toolSts may conflict. (key=1005(0x3ED))
libnml/buffer/shmem.cc 320: Shared memory buffers emcError and emcError may conflict. (key=1003(0x3EB))
emc/iotask/ioControl.cc 786: can't load tool table.
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Found file(REL): ./my_machine.hal
Shutting down and cleaning up LinuxCNC...
Removing HAL_LIB, RTAPI, and Real Time OS modules
Removing NML shared memory segments
Debug file information:
Can not find -sec RS274NGC -var PARAMETER_FILE -num 1
Can not find -sec TASK -var TASK -num 1
Can not find -sec DISPLAY -var DISPLAY -num 1
Can not find -sec TRAJ -var COORDINATES -num 1
Can not find -sec DISPLAY -var INTRO_GRAPHIC -num 1
Can not find -sec DISPLAY -var INTRO_TIME -num 1
Note: Using POSIX realtime
LCEC: lcec_conf is not loaded
LCEC: exiting
LCEC: returning -EINVAL
lcec: rtapi_app_main: Invalid argument (-22)
./my_machine.hal:3: waitpid failed /usr/bin/rtapi_app lcec
./my_machine.hal:3: /usr/bin/rtapi_app exited without becoming ready
./my_machine.hal:3: insmod for lcec failed, returned -1
11122
Stopping realtime threads
Unloading hal components
Note: Using POSIX realtime
I do have the master and slaves configuration:
Master0
Phase: Idle
Active: no
Slaves: 1
Ethernet devices:
Main: fc:45:96:84:19:28 (attached)
Link: UP
Tx frames: 1145777
Tx bytes: 68746748
Rx frames: 1145776
Rx bytes: 68746688
Tx errors: 0
Tx frame rate [1/s]: 122 119 119
Tx rate [KByte/s]: 7.1 6.9 7.0
Rx frame rate [1/s]: 122 119 119
Rx rate [KByte/s]: 7.1 6.9 7.0
Common:
Tx frames: 4236392
Tx bytes: 254184032
Rx frames: 4236369
Rx bytes: 254182652
Lost frames: 23
Tx frame rate [1/s]: 122 119 119
Tx rate [KByte/s]: 7.1 6.9 7.0
Rx frame rate [1/s]: 122 119 119
Rx rate [KByte/s]: 7.1 6.9 7.0
Loss rate [1/s]: 0 -0 0
Frame loss [%]: 0.0 -0.0 0.0
Distributed clocks:
Reference clock: None
DC reference time: 0
Application time: 0
2000-01-01 00:00:00.000000000
=== Master 0, Slave 0 ===
Device: Main
State: PREOP
Flag: +
Identity:
Vendor Id: 0x00000286
Product code: 0x00001001
Revision number: 0x00000000
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, delay measurement only
DC system time transmission delay: 0 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 MII up open yes - 1655340570 0 0
1 MII down closed no - - - -
2 N/A down closed no - - - -
3 N/A down closed no - - - -
Mailboxes:
Bootstrap RX: 0x1000/268, TX: 0x110c/32
Standard RX: 0x1200/8, TX: 0x1210/8
Supported protocols: FoE
General:
Group: T
Image name:
Order number: T
Device name: T
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 0 mA
Any insights would be helpful
thanks in advance
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19188
- Thank you received: 6430
24 Aug 2024 16:09 #308541
by tommylight
Replied by tommylight on topic ethercat config for a stepper motor
hal and ini file are missing a lot of required stuff, so that will not work as noted in the debug section of the error report.
Start with some basic hal and ini, then remove only the parts you do not need, might be a bit easier as you get errors as soon as you remove something important.
Start with some basic hal and ini, then remove only the parts you do not need, might be a bit easier as you get errors as soon as you remove something important.
The following user(s) said Thank You: jssazores
Please Log in or Create an account to join the conversation.
24 Aug 2024 19:21 #308555
by zmrdko
Replied by zmrdko on topic ethercat config for a stepper motor
you can get some inspiration here:
github.com/zmrdko/3dworks_ethercat_lcec/
github.com/zmrdko/3dworks_ethercat_lcec/
The following user(s) said Thank You: tommylight, jssazores
Please Log in or Create an account to join the conversation.
24 Aug 2024 22:14 - 24 Aug 2024 23:16 #308561
by jssazores
Replied by jssazores on topic ethercat config for a stepper motor
Thank you all for the responses! I managed to get in the axis gui. I got a warning telling me about the appTimePeriod, which I corrected. But I am still unable to move the stepper. Do you have any idea of what I could be missing? Once again, I assume this is some trivial stuff, but I am still a noob on this subject
Edit: I ended up just adding an HALFILE line to axis.ini directly on the sim.axis/
Then I added a ethercat.hal and the following ethercat-conf:
<?xml version="1.0" encoding="UTF-8"?>
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
<slave idx="0" type="generic" vid="0x00000286">
<syncManager idx="0" dir="out">
<pdo idx="0x1600">
<pdoEntry idx="0x1000" subIdx="0x00" bitLen="32" halType="u32"/> <!-- Controller Mode -->
<pdoEntry idx="0x1004" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Value (Position/Velocity/Current) -->
</pdo>
</syncManager>
<syncManager idx="1" dir="in">
<pdo idx="0x1A00">
<pdoEntry idx="0x1078" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Target Position -->
<pdoEntry idx="0x107C" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Actual Position -->
<pdoEntry idx="0x1080" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Virtual Actual Position -->
</pdo>
</syncManager>
</slave>
</master>
</masters>
This was based on a video from MetalMusings
Edit 2: I noticed that when I run linuxcnc my driver state goes to PREOP
Edit: I ended up just adding an HALFILE line to axis.ini directly on the sim.axis/
Then I added a ethercat.hal and the following ethercat-conf:
<?xml version="1.0" encoding="UTF-8"?>
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="5">
<slave idx="0" type="generic" vid="0x00000286">
<syncManager idx="0" dir="out">
<pdo idx="0x1600">
<pdoEntry idx="0x1000" subIdx="0x00" bitLen="32" halType="u32"/> <!-- Controller Mode -->
<pdoEntry idx="0x1004" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Value (Position/Velocity/Current) -->
</pdo>
</syncManager>
<syncManager idx="1" dir="in">
<pdo idx="0x1A00">
<pdoEntry idx="0x1078" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Target Position -->
<pdoEntry idx="0x107C" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Actual Position -->
<pdoEntry idx="0x1080" subIdx="0x00" bitLen="32" halType="s32"/> <!-- Virtual Actual Position -->
</pdo>
</syncManager>
</slave>
</master>
</masters>
This was based on a video from MetalMusings
Edit 2: I noticed that when I run linuxcnc my driver state goes to PREOP
Last edit: 24 Aug 2024 23:16 by jssazores.
Please Log in or Create an account to join the conversation.
Time to create page: 0.077 seconds