- Posts: 153
- Thank you received: 0
HAL EtherCAT: one slave fine, two identical slaves issue
I am facing a puzzling situation trying to use the EtherCAT driver for linuxcnc. I have several identical controller units (which are my EtherCAT slaves) to power some IR lamps. They are controlled thanks wired command (analog and digital coming from some AO and DO EtherCAT cards controlled by linuxcnc). Those power controllers have to be in OP state to be running and deliver a voltage on the output.
When trying to launch linuxcnc with one controller unit only, it loads fine and the slave goes into OP mode. Here is the ethercat-config.xml file used:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="4">
<slave idx="0" type="generic" vid="000001bc" pid="0000e1a2" configPdos="true" name="EPZ1">
<syncManager idx="0" dir="out">
</syncManager>
<syncManager idx="1" dir="in">
</syncManager>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="7001" subIdx="09" bitLen="32" halPin="R2" halType="float"/>
</pdo>
<pdo idx="1601">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap1" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap2" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap3" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap4" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap5" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap6" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap7" halType="bit"/>
</pdo>
<pdo idx="17ff">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap8" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap9" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap10" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap11" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap12" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap13" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap14" halType="bit"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="f390" subIdx="00" bitLen="8" halPin="LatExStat" halType="bit"/>
<pdoEntry idx="f380" subIdx="00" bitLen="8" halPin="ActExSta" halType="bit"/>
<pdoEntry idx="6002" subIdx="01" bitLen="32" halPin="CtrlPV" halType="float"/>
<pdoEntry idx="6002" subIdx="02" bitLen="32" halPin="CtrlMainSP" halType="float"/>
<pdoEntry idx="6000" subIdx="05" bitLen="32" halPin="NetCrt" halType="float"/>
<pdoEntry idx="6000" subIdx="0a" bitLen="32" halPin="NetLdV" halType="float"/>
<pdoEntry idx="f391" subIdx="01" bitLen="32" halPin="WrnDet" halType="bit"/>
<pdoEntry idx="f393" subIdx="01" bitLen="32" halPin="ErrDet" halType="bit"/>
</pdo>
<pdo idx="1a01">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap100" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap101" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap102" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap103" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap104" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap105" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap106" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap107" halType="bit"/>
</pdo>
<pdo idx="1bfe">
<pdoEntry idx="f397" subIdx="01" bitLen="32" halPin="GlbErr" halType="bit"/>
</pdo>
<pdo idx="1bff">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap108" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap109" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap110" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap111" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap112" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap113" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap114" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap115" halType="bit"/>
</pdo>
</syncManager>
</slave>
</master>
</masters>
The file looks fine, only thing is there is a bunch of non defined pdos assignments as I have not done it with TwinCAT yet. However the slave still manage to get to the OP state.
When I daisy chain the second controller unit after the first slave and update the ethercat-con.xml file, at best linuxcnc starts, the first slave goes into OP state, but the second slave does not go into OP state. At worst my whole computer froze. Here is the second ethercat-config.xml, which is just a dupliacte of the firt one where I doubled the slave, just changing its index and its name. When I run TwinCAT from windows on those slaves, they go without any issue into OP state when free run mode is launched.
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="4">
<slave idx="0" type="generic" vid="000001bc" pid="0000e1a2" configPdos="true" name="EPZ1">
<syncManager idx="0" dir="out">
</syncManager>
<syncManager idx="1" dir="in">
</syncManager>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="7001" subIdx="09" bitLen="32" halPin="R2" halType="float"/>
</pdo>
<pdo idx="1601">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap1" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap2" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap3" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap4" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap5" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap6" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap7" halType="bit"/>
</pdo>
<pdo idx="17ff">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap8" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap9" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap10" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap11" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap12" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap13" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap14" halType="bit"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="f390" subIdx="00" bitLen="8" halPin="LatExStat" halType="bit"/>
<pdoEntry idx="f380" subIdx="00" bitLen="8" halPin="ActExSta" halType="bit"/>
<pdoEntry idx="6002" subIdx="01" bitLen="32" halPin="CtrlPV" halType="float"/>
<pdoEntry idx="6002" subIdx="02" bitLen="32" halPin="CtrlMainSP" halType="float"/>
<pdoEntry idx="6000" subIdx="05" bitLen="32" halPin="NetCrt" halType="float"/>
<pdoEntry idx="6000" subIdx="0a" bitLen="32" halPin="NetLdV" halType="float"/>
<pdoEntry idx="f391" subIdx="01" bitLen="32" halPin="WrnDet" halType="bit"/>
<pdoEntry idx="f393" subIdx="01" bitLen="32" halPin="ErrDet" halType="bit"/>
</pdo>
<pdo idx="1a01">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap100" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap101" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap102" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap103" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap104" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap105" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap106" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap107" halType="bit"/>
</pdo>
<pdo idx="1bfe">
<pdoEntry idx="f397" subIdx="01" bitLen="32" halPin="GlbErr" halType="bit"/>
</pdo>
<pdo idx="1bff">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap108" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap109" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap110" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap111" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap112" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap113" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap114" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap115" halType="bit"/>
</pdo>
</syncManager>
</slave>
<slave idx="1" type="generic" vid="000001bc" pid="0000e1a2" configPdos="true" name="EPZ2">
<syncManager idx="0" dir="out">
</syncManager>
<syncManager idx="1" dir="in">
</syncManager>
<syncManager idx="2" dir="out">
<pdo idx="1600">
<pdoEntry idx="7001" subIdx="09" bitLen="32" halPin="R2" halType="float"/>
</pdo>
<pdo idx="1601">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap1" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap2" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap3" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap4" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap5" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap6" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap7" halType="bit"/>
</pdo>
<pdo idx="17ff">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap8" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap9" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap10" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap11" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap12" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap13" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap14" halType="bit"/>
</pdo>
</syncManager>
<syncManager idx="3" dir="in">
<pdo idx="1a00">
<pdoEntry idx="f390" subIdx="00" bitLen="8" halPin="LatExStat" halType="bit"/>
<pdoEntry idx="f380" subIdx="00" bitLen="8" halPin="ActExSta" halType="bit"/>
<pdoEntry idx="6002" subIdx="01" bitLen="32" halPin="CtrlPV" halType="float"/>
<pdoEntry idx="6002" subIdx="02" bitLen="32" halPin="CtrlMainSP" halType="float"/>
<pdoEntry idx="6000" subIdx="05" bitLen="32" halPin="NetCrt" halType="float"/>
<pdoEntry idx="6000" subIdx="0a" bitLen="32" halPin="NetLdV" halType="float"/>
<pdoEntry idx="f391" subIdx="01" bitLen="32" halPin="WrnDet" halType="bit"/>
<pdoEntry idx="f393" subIdx="01" bitLen="32" halPin="ErrDet" halType="bit"/>
</pdo>
<pdo idx="1a01">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap100" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap101" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap102" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap103" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap104" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap105" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap106" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap107" halType="bit"/>
</pdo>
<pdo idx="1bfe">
<pdoEntry idx="f397" subIdx="01" bitLen="32" halPin="GlbErr" halType="bit"/>
</pdo>
<pdo idx="1bff">
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap108" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap109" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap110" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap111" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap112" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap113" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap114" halType="bit"/>
<pdoEntry idx="0000" subIdx="00" bitLen="16" halPin="Gap115" halType="bit"/>
</pdo>
</syncManager>
</slave>
</master>
</masters>
I runned the dmesg to get more information. I attached two files, the SuccessCNCLaunch1Eth.txt which is the first situation when the slave goes into OP mode. The second file is when I try to launch with two slaves where the second one stays in SAFEOP and is shown with an E when I run ethercat slave.
Attachment not found
Attachment not found
So everything works fine with TwinCAT with several slave. Everything runs fine with one slave under linuxcnc ethercat. But it does not work when I have several slave of this type on linuxcnc ethercat.
I am wondering if it could be:
- a timeout issue, as the bus scanning time looks high with those slaves. At this stage I am still not sure how to perfectly use the distributed clock and watchdog command lines instructions. So maybe I should use a distributed clock when there is several of these slaves.
- the fact that the slaves are identical somehow, could possibly be an issue. There are some wheels on the supposed to be adjusted to change the slave index, however any time I am changing it, it usually create more issue than solve it.
If anyone has been experiencing the same kind of situation, any help would be much appreciated.
Nicolas
Please Log in to join the conversation.
I think you have badly configured some of the PDOs, the PDOs of a device also affect the next device if they are not correct, the first thing is to check that all the records are correct, if they are the unmodified generics? The way to act is to disconnect and reconnect the power supply and read the register using the
TWINCAT3 also works, but since you can configure so many options and parameters, it is sometimes a bit difficult if they are a bit complicated devices, a saluation is to read the device once the voltage is restored / restarted to see what it tells us about its PDOs
regards
Chimeno
Please Log in to join the conversation.
thanks for your guidelines, I trippled check the pdos and xml file, they are all matching. The issue seems to be more coming from the DC synchronization option as I got a 0x0030 AL status message in the dmesg. So I am trying to make sense of the DC conf line in the xml file. However, l though I found something which might be of interest. When I run in TwinCAT I am in free run mode. Is there an equivalent option that can be added into the .xml config file for linuxcnc ethercat to get such a free run mode?
I am thinking about this as reading again my slave manual it is indicated that:
."Slave main application must be synchronized on network main (electrical network AC mains) to be able to perform all RMS measurement on a whole half period and manage firing accurately. Therefore it can't be synchronized on any EtherCAT communication cycle and EtherCAT process data exchange is performed in Free run mode"
Thank you,
Nicolas
Please Log in to join the conversation.
Not all devices work in DC-MODE, so that they work in this mode you also have to configure your own PDO, which device does it support? Do you have any manuals?
index 1C32: 01 and 1C33: 01
Current synchronization mode:
• 0: Free Run
• 1: Synchronous with SM 2 event
• 2: DC-Mode - Synchronous with SYNC0 Event
• 3: DC-Mode - Synchronous with SYNC1 event
Please Log in to join the conversation.
Reading from TwinCAT and the documentation, the slave actually only support the Free Run mode as index 1C32: 01 and 1C33:01 are both at 0x00.
When nothing is specified in the ethercat-conf.xml file for a given slave line (no DcConf field), is it running in free run mode?
Also is the watchdog field independent from the free run / DC mode?
Thank you for your help,
Nicolas
Please Log in to join the conversation.
Nico2017 wrote: Hi Chimeno,
Reading from TwinCAT and the documentation, the slave actually only support the Free Run mode as index 1C32: 01 and 1C33:01 are both at 0x00.
When nothing is specified in the ethercat-conf.xml file for a given slave line (no DcConf field), is it running in free run mode?
yes
Also is the watchdog field independent from the free run / DC mode?
I think so, while accessing the PDO record before watchdog time, I will review it anyway.
Thank you for your help,
Nicolas
greeting
Chimeno
Please Log in to join the conversation.
still stuck in the same situation where I cannot make those slaves working when in series. Those are the EPack power controller from Eurotherm.
Attached is:
- the provided xml file from the manufacturer describing the slave and PDOs for TwinCAT:
Attachment not found
- the xml file for the linuxcnc EtherCAT of a single EPack which works and manage to get the EPack in OP state but not sure about the value refClockSyncCycles="4" especially if the slave only operates in free run mode
Attachment not found
- the xml file for the linuxcnc EtherCAT for two daisy chained EPacks which loads but does not get any of the EPacks into OP mode, rather in SAFEOP with an E displayed in ethercat slave command. This also sometime crashes my OS when closing linuxcnc after having a configuration running them
Attachment not found
- my postgui file to load the ethercat from the .ini file:
Code:loadusr -W lcec_conf ethercat-confEPack2.xml loadrt lcec addf lcec.read-all servo-thread addf lcec.write-all servo-thread
servo thread is 1000000ns
The master idx difference is not the issue as I have tried on both of my master, having two Ethernet port on my computer.
Any help to find out what could be possibly the issue in the .xml, as it is probably the case, would be really appreciated.
Thanks a lot,
Nicolas
Please Log in to join the conversation.
Hi Nico2017Nico2017 wrote: Hi all,
but not sure about the value refClockSyncCycles="4" especially if the slave only operates in free run mode[/li]
this means refClockSyncCycles = "4" every time the ethercat frame cycle is restarted, it only matters in DC mode, it has to be synchronized with the SYNC0 and SYNC1 cycles, because number 4 ??
which loads but does not get any of the EPacks into OP mode, rather in SAFEOP with an E displayed in ethercat slave command. This also sometime crashes my OS when closing linuxcnc after having a configuration running them
I still believe that you have a problem in the configuration on one of the devices or in the PDOs, for example, this is a bit weird:
I hope you can solve it soon
regards
Chimeno
Please Log in to join the conversation.
please find attached the TwinCAT project with the default pdos between two EPacks.
Attachment not found
What would be the different options for refClockSyncCycles="4"? Can it be removed if all slave are in free run mode?
Thank you again for your help,
Nicolas
Please Log in to join the conversation.
I have tried my final configuration with the Epacks on one master (master 1) and the other slaves on the other one (master 0) as I think there might be a conflict about the synchronisation mode between the different slaves.
The behaviour is kind of random:
- it manages to launch the program one time out of three without issue, the other times it either freeze the OS or I have to restart the computer
- when closing linuxcnc when it was sucessfully launcer, it stays blocked and does not close properly.
I wonder if it is a realtime ethercat related issue which make the OS or linuxcnc not closing properly. Or maybe the fact that I am using two masters.
Attached is a log file after starting with success and after non proper closing:
Attachment not found
The config file that I am currently running is:
Attachment not found
If anyone has an idea about why I have kind of an unstable behaviour with this EherCAT bus topology, that would be really helpful.
Thank you again,
Nicolas
Please Log in to join the conversation.
