Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-07-26 Thread Gavin Lambert
Broadly speaking, there's three different kinds of slave.

The most basic have fixed PDO configuration and assignment.  If these implement 
CoE at all (which is also optional), you can't change any part of the PDO 
layout.

The middle tier (reasonably common in slaves that implement CoE at all) have 
variable PDO assignment but fixed configuration.  This means that you cannot 
change the contents of the PDOs but you can select which of them to include in 
your domain (although not always freely -- many slaves have mutually exclusive 
PDOs or specific ordering/size requirements or other such limitations).

Lastly there are those that do support changing the PDO configuration as well 
as assignment.  These are very rare (typically just things like PLCs and other 
highly programmable slaves).

For the former, you just "ethercat cstruct" and that's the only layout you'll 
ever get.
For the other two, you can do some manipulation before you "ethercat cstruct".  
But that manipulation only happens at "pre-commission" time (when you're 
writing your application) -- it never happens at actual run-live.

The table that is generated by "ethercat cstruct" encapsulates all of the PDO 
configuration and assignment, and when you use this table properly (see the 
examples) you don't have any "manual" writes to the PDO assignment or 
configuration objects at all in your code; that's taken care of by the Etherlab 
master itself.

The ecrt_slave_config_sdo* calls are only for "extra" not-PDO-related 
configuration that your slave may require.


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.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.
-Original Message-
From: Fontana Nicola  
Sent: Monday, 26 July 2021 5:21 pm
To: Gavin Lambert ; Graeme Foot 
; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Configuring EL7047 stepper driver

Il giorno lun, 26/07/2021 alle 04.54 +, Gavin Lambert ha scritto:
> ...
> It's not really something you can do from a bash script.

Hi Gavin,

yes, I learnt it the hard way. That particular device has fixed PDO mappings 
and settings, i.e. all 0x1[468A]? entries are read-only. The only relevant 
parameters I can touch are the PDO assignement registers.
Coming from CANopen I thought anything can be done by just manipulating the 
object dictionary but... well, this is not the case.

Thank you again.
--
Nicola


-- 
Etherlab-users mailing list
Etherlab-users@etherlab.org
https://lists.etherlab.org/mailman/listinfo/etherlab-users


Re: [Etherlab-users] Configuring EL7047 stepper driver

2021-07-26 Thread Gavin Lambert
You can also configure the slave to the desired configuration (either manually 
via "ethercat download" command line or with another master such as TwinCAT) 
before you use "ethercat cstruct" to generate your desired PDO layout (but do 
still read through it to verify that it is as expected).  This may or may not 
be simpler than just modifying the default cstruct tables to your desired 
config, depending on various factors.

After that, as Graeme says, you should write your application code to do the 
necessary configuration assuming that no "ethercat" commands have previously 
been run.  Reboot your slave before testing your app to ensure that it's not 
depending on some previous manual configuration, and read the example code 
(especially the "user" example).

It's not really something you can do from a bash script.


Gavin Lambert
Senior Software Developer TOMRA Fresh Food

 


COMPAC SORTING EQUIPMENT LTD | 4 Henderson Pl | Onehunga | Auckland 1061 | New 
Zealand
Switchboard: +49 2630 96520 | https://www.tomra.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.
-Original Message-
From: Etherlab-users  On Behalf Of Graeme 
Foot
Sent: Monday, 26 July 2021 1:47 pm
To: Fontana Nicola ; etherlab-users@etherlab.org
Subject: Re: [Etherlab-users] Configuring EL7047 stepper driver

Hi Nicola,

The first thing is don't try to configure slaves via the ethercat command line 
utility.  You need to run an application (see the examples folder for various 
example applications).
The second thing is don't try to manually configure each slave by direct SDO 
calls, there are functions that do all of that for you that you call as part of 
the application.

The applications first step is to configure the slaves using for example:
  ecrt_master_get_slave
  ecrt_master_slave_config
  ecrt_slave_config_pdos
  ecrt_slave_config_create_sdo_request
  ecrt_slave_config_reg_pdo_entry
  ecrt_slave_config_sdo8 etc
  ecrt_slave_config_dc

A devices default configuration can be retrieved using the "ethercat cstruct" 
command.  You can then modify it if your slave allows modification.  You can 
download the slaves esi file from Beckhoff if you want to use a non-standard 
configuration, using it as a reference to set up your own cstruct data.

Once ready, the application calls ecrt_master_activate() and then calls the 
following commands (as a minimum) in a realtime loop:
  ecrt_master_receive
  ecrt_domain_process
  ecrt_domain_queue
  ecrt_master_send

The application will bring the slaves up from PREOP to OP, applying the 
configuration along the way.  If a slave is repowered the master will 
automatically re-apply the configuration and bring it back to OP.

Regards,
Graeme

-Original Message-
From: Etherlab-users  On Behalf Of Fontana 
Nicola
Sent: Sunday, 25 July 2021 01:02
To: etherlab-users@etherlab.org
Subject: [Etherlab-users] Configuring EL7047 stepper driver

Hi all,

I think this issue is not related to the ethercat software per-se but maybe 
someone has already met something similar or can point me into the right 
direction.

I'm trying to configure the EL7047 stepper driver in position controller mode 
without encoder (by default it is in velocity mode):


https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.beckhoff.com%2Fen-en%2Fproducts%2Fi-o%2Fethercat-terminals%2Fel7xxx-compact-drive-technology%2Fel7047.htmldata=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=7nrcZ%2BRZV042Qzmhkyow%2B5Dam266ZgyJp7bRKX%2BZe84%3Dreserved=0

No matter what: it stays in PREOP state after having configured it.
Whenever I try to put it in SAFEOP/OP I get:

Failed to set SAFEOP state, slave refused state change (PREOP + ERROR).
AL status message 0x001E: "Invalid input configuration".

Here is the full script I'm using:


https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2F-%2Fsnippets%2F2153453data=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=Amp%2FeLCSJ7gRo6mLXMdACw8az8EbiNrurOTWdO0vcvc%3Dreserved=0

It runs successfully and I am sure the settings are changed (I checked them 
many times). For a couple of parameters, with a datatype smaller than a byte 
but bigger than boolean, I had to explicitely set the datatype to `uint8`, and 
AFAIK this is the only thing that "stinks".

The Beckhoff manual keeps reporting TwinCAT screenshots instead of explaining