[etherlab-users] Problem with Beckhoff EL1502
Hammer, Günter
Guenter.Hammer at ids.de
Fri Dec 5 16:43:45 CET 2008
Hello,
I have some problems to handle a counter module which is a Beckhoff EL1502.
I use the Ecat-Master 1.4.0 rc3 and the mini-example.
My init-fct:
{
..
if (!(sc_cntr_in = ecrt_master_slave_config( EcKAppMainInfo.master, 0, 1, 0x0000012AD, 0x05DE3052))) {
printk(PFX "Failed to get slave configuration.\n");
goto out_release_master;
}
printk(PFX "Configuring Pdos...\n");
if ((sc_cntr_in, EC_END, cCI70A_syncs)) {
printk(PFX "Failed to configure Pdos.\n");
goto out_release_master;
}
printk(PFX "Creating Sdo requests...\n");
if (!(sdo = ecrt_slave_config_create_sdo_request(sc_cntr_in, 0x6020, 17, 4))) {
printk(PFX "Failed to create Sdo request.\n");
goto out_release_master;
}
if ( ecrt_domain_reg_pdo_entry_list( pConDomain->pDomain, pConDomain->pEcMasterRegisterDomain ) )
{
printk( PFX "-> PDO registration failed!\n");
goto out_release_master;
}
..
}
In my cyclic task i call the read_sdo() function
void read_sdo(void)
{
static unsigned long int u32CiOld = 0, u32CiNew = 0;
switch (ecrt_sdo_request_state(sdo)) {
case EC_SDO_REQUEST_UNUSED: // request was not used yet
ecrt_sdo_request_read(sdo); // trigger first read
break;
case EC_SDO_REQUEST_BUSY:
printk(PFX "Still busy...\n");
break;
case EC_SDO_REQUEST_SUCCESS:
printk(PFX "Sdo value: 0x%04X\n", EC_READ_U16(ecrt_sdo_request_data(sdo)));
ecrt_sdo_request_read(sdo); // trigger next read
break;
case EC_SDO_REQUEST_ERROR:
printk(PFX "Failed to read Sdo!\n");
ecrt_sdo_request_read(sdo); // retry reading
break;
}
}
static ec_pdo_entry_info_t cCI70A_pdo_entries[] = {
{0x6020, 1, 1}, // output function enabled
{0x6020, 2, 1}, // status of output
{0x6020, 3, 1}, // set counter done
{0x6020, 4, 1}, // counter inhibited
{0x6020, 5, 1}, // status of input UD
{0x6020, 6, 1}, // status of input clock
{0x6020, 17, 32} // counter value
};
static ec_pdo_info_t cCI70A_pdos[] = {
{0x1A02, 7, cCI70A_pdo_entries}
};
static ec_sync_info_t cCI70A_syncs[] = {
{3, EC_DIR_INPUT, 1, cCI70A_pdos},
{0xff}
};
Here is the output of the ethercat commandline tool:
# ethercat pdos -v
== Slave 0 ===
=== Slave 1 ===
SM0: PhysAddr 0x1000, DefaultSize 128, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1080, DefaultSize 128, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1100, DefaultSize 6, ControlRegister 0x24, Enable 1
RxPdo 0x1602 ""
Pdo entry 0x7020:01, 1 bit, ""
Pdo entry 0x7020:02, 1 bit, ""
Pdo entry 0x7020:03, 1 bit, ""
Pdo entry 0x7020:04, 1 bit, ""
Pdo entry 0x0000:00, 12 bit, "Gap"
Pdo entry 0x7020:11, 32 bit, ""
SM3: PhysAddr 0x1180, DefaultSize 6, ControlRegister 0x20, Enable 1
TxPdo 0x1a02 ""
Pdo entry 0x6020:01, 1 bit, ""
Pdo entry 0x6020:02, 1 bit, ""
Pdo entry 0x6020:03, 1 bit, ""
Pdo entry 0x6020:04, 1 bit, ""
Pdo entry 0x6020:05, 1 bit, ""
Pdo entry 0x6020:06, 1 bit, ""
Pdo entry 0x0000:00, 7 bit, "Gap"
Pdo entry 0x1c32:20, 1 bit, ""
Pdo entry 0x0000:00, 1 bit, "Gap"
Pdo entry 0x1802:09, 1 bit, ""
Pdo entry 0x6020:11, 32 bit, ""
# ethercat sdos
=== Slave 0 ===
=== Slave 1 ===
With this init and cyclic code i get the output:
...
<4>[ 350.782193] EtherCAT WARNING: Slave 1 does not support changing the Pdo mapping!
<4>[ 350.782300] EtherCAT WARNING: Failed to configure mapping of Pdo 0x1A02.
<3>[ 350.790109] EtherCAT ERROR: Failed to set SAFEOP state, slave 1 refused state change (PREOP + ERROR).
<3>[ 350.795344] EtherCAT ERROR: AL status message 0x001E: "Invalid input configuration".
<6>[ 350.799103] EtherCAT: Acknowledged state PREOP on slave 1.
<4>[ 802.162085] EcKApp: Sdo value: 0xFFFFFFFD
<4>[ 802.222065] EcKApp: Sdo value: 0xFFFFFFF8
<4>[ 802.234065] EcKApp: Sdo value: 0xFFFFFFF4
<4>[ 802.486065] EcKApp: Sdo value: 0xFFFFFFF1
You can see some errors and warnings, but i get the counter values from the module.
I think this module doesnt support a pdo configuration.
But if i delete the ecrt_slave_config_pdos() call in my init-fct i dont get the errors and warnings,
but i also do not get the counter values.
Is there any additional initialization that i have to do, or what is wrong with my init ?
Best regards
Guenter Hammer
More information about the Etherlab-users
mailing list