EtherCat - CATIO module Help
19 Jun 2024 03:41 - 19 Jun 2024 03:49 #303320
by BHar
EtherCat - CATIO module Help was created by BHar
Hi There,
I have been trying to setup a "CAT-IO" ethercat IO board, it's not unlike the DIEWU DIO board RodW made a config for.
Using the rpi-4-debian-bookworm-6.1.54-rt15-arm64-ext4-2023-11-17-1731 image, worked well.
Ethercat is up and running, ethecat-conf.xml seems to be accepted, I have only set up the outputs so far as I'm trying to do it piecemeal to reduce complexity.
Issue is, while I can see the pins in halshow, and I can set them - the outputs don't actually turn on at the IO device.
dmesg shows:
[18011.371947] EtherCAT: Requesting master 0...
[18011.371968] EtherCAT: Successfully requested master 0.
[18011.372513] EtherCAT 0: Domain0: Logical address 0x00000000, 42 byte, expected working counter 1.
[18011.372518] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 42 byte, type LWR.
[18011.372664] EtherCAT 0: Master thread exited.
[18011.372673] EtherCAT 0: Starting EtherCAT-OP thread.
I also don't see it going OP in $ethercat slaves, is it supposed to show OP here after linuxcnc is started and dmseg shows 'Starting EtherCAT-OP thread' as above?
cnc@CNC:~$ ethercat slaves
0 0:0 PREOP + IMC IO MODEL with EtherCAT
Here is The ethercat-conf.xml - sadly I cannot find anywhere any documentation on the spec for this document, so some is a guess, parts I'm unsure about are in bold.
<!--
Slave0 EtherCat IO Card "CAT-IO"
www.aliexpress.us/item/3256805154534518....pt=glo2usa4itemAdapt
-->
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
<slave idx="0" type="generic" vid="0x00090588" pid="0x00109252" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="3" dir="out">
<pdo idx="1600">
<!-- Digtial Outputs -->
<pdoEntry idx="2300" subIdx="01" bitLen="16" halType="complex">
<complexEntry bitLen="1" halPin="out-01" halType="bit"/>
<complexEntry bitLen="1" halPin="out-02" halType="bit"/>
<complexEntry bitLen="1" halPin="out-03" halType="bit"/>
<complexEntry bitLen="1" halPin="out-04" halType="bit"/>
<complexEntry bitLen="1" halPin="out-05" halType="bit"/>
<complexEntry bitLen="1" halPin="out-06" halType="bit"/>
<complexEntry bitLen="1" halPin="out-07" halType="bit"/>
<complexEntry bitLen="1" halPin="out-08" halType="bit"/>
<complexEntry bitLen="1" halPin="out-09" halType="bit"/>
<complexEntry bitLen="1" halPin="out-10" halType="bit"/>
<complexEntry bitLen="1" halPin="out-11" halType="bit"/>
<complexEntry bitLen="1" halPin="out-12" halType="bit"/>
<complexEntry bitLen="1" halPin="out-13" halType="bit"/>
<complexEntry bitLen="1" halPin="out-14" halType="bit"/>
<complexEntry bitLen="1" halPin="out-15" halType="bit"/>
<complexEntry bitLen="1" halPin="out-16" halType="bit"/>
</pdoEntry>
</pdo>
</syncManager>
</slave>
</master>
</masters>
Im just testing it in a simple my-mill sim setup, that I have added the lcec lines to:
Top of my-mill.hal file:
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt sim_parport names=parport.0
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0
loadrt pwmgen output_type=1
[/code]
I have been trying to setup a "CAT-IO" ethercat IO board, it's not unlike the DIEWU DIO board RodW made a config for.
Using the rpi-4-debian-bookworm-6.1.54-rt15-arm64-ext4-2023-11-17-1731 image, worked well.
Ethercat is up and running, ethecat-conf.xml seems to be accepted, I have only set up the outputs so far as I'm trying to do it piecemeal to reduce complexity.
Issue is, while I can see the pins in halshow, and I can set them - the outputs don't actually turn on at the IO device.
dmesg shows:
[18011.371947] EtherCAT: Requesting master 0...
[18011.371968] EtherCAT: Successfully requested master 0.
[18011.372513] EtherCAT 0: Domain0: Logical address 0x00000000, 42 byte, expected working counter 1.
[18011.372518] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 42 byte, type LWR.
[18011.372664] EtherCAT 0: Master thread exited.
[18011.372673] EtherCAT 0: Starting EtherCAT-OP thread.
I also don't see it going OP in $ethercat slaves, is it supposed to show OP here after linuxcnc is started and dmseg shows 'Starting EtherCAT-OP thread' as above?
cnc@CNC:~$ ethercat slaves
0 0:0 PREOP + IMC IO MODEL with EtherCAT
Here is The ethercat-conf.xml - sadly I cannot find anywhere any documentation on the spec for this document, so some is a guess, parts I'm unsure about are in bold.
<!--
Slave0 EtherCat IO Card "CAT-IO"
www.aliexpress.us/item/3256805154534518....pt=glo2usa4itemAdapt
-->
<masters>
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1">
<slave idx="0" type="generic" vid="0x00090588" pid="0x00109252" configPdos="true">
<dcConf assignActivate="300" sync0Cycle="*1" sync0Shift="0"/>
<syncManager idx="3" dir="out">
<pdo idx="1600">
<!-- Digtial Outputs -->
<pdoEntry idx="2300" subIdx="01" bitLen="16" halType="complex">
<complexEntry bitLen="1" halPin="out-01" halType="bit"/>
<complexEntry bitLen="1" halPin="out-02" halType="bit"/>
<complexEntry bitLen="1" halPin="out-03" halType="bit"/>
<complexEntry bitLen="1" halPin="out-04" halType="bit"/>
<complexEntry bitLen="1" halPin="out-05" halType="bit"/>
<complexEntry bitLen="1" halPin="out-06" halType="bit"/>
<complexEntry bitLen="1" halPin="out-07" halType="bit"/>
<complexEntry bitLen="1" halPin="out-08" halType="bit"/>
<complexEntry bitLen="1" halPin="out-09" halType="bit"/>
<complexEntry bitLen="1" halPin="out-10" halType="bit"/>
<complexEntry bitLen="1" halPin="out-11" halType="bit"/>
<complexEntry bitLen="1" halPin="out-12" halType="bit"/>
<complexEntry bitLen="1" halPin="out-13" halType="bit"/>
<complexEntry bitLen="1" halPin="out-14" halType="bit"/>
<complexEntry bitLen="1" halPin="out-15" halType="bit"/>
<complexEntry bitLen="1" halPin="out-16" halType="bit"/>
</pdoEntry>
</pdo>
</syncManager>
</slave>
</master>
</masters>
Im just testing it in a simple my-mill sim setup, that I have added the lcec lines to:
Top of my-mill.hal file:
# If you make changes to this file, they will be
# overwritten when you run stepconf again
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt sim_parport names=parport.0
setp parport.0.reset-time 5000
loadrt stepgen step_type=0,0,0
loadrt pwmgen output_type=1
[code]I'm sorry to ask whats likely a simple question - I have tried for a few days and read everything I can before coming here to get help!
Can anyone pick the issue with my setup?
Last edit: 19 Jun 2024 03:49 by BHar. Reason: Formatting fixes
Please Log in or Create an account to join the conversation.
19 Jun 2024 04:07 #303323
by paul_chx
Replied by paul_chx on topic EtherCat - CATIO module Help
In your ethercat_conf.xml check that vid and pid are correct - maybe remove the leading zeros. Just an idea, though. Had similar behavior when I mistyped the pid for a servo drive.
The following user(s) said Thank You: BHar
Please Log in or Create an account to join the conversation.
19 Jun 2024 05:58 - 19 Jun 2024 05:58 #303326
by jjdege
Replied by jjdege on topic EtherCat - CATIO module Help
HI
This worked with another device, I don't know if it can help you.
Maybe the idx needs to be fixed
HI
This worked with another device, I don't know if it can help you.
Maybe the idx needs to be fixed
HI
Attachments:
Last edit: 19 Jun 2024 05:58 by jjdege.
Please Log in or Create an account to join the conversation.
19 Jun 2024 07:52 #303332
by BHar
Replied by BHar on topic EtherCat - CATIO module Help
Thanks Paul_chx
I gave that a shot, though it did not seem to make a difference.
I gave that a shot, though it did not seem to make a difference.
Please Log in or Create an account to join the conversation.
19 Jun 2024 07:55 #303333
by BHar
Replied by BHar on topic EtherCat - CATIO module Help
Thanks jjdege
I notice the VID PID didnt in your file include the 0X, as mentioned by Paul.
Your comment, "Maybe the idx needs to be fixed"
The IDX were one of the parameters I could not find any documentation on.
I notice the formatting of your file is quite different - Ill try to reformat my file to match and see if that's the trick.
Thanks!
I notice the VID PID didnt in your file include the 0X, as mentioned by Paul.
Your comment, "Maybe the idx needs to be fixed"
The IDX were one of the parameters I could not find any documentation on.
I notice the formatting of your file is quite different - Ill try to reformat my file to match and see if that's the trick.
Thanks!
Please Log in or Create an account to join the conversation.
19 Jun 2024 08:27 #303339
by BHar
Replied by BHar on topic EtherCat - CATIO module Help
Can anyone tell me if I should expect the output from $ ethercat slaves
"0 0:0 PREOP + IMC IO MODEL with EtherCAT"
to change from PREOP to OP once LinuxCNC has successfully opened LCEC has read in the ethercat-conf.xml file?
And If I should be able to click the set and clr buttons in halshow and see the outputs go on an off?
This is what I have been using to test success or more accurately failure so far.
Also, is there any documentation on the XML file.
I have just been gleaning what I can from dmsg but would love to know what I should see on success and what some of the error messages mean
For Example are lines 2 & 3 here a message, warning or error?
[35038.277874] EtherCAT: Successfully requested master 0.
[35038.278683] EtherCAT 0: Domain0: Logical address 0x00000000, 2 byte, expected working counter 1.
[35038.278688] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 2 byte, type LWR.
[35038.278728] EtherCAT 0: Master thread exited.
[35038.278736] EtherCAT 0: Starting EtherCAT-OP thread.
"0 0:0 PREOP + IMC IO MODEL with EtherCAT"
to change from PREOP to OP once LinuxCNC has successfully opened LCEC has read in the ethercat-conf.xml file?
And If I should be able to click the set and clr buttons in halshow and see the outputs go on an off?
This is what I have been using to test success or more accurately failure so far.
Also, is there any documentation on the XML file.
I have just been gleaning what I can from dmsg but would love to know what I should see on success and what some of the error messages mean
For Example are lines 2 & 3 here a message, warning or error?
[35038.277874] EtherCAT: Successfully requested master 0.
[35038.278683] EtherCAT 0: Domain0: Logical address 0x00000000, 2 byte, expected working counter 1.
[35038.278688] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 2 byte, type LWR.
[35038.278728] EtherCAT 0: Master thread exited.
[35038.278736] EtherCAT 0: Starting EtherCAT-OP thread.
Please Log in or Create an account to join the conversation.
19 Jun 2024 09:39 #303344
by rodw
Replied by rodw on topic EtherCat - CATIO module Help
Start by typing ethercat pdos. That will list all of the possible PDOs you can create.
Share it here in a spoiler and we'll have a look.
THis has quite a few other features than the Deiwu so it will be a bit more complex.
There are plenty of clues in their listing. Use Google Lens on your phone to translate the CHinese
Share it here in a spoiler and we'll have a look.
THis has quite a few other features than the Deiwu so it will be a bit more complex.
There are plenty of clues in their listing. Use Google Lens on your phone to translate the CHinese
Please Log in or Create an account to join the conversation.
28 Jun 2024 22:40 #303993
by BHar
Replied by BHar on topic EtherCat - CATIO module Help
Thanks RodW
I did find the manual and translate, it's attached here for anyone else who might come across this device.
Here is the pdos output:
SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1100, DefaultSize 128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1200, DefaultSize 0, ControlRegister 0x64, Enable 1
RxPDO 0x1600 "RxPDO-Map"
PDO entry 0x2300:00, 16 bit, "Digital Outputs"
PDO entry 0x2310:00, 16 bit, "Analog Output"
PDO entry 0x2311:00, 16 bit, "Analog Output"
PDO entry 0x2320:00, 32 bit, "PWM Freq Output"
PDO entry 0x2321:00, 32 bit, "PWM Freq Output"
PDO entry 0x2330:00, 16 bit, "PWM prop Output"
PDO entry 0x2331:00, 16 bit, "PWM prop Output"
RxPDO 0x1601 "RxPDO-Map"
PDO entry 0x2602:01, 32 bit, "SubIndex 001"
PDO entry 0x2602:02, 32 bit, "SubIndex 002"
PDO entry 0x2602:03, 32 bit, "SubIndex 003"
PDO entry 0x2602:04, 32 bit, "SubIndex 004"
PDO entry 0x2602:05, 32 bit, "SubIndex 005"
PDO entry 0x2602:06, 32 bit, "SubIndex 006"
PDO entry 0x2602:07, 32 bit, "SubIndex 007"
PDO entry 0x2602:08, 32 bit, "SubIndex 008"
RxPDO 0x1602 "RxPDO-Map"
PDO entry 0x2600:01, 16 bit, ""
PDO entry 0x2600:03, 16 bit, ""
PDO entry 0x2600:04, 16 bit, ""
PDO entry 0x2601:02, 16 bit, ""
SM3: PhysAddr 0x1400, DefaultSize 0, ControlRegister 0x20, Enable 1
TxPDO 0x1a00 "TxPDO-Map"
PDO entry 0x2000:00, 16 bit, "Digital Inputs"
PDO entry 0x2010:00, 16 bit, "Analog Input"
PDO entry 0x2011:00, 16 bit, "Analog Input"
PDO entry 0x2020:00, 32 bit, "Encoder Inputs"
PDO entry 0x2030:00, 32 bit, "Counter Input"
PDO entry 0x2031:00, 32 bit, "Counter Input"
TxPDO 0x1a01 "TxPDO-Map"
PDO entry 0x2603:01, 32 bit, "SubIndex 001"
PDO entry 0x2603:02, 32 bit, "SubIndex 002"
PDO entry 0x2603:03, 32 bit, "SubIndex 003"
PDO entry 0x2603:04, 32 bit, "SubIndex 004"
PDO entry 0x2603:05, 32 bit, "SubIndex 005"
PDO entry 0x2603:06, 32 bit, "SubIndex 006"
PDO entry 0x2603:07, 32 bit, "SubIndex 007"
PDO entry 0x2603:08, 32 bit, "SubIndex 008"
TxPDO 0x1a02 "TxPDO-Map"
PDO entry 0x3000:01, 16 bit, "SubIndex 001"
PDO entry 0x3001:01, 16 bit, "SubIndex 001"
PDO entry 0x3002:01, 16 bit, "SubIndex 001"
PDO entry 0x3003:01, 16 bit, "SubIndex 001"
PDO entry 0x3004:01, 16 bit, "SubIndex 001"
PDO entry 0x3005:01, 16 bit, "SubIndex 001"
PDO entry 0x3006:01, 16 bit, "SubIndex 001"
PDO entry 0x3007:01, 16 bit, "SubIndex 001"
TxPDO 0x1a03 "TxPDO-Map"
PDO entry 0x3020:01, 16 bit, "SubIndex 001"
PDO entry 0x3021:01, 16 bit, "SubIndex 001"
PDO entry 0x3022:01, 16 bit, "SubIndex 001"
PDO entry 0x3023:01, 16 bit, "SubIndex 001"
PDO entry 0x3024:01, 16 bit, "SubIndex 001"
PDO entry 0x3025:01, 16 bit, "SubIndex 001"
PDO entry 0x3026:01, 16 bit, "SubIndex 001"
PDO entry 0x3027:01, 16 bit, "SubIndex 001"
TxPDO 0x1a04 "TxPDO-Map"
PDO entry 0x2600:02, 16 bit, "
PDO entry 0x2601:01, 16 bit, "SubIndex 001"
PDO entry 0x2601:03, 16 bit, "
PDO entry 0x2601:04, 16 bit, ""
I did find the manual and translate, it's attached here for anyone else who might come across this device.
Here is the pdos output:
Warning: Spoiler!
SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1100, DefaultSize 128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1200, DefaultSize 0, ControlRegister 0x64, Enable 1
RxPDO 0x1600 "RxPDO-Map"
PDO entry 0x2300:00, 16 bit, "Digital Outputs"
PDO entry 0x2310:00, 16 bit, "Analog Output"
PDO entry 0x2311:00, 16 bit, "Analog Output"
PDO entry 0x2320:00, 32 bit, "PWM Freq Output"
PDO entry 0x2321:00, 32 bit, "PWM Freq Output"
PDO entry 0x2330:00, 16 bit, "PWM prop Output"
PDO entry 0x2331:00, 16 bit, "PWM prop Output"
RxPDO 0x1601 "RxPDO-Map"
PDO entry 0x2602:01, 32 bit, "SubIndex 001"
PDO entry 0x2602:02, 32 bit, "SubIndex 002"
PDO entry 0x2602:03, 32 bit, "SubIndex 003"
PDO entry 0x2602:04, 32 bit, "SubIndex 004"
PDO entry 0x2602:05, 32 bit, "SubIndex 005"
PDO entry 0x2602:06, 32 bit, "SubIndex 006"
PDO entry 0x2602:07, 32 bit, "SubIndex 007"
PDO entry 0x2602:08, 32 bit, "SubIndex 008"
RxPDO 0x1602 "RxPDO-Map"
PDO entry 0x2600:01, 16 bit, ""
PDO entry 0x2600:03, 16 bit, ""
PDO entry 0x2600:04, 16 bit, ""
PDO entry 0x2601:02, 16 bit, ""
SM3: PhysAddr 0x1400, DefaultSize 0, ControlRegister 0x20, Enable 1
TxPDO 0x1a00 "TxPDO-Map"
PDO entry 0x2000:00, 16 bit, "Digital Inputs"
PDO entry 0x2010:00, 16 bit, "Analog Input"
PDO entry 0x2011:00, 16 bit, "Analog Input"
PDO entry 0x2020:00, 32 bit, "Encoder Inputs"
PDO entry 0x2030:00, 32 bit, "Counter Input"
PDO entry 0x2031:00, 32 bit, "Counter Input"
TxPDO 0x1a01 "TxPDO-Map"
PDO entry 0x2603:01, 32 bit, "SubIndex 001"
PDO entry 0x2603:02, 32 bit, "SubIndex 002"
PDO entry 0x2603:03, 32 bit, "SubIndex 003"
PDO entry 0x2603:04, 32 bit, "SubIndex 004"
PDO entry 0x2603:05, 32 bit, "SubIndex 005"
PDO entry 0x2603:06, 32 bit, "SubIndex 006"
PDO entry 0x2603:07, 32 bit, "SubIndex 007"
PDO entry 0x2603:08, 32 bit, "SubIndex 008"
TxPDO 0x1a02 "TxPDO-Map"
PDO entry 0x3000:01, 16 bit, "SubIndex 001"
PDO entry 0x3001:01, 16 bit, "SubIndex 001"
PDO entry 0x3002:01, 16 bit, "SubIndex 001"
PDO entry 0x3003:01, 16 bit, "SubIndex 001"
PDO entry 0x3004:01, 16 bit, "SubIndex 001"
PDO entry 0x3005:01, 16 bit, "SubIndex 001"
PDO entry 0x3006:01, 16 bit, "SubIndex 001"
PDO entry 0x3007:01, 16 bit, "SubIndex 001"
TxPDO 0x1a03 "TxPDO-Map"
PDO entry 0x3020:01, 16 bit, "SubIndex 001"
PDO entry 0x3021:01, 16 bit, "SubIndex 001"
PDO entry 0x3022:01, 16 bit, "SubIndex 001"
PDO entry 0x3023:01, 16 bit, "SubIndex 001"
PDO entry 0x3024:01, 16 bit, "SubIndex 001"
PDO entry 0x3025:01, 16 bit, "SubIndex 001"
PDO entry 0x3026:01, 16 bit, "SubIndex 001"
PDO entry 0x3027:01, 16 bit, "SubIndex 001"
TxPDO 0x1a04 "TxPDO-Map"
PDO entry 0x2600:02, 16 bit, "
PDO entry 0x2601:01, 16 bit, "SubIndex 001"
PDO entry 0x2601:03, 16 bit, "
PDO entry 0x2601:04, 16 bit, ""
Please Log in or Create an account to join the conversation.
29 Jun 2024 03:34 #304000
by BHar
Replied by BHar on topic EtherCat - CATIO module Help
So I guess this is what I get from diving into EtherCat without already being super comfortable with LinuxCNC. I had seen it mentioned on the forum that it's a big task to work them both out at once and I have made it more complex by doing it on an RPI.
Seems my issue was while manipulating ethercat-conf.xml I was seeing seemingly good data appear in the lcec pins area of halshow, I was unable to manipulate them due to not having included the following in my Ini file.
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
Seems that it's not a servo thread but an overall thread for all IO (including servos) that these lines are referring to.
So, seems that I can operate all the digital outputs for this controller. I will continue to work on the other IO.
Thanks for the pointers on this everyone.
Seems my issue was while manipulating ethercat-conf.xml I was seeing seemingly good data appear in the lcec pins area of halshow, I was unable to manipulate them due to not having included the following in my Ini file.
addf lcec.read-all servo-thread
addf lcec.write-all servo-thread
Seems that it's not a servo thread but an overall thread for all IO (including servos) that these lines are referring to.
So, seems that I can operate all the digital outputs for this controller. I will continue to work on the other IO.
Thanks for the pointers on this everyone.
Please Log in or Create an account to join the conversation.
29 Jun 2024 04:48 #304002
by pippin88
Replied by pippin88 on topic EtherCat - CATIO module Help
linuxcnc.org/docs/html/hal/basic-hal.html#sub:hal-addf
The addf command adds a function to a real-time thread
Addf
Then the function
Then the thread the function is assigned to
Lcec is linuxcnc ethercat
Linuxcnc has has long-standing terminology of:
Servo thread - thread/loop where position, IO etc are read / updated
Base thread - used for software step generation. Not used in setups with hardware step generation (e.g. Mesa) or ethercat
(Documentation about the real time threads is a bit poor compared to most other linuxcnc docs)
The addf command adds a function to a real-time thread
Addf
Then the function
Then the thread the function is assigned to
Lcec is linuxcnc ethercat
Linuxcnc has has long-standing terminology of:
Servo thread - thread/loop where position, IO etc are read / updated
Base thread - used for software step generation. Not used in setups with hardware step generation (e.g. Mesa) or ethercat
(Documentation about the real time threads is a bit poor compared to most other linuxcnc docs)
Please Log in or Create an account to join the conversation.
Time to create page: 0.095 seconds