OK so I tried  to configure the pdos in the c++ application and now I get the 
cstruct output that I want, but still i faile to get the slave into OP state:

Failed to set SAFEOP state, slave refused state change (PREOP + ERROR)

Any obvious reason why?

Here is what I did:

ec_pdo_entry_info_t slave_mts_pdo_entries[] = {
              {0x3101, 0x01, 16}, /* Status 1 */
              {0x3101, 0x02, 32}, /* Position 1 */
              {0x3101, 0x03, 32}, /* Velocity 1 */
          };

          ec_pdo_info_t slave_mts_pdos[] = {
              {0x1a00, 3, slave_mts_pdo_entries + 0}, /* TxPDO 1 Mapping */
          };

          ec_sync_info_t slave_mts_syncs[] = {
              {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
              {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
              {2, EC_DIR_OUTPUT, 0, NULL, EC_WD_ENABLE},
              {3, EC_DIR_INPUT, 1, slave_mts_pdos + 0, EC_WD_DISABLE},
              {0xff}
          };

                  
        if (ecrt_slave_config_pdos(slave_config_ptr_, EC_END, slave_mts_syncs))
        {
             LOG_EVENT("Failed to configure PDOs!");
             throw "Failed to configure PDOs.\n";
        }

and now I actually get:

ethercat -m0 -p2 cstruct
/* Master 0, Slave 2, "MTS Temposonics V"
 * Vendor ID:       0x00000040
 * Product code:    0x0000000f
 * Revision number: 0x00000029
 */

ec_pdo_entry_info_t slave_2_pdo_entries[] = {
    {0x3101, 0x01, 16},
    {0x3101, 0x02, 32},
    {0x3101, 0x03, 32},
};

ec_pdo_info_t slave_2_pdos[] = {
    {0x1a00, 3, slave_2_pdo_entries + 0}, /* Magnet 1 */
};

ec_sync_info_t slave_2_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 0, NULL, EC_WD_ENABLE},
    {3, EC_DIR_INPUT, 1, slave_2_pdos + 0, EC_WD_DISABLE},
    {0xff}
};


But I cannot get the slave into OP

ethercat slaves
Master0
  0  1402:0  OP     +  ifm IO-Link Master AL1332
  1  1401:0  OP     +  S300/S400/S600/S700 EtherCAT Drive (CoE)
  2  1403:0  PREOP  E  MTS Device V
  3  1444:0  PREOP  +  ifm IO-Link Master AL1332

The log shows:

Sep 26 11:53:48 ctrlPC5 kernel: [260030.113683] EtherCAT 0: Slave states on 
main device: PREOP, OP.
Sep 26 11:53:49 ctrlPC5 kernel: [260030.871858] EtherCAT ERROR 0-2: SDO upload 
0x1A00:01 aborted.
Sep 26 11:53:49 ctrlPC5 kernel: [260030.871861] EtherCAT ERROR 0-2: SDO abort 
message 0x08000021: "Data cannot be transferred or stored to the application 
because of local control".
Sep 26 11:53:49 ctrlPC5 kernel: [260030.871862] EtherCAT ERROR 0-2: Failed to 
read mapped PDO entry.
Sep 26 11:53:49 ctrlPC5 kernel: [260030.871863] EtherCAT WARNING 0-2: Failed to 
read PDO entries for PDO 0x1A00.
Sep 26 11:53:49 ctrlPC5 kernel: [260030.871863] EtherCAT WARNING 0-2: Slave 
does not support changing the PDO mapping!
Sep 26 11:53:49 ctrlPC5 kernel: [260030.871864] EtherCAT WARNING 0-2:
Sep 26 11:53:49 ctrlPC5 kernel: [260031.046853] EtherCAT ERROR 0-2: Failed to 
set SAFEOP state, slave refused state change (PREOP + ERROR).
Sep 26 11:53:49 ctrlPC5 kernel: [260031.051856] EtherCAT ERROR 0-2: AL status 
message 0x001E: "Invalid input configuration".



Joachim



________________________________
Från: Andreas Stewering-Bone
Skickat: Måndag, 26 september 2022 10:49
Till: Joachim Sällvin; Etherlab-users@etherlab.org
Ämne: Re: Sv: [Etherlab-users] Failing to configure PDOs of a MTS Temposonics V 
slave

Dear Joachim,

No, that is not what I meant.

Take a simple Beckhoff terminal like EL1004
Do a
ethercat -m0 -p2 cstruct

on it.
You will see some PDos and PDo-Entries.

The cstruct output of the MTS sensor is empty.
You will have to fill it with PDos and PDo-Entries in your C++ application.
After this the master can configure the PDos on the slave automatically.
So no need to configure it via sdo call.

Best regards

Andreas

Am Montag, dem 26.09.2022 um 08:35 +0000 schrieb Joachim Sällvin:
Hi Andreas,

Thank you for your reply.

I've tried to configure from the c++ application (is this what you meant?) 
using:

          ecrt_slave_config_sdo8( slave_config, 0x1C13, 0, 0 ); // clear sm pdo 
0x1c13
          ecrt_slave_config_sdo8( slave_config, 0x1A00, 0, 0 ); // clear TxPdo 
0x1A00
          // Define TxPdo
          ecrt_slave_config_sdo32( slave_config, 0x1A00, 1, 0x31010010 );  // 
