Hi,
my philosophy for using EtherCAT devices such as servo drives is to do as much as possible with the software deliverd with the drives. So all settings,parameters, etc. that should and could be done only once are outside of HAL or LinuxCNC.
That means for my case (use of IndraDrive) that also the PDO assignment is only done once via Beckhoff-Software. The HAL-Driver therfore only needs to know about the addresses of the syncmanager registers and the assigned PDOs and didnot need to assign them again (CoE isn't supported by IndraDrives so the assignment won't work with the EtherCAT HAL driver).
Therefore the 'generic' EtherCAT HAL driver works best and should do for all EtherCAT devices.
To get a little more generic I have added an additional hal-type in the XML file which configures the EtherCAT HAL-Driver.
So as an example a part of the file can look like
Code:
<master idx="0" appTimePeriod="1000000" refClockSyncCycles="1000">
<slave idx="0" type="generic" vid="00000024" pid="00242804" configPdos="true">
<syncManager idx="0" dir="out">
</syncManager>
<syncManager idx="1" dir="in">
</syncManager>
<syncManager idx="2" dir="out">
<pdo idx="0018">
<pdoEntry idx="0086" subIdx="00" bitLen="16" halPin="drivecontrol" halType="bit"/>
<pdoEntry idx="002f" subIdx="00" bitLen="32" halPin="poscommand" halType="special32" scale="10000"/>
<pdoEntry idx="0025" subIdx="00" bitLen="32" halPin="speedaddcommand" halType="special32" scale="60000"/>
...
...
<dcConf assignActivate="500" sync0Cycle="*1" sync0Shift="250000"/>
<watchdog divider="2498" intervals="1000"/>
</slave>
</master>
Therein you can see the
halType="special32" and a
scale="10000". This leads to a hal-pin with data type float and calculate scaling.
So the interface in the *.hal files to the EtherCAT are simple and straight forward because the values are deliverd e.g. in mm or mm/min.
@sascha:
I've put the modified code to a
github repos
which is forked from yours. Perhaps this is the same idea that you have and you can check the functionality with some other devices.
And yes alittle tool to rearrange 'original' XML files to the one needed for EtherCAT HAL driver would be nice. I think this could be directly implemented in the lcec_conf.c
Regards Andreas