[Etherlab-users] Patch for --enable-regalias
Graeme Foot
Graeme.Foot at touchcut.com
Tue Dec 13 22:18:54 CET 2022
Hi Gavin,
I've added some comments to your email below.
In summary though:
> I could perhaps understand a patch to instead only read register 0x0012 if
> the ESI alias is zero (and trust the ESI alias otherwise), to perhaps allow
> changing the alias without rebooting.
Actually this is exactly what the patch is doing.
Thanks,
Graeme.
From: Gavin Lambert <gavin.lambert at tomra.com>
Sent: Tuesday, 13 December 2022 14:34
To: Graeme Foot <Graeme.Foot at touchcut.com>; etherlab-users at etherlab.org
Subject: RE: Patch for --enable-regalias
> I'm not sure this makes sense.
>
> Register 0x0012 is typically used for slave identification for slaves that
> have hardware switches of some kind to specify the desired alias. In almost
> all cases, these will have an SII alias of zero; as such it would be
> counterproductive to skip reading them in that case. It is usually required
> to reboot the slave to change its id switch. (See "Explicit Device
> Identification" in ETG1020 for more info.)
Yes, if you have a slave that requires reading register 0x0012 then the SII
alias value will be zero. This patch will read 0x0012 if the SII alias is zero, but
if it is non-zero it will continue on to reading the 0x0012 register. Also if the
SII alias is non-zero then it should match the 0x0012 value, so reading 0x0012
is not required and can be skipped.
> In the absence of devices that use such a hardware id selector, you should
> avoid using the -enable-regalias configuration option for improved scan
> performance.
Agreed. Unfortunately we now have a slave that requires it. This patch
Is only improving -enable-regalias, should it be enabled.
This patch will also improve scan performance of -enable-regalias by
skipping reading register 0x0012 if the slave has an non-zero SII slave alias.
Also if you do not use slave aliases in your system then you are unlikely to
Require -enable-regalias for this type of slave anyway.
> For master-based changing of the alias (e.g. via the "ethercat alias"
> command), rebooting the slave is still required and (unless the slave
> implementation has chosen otherwise) will also be reflected in register
> 0x0012, so this will work regardless of whether -enable-regalias is enabled
> or not.
The "ethercat alias" command works by writing the first 8 words into the
slaves SII. It then also updates its in memory slave->effective_alias value.
The updated SII with the new alias is available for reading immediately and
does not require the slave to be rebooted. (However you are correct that
it does need to be rebooted/reset for the 0x0012 register to be updated.)
Once the master has identified a slave by its alias it is assigned a station
address and all further EtherCAT commands then use that station address
(avoiding commands that use alias addressing).
So if you assign a slaves alias using the "ethercat alias" command (which
you would not use on slaves with dials/dipswitches) then this patch allows
the master to be rebooted without the slave needing to be rebooted
(which can easily occur if you have remote IO that is powered separately).
> I could perhaps understand a patch to instead only read register 0x0012 if
> the ESI alias is zero (and trust the ESI alias otherwise), to perhaps allow
> changing the alias without rebooting.
Actually this is exactly what the patch is doing.
> However the documentation is fairly clear that the reboot is not optional.
> Etherlab does bypass some of this requirement by only using the station
> address (not the alias) on the wire, thus making it appear as if the device
> is answering to an alias change without a reboot, but it's best not to rely
> on this sort of implementation detail.
Avoiding the need to repower a slave after setting its alias helps with machine
commissioning as setting slave aliases is usually one of multiple steps. If you
reboot the master at a later stage (without rebooting the slaves) it looks like
the slaves have mysteriously lost their aliases. This patch avoids that.
Yes, the entire system should be repowered and proved after setting aliases
but that can happen once all of the configuration is complete.
> (A slave may also choose to implement CoE object 0x10E0, which allows updating
> 0x0012 without a reboot, but this is not mandatory.)
Good to know, but it is not implemented by the slave we are using.
> Gavin Lambert
>
> Senior Software Developer TOMRA Fresh Food
[cid:image001.png at 01D90F9C.33EE9990]
[cid:image002.jpg at 01D90F9C.33EE9990]
[tomra facebook] <https://www.facebook.com/TOMRA.Food/> [tomra linkedin] <https://www.linkedin.com/company/tomra-food/> [tomra twitter] <https://twitter.com/TOMRAFood> [tomra youtube] <https://www.youtube.com/playlist?list=PLDD3B1A7BAE919EC6> [tomra instragram] <https://www.instagram.com/tomrafood/>
Compac Technologies Ltd | 4 Henderson Place | PO Box 13 516 | Onehunga 1061 | New Zealand
Phone: +64 96 34 00 88 | https://www.compacsort.com
The information contained in this communication and any attachment is confidential and may be legally privileged. It should only be read by the person(s) to whom it is addressed. If you have received this communication in error, please notify the sender and delete the communication.
From: Graeme Foot
Sent: Tuesday, 13 December 2022 14:05
To: etherlab-users at etherlab.org<mailto:etherlab-users at etherlab.org>
Subject: [Etherlab-users] Patch for --enable-regalias
Hi,
I have attached a patch for the --enable-regalias option.
--enable-regalias enables reading slave aliases from register 0x0012. When enabled all slaves read 0x0012, replacing any alias value read from the SII. However, if you set a new alias on a slave (with the "ethercat alias" function) the 0x0012 register is not updated (and is readonly to the master so can't be). This requires the slave to be repowered/restarted for the register to update. So if you restart the master without repowering/restarting the slave, the master will read the old alias from the 0x0012 register.
The patch will now only read register 0x0012 if the SII alias is non-zero. This slightly shortens the slave scan for most slaves (that have aliases) and allows the master to use the correct alias on restart. However, if you are resetting the alias (setting it to zero) the slave will still require a repower/reset.
Note you shouldn't be setting aliases via the "ethercat alias" function on slaves with dials/dipswitches, or slaves that only support 0x0012 (and not SII aliases), so we can ignore any issues these slaves could have.
The patch is based on mercurial revision 2679 (33b922ec1871) and the gavinl patchset 20171108.
Regards,
Graeme Foot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6455 bytes
Desc: image001.png
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 58287 bytes
Desc: image002.jpg
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0006.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.jpg
Type: image/jpeg
Size: 10123 bytes
Desc: image003.jpg
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0007.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image004.jpg
Type: image/jpeg
Size: 10214 bytes
Desc: image004.jpg
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0008.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image005.jpg
Type: image/jpeg
Size: 10254 bytes
Desc: image005.jpg
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0009.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image006.jpg
Type: image/jpeg
Size: 10218 bytes
Desc: image006.jpg
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0010.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image007.jpg
Type: image/jpeg
Size: 10303 bytes
Desc: image007.jpg
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0011.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Only-read-alias-from-0x0012-reg-if-SII-alias-is-zero.patch
Type: application/octet-stream
Size: 2658 bytes
Desc: 0001-Only-read-alias-from-0x0012-reg-if-SII-alias-is-zero.patch
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20221213/29554eb9/attachment-0001.obj>
More information about the Etherlab-users
mailing list