[Etherlab-users] User mode "Register" access methods

Richard Hacker ha at igh.de
Fri Apr 24 11:10:28 CEST 2026


English is the language of choice on this mailing list for everyone to
read ;)

And yes, I work for IgH.

Uff, you are using a pooly documented feature where AL Control bit 6
(0x120.5) is used to request an id from the slave, with the slave
responding in AL Status bit 6 (0x130.5) and putting some value in AL
Status Code (0x134). This is very crooked in my opinion.

This feature is currently not supported by our master, although it is
not impossible to implement such an `id_request` feature.

The reason: AL Control (0x120) is entirely under master control. You
cannot meddle with this register from behind the scenes to manipulate
bit 6. Hence your observation that it function is "time critical". You
had to be fast so the master does not screw your work ;)

The standard way of implementing this "ID" feature would be either to
set this value in 0x012 (Configured station alias) or better, put it in
a PDO -- then it supports on-the-fly DIP switch changes, which, in
fact, it really is. You could also implement it with a read-only SDO,
but SDO's are typically master to slave communication channel, used to
configure a slave once-off before entering OP.


On Fri, 2026-04-24 at 08:17 +0000, Moebius, Volker wrote:
> Hi Richard,
> 
> Many thanks for getting back to my problem! I appreciate this very
> much.
> 
> Are you based at IGH in Essen? If you speak German as your native
> language like me, then we could also continue in German. But sticking
> with English is also fine with me!
> 
> Our EtherCAT slave (Digital I/O board) is using the Beckhoff ET1100
> to implement the ESC slave functionality and is controlled by a micro
> controller.
> 
> The currently implemented sequence to read the DIP switch settings is
> in pseudo code:
> 
> WriteByte(0x120, ReadByte(0x120) | 0x20)
> BoardID := ReadByte(0x134)
> 
> or more C-like:
> 
>  *((uint8_t*)0x120) |= 0x20;
> uint8_ t board_id = *((uint8_t*)0x134;
> 
> As mentioned earlier, the read and write operations are implemented
> by `EC_IOCTL_SLAVE_REG_READ` and `EC_IOCTL_SLAVE_REG_WRITE`.
> 
> During a former implementation of a production test framework for
> these boards, I got the impression that the above sequence of
> manipulating the 0x120 register and reading the 0x134 register is
> time critical. If this sequence is executed too slowly then the
> result is not reliable. That worries me of course.
> 
> Because you reinforce my assumption that it is a strange non-standard
> solution, I think that I will contact the developers of the current
> implementation of the reading of the ID at ESC master side as well as
> the firmware developer of the ESC slave and try to clarify with them
> why it is as it is. I'm starting to suspect that the current
> implementation of the reading of the ID via the EtherCAT slave
> registers could be an originally temporary solution because the
> microcontroller firmware for the board wasn't ready yet while the
> development started.
> 
> Best regards
> Volker
> 
> 
> > -----Original Message-----
> > From: Richard Hacker <ha at igh.de>
> > Sent: Thursday, April 23, 2026 5:53 PM
> > To: Moebius, Volker <Volker.Moebius at baader.com>
> > Subject: Re: [Etherlab-users] User mode "Register" access methods
> > 
> > That is quite strange non-standard slave behaviour. Are you using
> > an FPGA or
> > similar IP Core ESC implementation?
> > 
> > Most registers are under complete control of the master and ESC
> > chip.
> > The slave application has very limited communication via ESC
> > registers (except
> > for application layer registers 0x120-0x13f).
> > 
> > There is also a special register 0x012/16 that is used to configure
> > a station alias.
> > 
> > What register address do you want to read?
> > 
> > Normally a slave application communicates via SDO and PDO to the
> > client
> > application.
> > 
> > An yes, the `ecrt_reg_*()` family of funtions are only usable after
> > master
> > activation... read that in the docs.
> > 
> > - Richard
> > 
> > On Thu, 2026-04-23 at 14:18 +0000, Moebius, Volker wrote:
> > > Hi Richard,
> > > 
> > > > I have never needed `ec_reg*()`, so I have no experience in
> > > > using
> > > > them.
> > > > 
> > > > Why are you after these functions? They are only used for
> > > > debugging
> > > > during development and for that purpose you have the `ethercat
> > > > reg_*` commands.
> > > 
> > > I took over the maintenance of a project with our own EtherCAT
> > > slave
> > > devices. These EtherCAT slaves unfortunately are using DIP
> > > switches to
> > > assign "IDs" to them instead of just using their position in the
> > > EtherCAT chain.
> > > 
> > > These IDs i.e., the actual DIP switch settings are only readable
> > > by
> > > "register accesses". That's by the design of the EtherCAT slaves.
> > > At
> > > least that's the information which I got.
> > > 
> > > The original implementation of the reading of these DIP switches
> > > comes
> > > from a consulting company. They took the internal
> > > EC_IOCTL_SLAVE_REG_READ and EC_IOCTL_SLAVE_REG_WRITE codes from
> > your
> > > ethercat library file master/ioctl.h, re-implemented the "reg_*"
> > > methods from the CLI tool and are reading the DIP switches by a
> > > sequence of these register reads and writes. (Meanwhile I have
> > > only
> > > limited access to the original hard- and software developers of
> > > this
> > > EtherCAT slave device.)
> > > 
> > > I like the streamline the direct access of the header
> > > master/ioctl.h
> > > by a clean application of the public headers of the library and
> > > therefore I'm looking for an official method to read and write
> > > these
> > > registers.
> > > 
> > > Best regards
> > > Volker
> > > 
> > > > 
> > > > 
> > > > On Wed, 2026-04-22 at 17:03 +0000, Moebius, Volker wrote:
> > > > > Hi Richard,
> > > > > 
> > > > > thank you for your quick response!
> > > > > 
> > > > > The functions `ecrt_reg_request_read` and
> > > > > `ecrt_reg_request_write`
> > > > > are documented as
> > > > > 
> > > > > _This method is meant to be called in realtime context (after
> > > > > master activation)_
> > > > > 
> > > > > Don't they work before the master isn't activated? The
> > > > > `reg_*`
> > > > > methods of the CLI seem to work independently from the master
> > > > > activation!?
> > > > > 
> > > > > > -----Original Message-----
> > > > > > From: Richard Hacker <ha at igh.de>
> > > > > > Sent: Wednesday, April 22, 2026 4:31 PM
> > > > > > To: Moebius, Volker <Volker.Moebius at baader.com>; etherlab-
> > > > > > users at etherlab.org
> > > > > > Subject: Re: [Etherlab-users] User mode "Register" access
> > > > > > methods
> > > > > > 
> > > > > > The 'ecrt_reg_*' family of functions in the C-API mirror
> > > > > > the
> > > > > > 'reg_*'
> > > > > > functions of the CLI tool.
> > > > > > 
> > > > > > The ESC registers are reserved for the master. As an
> > > > > > EtherCAT
> > > > > > user, you do not need to touch them.
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > On Wed, 2026-04-22 at 14:16 +0000, Moebius, Volker wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > Hello everyone,
> > > > > > > 
> > > > > > > The `ethercat` CLI tool implements the "Register Access"
> > > > > > > functions
> > > > > > > `reg_read` and `reg_write`. These functions are using
> > > > > > > EC_IOCTL_SLAVE_REG_READ and EC_IOCTL_SLAVE_REG_WRITE to
> > > > execute
> > > > > > these
> > > > > > > methods. (lines 433ff of tool/MasterDevice.cpp)
> > > > > > > 
> > > > > > > Is there a reason why possibly corresponding methods for
> > > > > > > "Register Read" and "Register Write" aren't implemented
> > > > > > > in the
> > > > > > > "normal"
> > > > > > > user
> > > > > > > mode C API (include/ecrt.h)? Don't these methods make
> > > > > > > sense
> > > > > > > for controlling EtherCAT slaves?
> > > > > > > 
> > > > > > > I'm unfortunately not an EtherCAT expert and I'm confused
> > > > > > > about the different data objects and communication
> > > > > > > objects.
> > > > > > > Are the functions `ecrt_slave_config_create_reg_request`,
> > > > > > > `ecrt_reg_request_data`, `ecrt_reg_request_state`,
> > > > > > > `ecrt_reg_request_write` and `ecrt_reg_request_read`
> > > > > > > related
> > > > > > > to the same "Register Access"
> > > > > > > ("Slave
> > > > > > > Registers") as implemented by the CLI? Or do they manage
> > > > > > > a
> > > > > > > different kind of registers?
> > > > > > > 
> > > > > > > .
> > > > > > 
> > > > > > --
> > > > > > Mit freundlichem Gruß / Best regards, Richard Hacker
> > > > > > --
> > > > > > -----------------------------------------------------------
> > > > > > ----
> > > > > > ----
> > > > > > ----
> > > > > > Richard Hacker, M.Sc.
> > > > > > Entwicklungsingenieur / Development Engineer ha at igh.de
> > > > > > 
> > > > > > Tel.: +49 201 / 36014-16
> > > > > > 
> > > > > > Ingenieurgemeinschaft IgH Gesellschaft für
> > > > > > Ingenieurleistungen
> > > > > > mbH Nordsternstraße 66
> > > > > > D-45329 Essen
> > > > > > 
> > > > > > https://ig/
> > > > > > 
> > > > 
> > h.de%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7
> > > > C9
> > > > > > 
> > > > 
> > 32d419ee9474932c6ba08dea14035c5%7C0353fbdd75b9475da865fc06cdfddda8
> > > > %7
> > > > > > 
> > > > 
> > C0%7C0%7C639125494341372652%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0e
> > > > U1hcGki
> > > > > > 
> > > > OnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIld
> > > > UIjo
> > > > y
> > > > > > 
> > > > 
> > fQ%3D%3D%7C0%7C%7C%7C&sdata=nYQZisOS2CYWx2FefkcwfKSGDVsbw7Gup
> > > > rPyPN5T
> > > > > > ZGU%3D&reserved=0
> > > > > > 
> > > > 
> > &data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7C8024e9
> > > > > > 
> > > > 
> > 9f807441f90e4808dea07bd8a7%7C0353fbdd75b9475da865fc06cdfddda8%7C0%
> > > > > > 
> > > > 
> > 7C0%7C639124650938547509%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hc
> > > > > > 
> > > > 
> > GkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldU
> > > > > > Ijo
> > > > > > 
> > > > 
> > yfQ%3D%3D%7C0%7C%7C%7C&sdata=ulASp%2Bw81KA%2F9S76e6%2BKi8vScF
> > > > > > 2H1xQp85zbVYj3vD0%3D&reserved=0 | https://et/
> > > > > > 
> > > > 
> > herlab.o%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.co
> > > > m
> > > > > > 
> > > > 
> > %7C932d419ee9474932c6ba08dea14035c5%7C0353fbdd75b9475da865fc06cdf
> > > > ddd
> > > > > > 
> > > > 
> > a8%7C0%7C0%7C639125494341399571%7CUnknown%7CTWFpbGZsb3d8eyJFb
> > > > XB0eU1h
> > > > > > 
> > > > cGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCI
> > > > sIld
> > > > U
> > > > > > 
> > > > 
> > IjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=xapxpshL%2F5HstSk6q3ZVROqBMJYV
> > > > Dyc0eb
> > > > > > bO0dLEKRw%3D&reserved=0
> > > > > > 
> > > > 
> > rg%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7C8
> > > > > > 
> > > > 
> > 024e99f807441f90e4808dea07bd8a7%7C0353fbdd75b9475da865fc06cdfddda8
> > > > > > 
> > > > 
> > %7C0%7C0%7C639124650938584993%7CUnknown%7CTWFpbGZsb3d8eyJFbXB
> > > > > > 
> > > > 
> > 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbC
> > > > > > I
> > > > > > 
> > > > 
> > sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=dbTXor0LKM7c2AUTTR3mIeyXOc
> > > > > > lu3yxRxxTKO8a8uOU%3D&reserved=0
> > > > > > 
> > > > > > Amtsgericht Essen HRB 11500 | USt-Id.-Nr.: DE 174 626 722
> > > > > > Geschäftsführung:
> > > > > > Frederik Becker, Dr.-Ing. Siegfried Rotthäuser, Jost
> > > > > > Braukmann
> > > > > > -----------------------------------------------------------
> > > > > > ----
> > > > > > ----
> > > > > > ----
> > > > > 
> > > > > .
> > > > 
> > > > --
> > > > Mit freundlichem Gruß / Best regards, Richard Hacker
> > > > --
> > > > ---------------------------------------------------------------
> > > > ----
> > > > ----
> > > > Richard Hacker, M.Sc.
> > > > Entwicklungsingenieur / Development Engineer ha at igh.de
> > > > 
> > > > Tel.: +49 201 / 36014-16
> > > > 
> > > > Ingenieurgemeinschaft IgH Gesellschaft für Ingenieurleistungen
> > > > mbH
> > > > Nordsternstraße 66
> > > > D-45329 Essen
> > > > 
> > > > https://ig/
> > > > 
> > h.de%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7
> > C2
> > > > 
> > 5a42b05a5904027914208dea1506eed%7C0353fbdd75b9475da865fc06cdfddda8
> > %7
> > > > 
> > C0%7C0%7C639125564019226514%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0e
> > U1hcGki
> > > > 
> > OnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjo
> > y
> > > > 
> > fQ%3D%3D%7C0%7C%7C%7C&sdata=U6bv1NO6kwNz3Y2s7bNwWCgjc5kWPt9
> > NKGnGo4O7
> > > > C34%3D&reserved=0
> > > > 
> > &data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7C932d41
> > > > 
> > 9ee9474932c6ba08dea14035c5%7C0353fbdd75b9475da865fc06cdfddda8%7C0
> > > > 
> > %7C0%7C639125494341414626%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1h
> > > > cGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCI
> > > > sIld
> > > > UIj
> > > > 
> > oyfQ%3D%3D%7C0%7C%7C%7C&sdata=59gQA6kiAl7qPp1dizWtJhdxk5CmC2kqH
> > > > t56plzSMkE%3D&reserved=0 |
> > > > https://et/
> > > > 
> > herlab.o%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.co
> > m
> > > > 
> > %7C25a42b05a5904027914208dea1506eed%7C0353fbdd75b9475da865fc06cdf
> > ddd
> > > > 
> > a8%7C0%7C0%7C639125564019251800%7CUnknown%7CTWFpbGZsb3d8eyJFb
> > XB0eU1h
> > > > 
> > cGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIld
> > U
> > > > 
> > IjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=e%2BLUdu20iIlYImCL9cGMGbtcVutmn
> > lKE0n
> > > > rU%2BODZkgA%3D&reserved=0
> > > > 
> > rg%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7C9
> > > > 
> > 32d419ee9474932c6ba08dea14035c5%7C0353fbdd75b9475da865fc06cdfddda8
> > > > 
> > %7C0%7C0%7C639125494341429115%7CUnknown%7CTWFpbGZsb3d8eyJFbXB
> > > > 
> > 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbC
> > > > I
> > > > 
> > sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=wSyDYo7IlKA8Szf8l7n4cXRnRxB1
> > > > 1t3OxeSaQAooSKc%3D&reserved=0
> > > > 
> > > > Amtsgericht Essen HRB 11500 | USt-Id.-Nr.: DE 174 626 722
> > > > Geschäftsführung:
> > > > Frederik Becker, Dr.-Ing. Siegfried Rotthäuser, Jost Braukmann
> > > > ---------------------------------------------------------------
> > > > ----
> > > > ----
> > > 
> > > .
> > 
> > --
> > Mit freundlichem Gruß / Best regards,
> > Richard Hacker
> > --
> > -------------------------------------------------------------------
> > ----
> > Richard Hacker, M.Sc.
> > Entwicklungsingenieur / Development Engineer ha at igh.de
> > 
> > Tel.: +49 201 / 36014-16
> > 
> > Ingenieurgemeinschaft IgH Gesellschaft für Ingenieurleistungen mbH
> > Nordsternstraße 66
> > D-45329 Essen
> > 
> > https://igh.de/
> > &data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7C25a42b
> > 05a5904027914208dea1506eed%7C0353fbdd75b9475da865fc06cdfddda8%7C0
> > %7C0%7C639125564019267435%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1h
> > cGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIld
> > UIj
> > oyfQ%3D%3D%7C0%7C%7C%7C&sdata=NLEnR18t19bjjw6kOOyLs%2BAIbf2wyd
> > qb%2BdtqhZAXOX0%3D&reserved=0 |
> > https://etherlab.o/
> > rg%2F&data=05%7C02%7CMoebiusv%40nmlbaader.mail.onmicrosoft.com%7C2
> > 5a42b05a5904027914208dea1506eed%7C0353fbdd75b9475da865fc06cdfddda8
> > %7C0%7C0%7C639125564019282297%7CUnknown%7CTWFpbGZsb3d8eyJFbXB
> > 0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbC
> > I
> > sIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=qiS3Tbw%2BJRKHOfKAxc50ff5Ma
> > W4PKwdwWMsnpk%2Fy0ss%3D&reserved=0
> > 
> > Amtsgericht Essen HRB 11500 | USt-Id.-Nr.: DE 174 626 722
> > Geschäftsführung:
> > Frederik Becker, Dr.-Ing. Siegfried Rotthäuser, Jost Braukmann
> > -------------------------------------------------------------------
> > ----
> 
> .

-- 
Mit freundlichem Gruß / Best regards,
Richard Hacker
--  
-----------------------------------------------------------------------
Richard Hacker, M.Sc.
Entwicklungsingenieur / Development Engineer
ha at igh.de

Tel.: +49 201 / 36014-16

Ingenieurgemeinschaft IgH Gesellschaft für Ingenieurleistungen mbH
Nordsternstraße 66
D-45329 Essen

https://igh.de | https://etherlab.org

Amtsgericht Essen HRB 11500 | USt-Id.-Nr.: DE 174 626 722
Geschäftsführung:
Frederik Becker, Dr.-Ing. Siegfried Rotthäuser, Jost Braukmann
-----------------------------------------------------------------------


More information about the Etherlab-users mailing list