Status
          ecrt_slave_config_sdo32( slave_config, 0x1A00, 2, 0x31010020 );  // 
Pos
          ecrt_slave_config_sdo32( slave_config, 0x1A00, 3, 0x31010020 );  // 
Velocity
          ecrt_slave_config_sdo8( slave_config, 0x1A00, 0, 3 );            // 
Number of PDO entries for 0x1A00
          ecrt_slave_config_sdo16( slave_config, 0x1C13, 1, 0x1A00 );      // 
TxPdo in 0x1C13:1
          ecrt_slave_config_sdo8( slave_config, 0x1C13, 0, 1 );            // 
Number of TxPDO

But I get this in the log:

Sep 26 10:10:06 ctrlPC5 kernel: [253808.144369] EtherCAT ERROR 0-2: SDO 
download 0x1A00:00 (1 bytes) aborted.
Sep 26 10:10:06 ctrlPC5 kernel: [253808.144372] EtherCAT ERROR 0-2: SDO abort 
message 0x06010002: "Attempt to write a read-only object".
Sep 26 10:10:06 ctrlPC5 kernel: [253808.144373] EtherCAT ERROR 0-2: SDO 
configuration failed.


Is there something that needs to be enabled in order to configure?

The device seems to be configured for one magnet:
ethercat -m0 -p2 upload 0x2000 0x0b  replies with 0x01 1


Best regards,

Joachim






________________________________
Från: Andreas Stewering-Bone
Skickat: Måndag, 26 september 2022 08:30
Till: Joachim Sällvin; etherlab-users@etherlab.org
Ämne: Re: [Etherlab-users] Failing to configure PDOs of a MTS Temposonics V 
slave

Dear Joachim,

The master configures the specific  slaves during application startup.
So no need to do it manually.

The PDO mapping for this slave is dynamically,
because you can configure the number of measurment magnets.
Please read the sensor EtherCAT documentation and the XML slave description.
With this information you can extend the cstruct to configure the specific PDO 
mapping.
Please see the user space example in the master git repo.

Best regards

Andreas

Am Sonntag, dem 25.09.2022 um 17:08 +0000 schrieb Joachim Sällvin:
Hi all,

Any ideas on how to configure the pdos of a MTS Temposonics slave? A brand new 
linear position sensor that doesn't seem to have any default configuration. 
Shouldn't it be possible to configure it from the command line?
When I try I get:

SDO transfer aborted with code 0x08000000: General error (see details below), 
why?


Some information about the system
ethercat slaves
Master0
  0  1402:0  PREOP  +  ifm IO-Link Master AL1332
  1  1401:0  PREOP  +  S300/S400/S600/S700 EtherCAT Drive (CoE)
  2  1403:0  PREOP  +  MTS Device V
  3  1444:0  PREOP  +  ifm IO-Link Master AL1332

ethercat -m0 -p2 cstruct
/* Master 0, Slave 2, "MTS Temposonics V"
 * Vendor ID:       0x00000040
 * Product code:    0x0000000f
 * Revision number: 0x00000029
 */

ec_sync_info_t slave_2_syncs[] = {
    {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
    {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {2, EC_DIR_OUTPUT, 0, NULL, EC_WD_ENABLE},
    {3, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
    {0xff}
};


ethercat -m0 -p2 pdos
SM0: PhysAddr 0x1000, DefaultSize  128, ControlRegister 0x36, Enable 1
SM1: PhysAddr 0x1080, DefaultSize  128, ControlRegister 0x32, Enable 1
SM2: PhysAddr 0x1100, DefaultSize    0, ControlRegister 0x74, Enable 1
SM3: PhysAddr 0x1400, DefaultSize  448, ControlRegister 0x30, Enable 1

ethercat -m0 -p2 sdos
.....
SDO 0x1a00, "Magnet 1"
  0x1a00:00, r-r-r-, uint8, 8 bit, "Number of elements"
  0x1a00:01, rwrwrw, uint16, 16 bit, "Status"
  0x1a00:02, rwrwrw, uint32, 32 bit, "Position"
  0x1a00:03, rwrwrw, uint32, 32 bit, "Velocity"
  0x1a00:04, rwrwrw, uint32, 32 bit, "Acceleration"
......
SDO 0x1c13, "Sync Manager TxPDO Assign"
  0x1c13:00, rwrwrw, uint8, 8 bit, "Number of elements"
  0x1c13:01, rwrwrw, uint16, 16 bit, ""
  0x1c13:02, rwrwrw, uint16, 16 bit, ""
  0x1c13:03, rwrwrw, uint16, 16 bit, ""


I thought I could do like this
sudo ethercat -m0 -p2 download 0x1C13 0 -tuint8 0        # Clear SM PDO 0x1c13
sudo ethercat -m0 -p2 download 0x1A00 0 -tuint8 0               # Clear TxPDO 
0x1A00
ethercat -m0 -p2 download 0x1A00 2 -tuint32 0x31010020
SDO transfer aborted with code 0x08000000: General error

dmesg
 Failed to process SDO request.
 EtherCAT ERROR 0-2: SDO download 0x1A00:02 (4 bytes) aborted.
 EtherCAT ERROR 0-2: SDO abort message 0x08000000: "General error".
 EtherCAT ERROR 0-2: Failed to process SDO request.


Thanks,

Joachim Sällvin

Joachim Sällvin




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

Reply via email to