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 <etherlab-users-boun...@etherlab.org> On Behalf Of Graeme Foot Sent: Monday, 26 July 2021 1:47 pm To: Fontana Nicola <n...@entidi.it>; 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 <etherlab-users-boun...@etherlab.org> 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.html&data=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=7nrcZ%2BRZV042Qzmhkyow%2B5Dam266ZgyJp7bRKX%2BZe84%3D&reserved=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%2F2153453&data=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Amp%2FeLCSJ7gRo6mLXMdACw8az8EbiNrurOTWdO0vcvc%3D&reserved=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 how things work but (1) I do not have access to TwinCAT and (2) I have less than zero interest in depending on a software blob. Not sure it is relevant, but here is the output of `ethercat sl`: 0 0:0 PREOP + EK1100 EtherCAT-Koppler (2A E-Bus) 1 0:1 PREOP + EL1809 16K. Dig. Eingang 24V, 3ms 2 0:2 PREOP + EL1809 16K. Dig. Eingang 24V, 3ms 3 0:3 PREOP + EL1809 16K. Dig. Eingang 24V, 3ms 4 0:4 PREOP + EL2809 16K. Dig. Ausgang 24V, 0.5A 5 0:5 PREOP + EL2808 8Ch. Dig. Output 24V, 0.5A 6 0:6 PREOP + EL7047 1K. Schrittmotor-Endstufe (50V, 5A) Ciao. -- Nicola -- Etherlab-users mailing list Etherlab-users@etherlab.org https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-users&data=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3fwh8RKO4bNaBhLuWHGll6HBY5P9q3%2F1rMhz5ekwSHM%3D&reserved=0 -- Etherlab-users mailing list Etherlab-users@etherlab.org https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.etherlab.org%2Fmailman%2Flistinfo%2Fetherlab-users&data=04%7C01%7Cgavin.lambert%40tomra.com%7C16a57fd89b504bb5809808d94fd745eb%7C4308d118edd143008a37cfeba8ad5898%7C0%7C1%7C637628608287133729%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3fwh8RKO4bNaBhLuWHGll6HBY5P9q3%2F1rMhz5ekwSHM%3D&reserved=0 -- Etherlab-users mailing list Etherlab-users@etherlab.org https://lists.etherlab.org/mailman/listinfo/etherlab-users