EtherCat - CATIO module Help

More
19 Jun 2024 03:41 - 19 Jun 2024 03:49 #303320 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'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?
 
[/code]
Last edit: 19 Jun 2024 03:49 by BHar. Reason: Formatting fixes

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

More
19 Jun 2024 04:07 #303323 by paul_chx
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.

More
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

File Attachment:

File Name: ethercat-c...mple.xml
File Size:2 KB


HI
Attachments:
Last edit: 19 Jun 2024 05:58 by jjdege.

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

More
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.

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

More
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!

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

More
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.


 

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

More
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
The following user(s) said Thank You: DPFlex, BHar

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

More
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:

Warning: Spoiler!
Attachments:

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

More
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.

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

More
29 Jun 2024 04:48 #304002 by pippin88
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)

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

Time to create page: 0.102 seconds
Powered by Kunena Forum