Hello Eugen,

Don't map this, it's not a pdo:

 {0x0000, 0x00, 6}, /* Gap */

Different ways to do it, just make sure your changes are properly reflected in your slave_0_pdos This should work with slave_0_pdo_entries as you have it by skipping item #3:

ec_pdo_info_t slave_0_pdos[] = {
{0x1600, 2, slave_0_pdo_entries + 0}, /* RxPDO Map */
         ^ take 2                 ^ from 0
{0x1aff, 2, slave_0_pdo_entries + 3}, /* Status PDO */
         ^ take 2                 ^ from 3
}

Regards,
Matthieu

On 10/15/12 12:36, Eugen Viszus wrote:
Hi all,

I'm trying to communicate with bus coupler module Lenze EPM-S130 which
containts one module EPM−S300(2 digital ouputs). I'm using EtherCAT
Master in version 1.5.1. The code of program is based on the "mini.c"
example. In the code I change the slave configuration according my
module. After the insertion ec_mini.ko (insmod ec_mini.ko) the program
doesn't work. In the kernel message buffer I can see that there is
problem with changing state from PREOP to SAFEOP due to "Invalid input
configuration".

I was trying the same program with Beckhoff EL2004 module(4DO) and it
worked perfect.

On the end of this mail I attach the slave informations('ethercat slaves
-a 1 -v'), PDO entries ('ethercat pdos -a 1'), configuration code which
was generated by 'ethercat cstruct -a 1', configuration part of the code
and kernel message buffer.

Does anyone any problem witch Lenze modules configuration? I appreciate
any hints. Thank you for your help.

Best regards,
Eugen Viszus
-----------------------------------------------------------
'ethercat slaves -a 1 -v'

=== Master 0, Slave 0 ===
Alias: 1
State: PREOP
Flag: +
Identity:
Vendor Id: 0x0000003b
Product code: 0x00000514
Revision number: 0x00000011
Serial number: 0x00000000
DL information:
FMMU bit operation: no
Distributed clocks: yes, 64 bit
DC system time transmission delay: 0 ns
Port Type Link Loop Signal NextSlave RxTime [ns] Diff [ns] NextDc [ns]
0 MII up open yes - 1373391132 0 0
1 MII down closed no - - - -
2 N/A down closed no - - - -
3 N/A down closed no - - - -
Mailboxes:
Bootstrap RX: 0x1200/532, TX: 0x1500/532
Standard RX: 0x1c00/512, TX: 0x1e00/512
Supported protocols: CoE, FoE
General:
Group: Coupler
Image name:
Order number: Lenze EPM-S130
Device name: Lenze EPM-S130 EtherCAT Buskoppler (MDP)
CoE details:
Enable SDO: yes
Enable SDO Info: yes
Enable PDO Assign: no
Enable PDO Configuration: no
Enable Upload at startup: yes
Enable SDO complete access: yes
Flags:
Enable SafeOp: no
Enable notLRW: no
Current consumption: 0 mA

-----------------------------------------------------------
'ethercat pdos -a 1'

SM0: PhysAddr 0x1c00, DefaultSize 512, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x1e00, DefaultSize 512, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1000, DefaultSize 0, ControlRegister 0x24, Enable 0
RxPDO 0x1600 "RxPDO Map"
PDO entry 0x7000:01, 1 bit, "Output "
PDO entry 0x7000:02, 1 bit, "Output "
PDO entry 0x0000:00, 6 bit, "Gap"
SM3: PhysAddr 0x1600, DefaultSize 0, ControlRegister 0x00, Enable 0
TxPDO 0x1aff "Status PDO"
PDO entry 0xf100:01, 32 bit, "Hardware Interrupt Counter "
PDO entry 0xf100:02, 32 bit, "Diagnostic Interrupt Counter "

-----------------------------------------------------------
'ethercat cstruct -a 1'

/* Master 0, Slave 0, "Lenze EPM-S130"
* Vendor ID: 0x0000003b
* Product code: 0x00000514
* Revision number: 0x00000011
*/

ec_pdo_entry_info_t slave_0_pdo_entries[] = {
{0x7000, 0x01, 1}, /* Output */
{0x7000, 0x02, 1}, /* Output */
{0x0000, 0x00, 6}, /* Gap */
{0xf100, 0x01, 32}, /* Hardware Interrupt Counter */
{0xf100, 0x02, 32}, /* Diagnostic Interrupt Counter */
};

ec_pdo_info_t slave_0_pdos[] = {
{0x1600, 3, slave_0_pdo_entries + 0}, /* RxPDO Map */
{0x1aff, 2, slave_0_pdo_entries + 3}, /* Status PDO */
};

ec_sync_info_t slave_0_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 1, slave_0_pdos + 0, EC_WD_DISABLE},
{3, EC_DIR_INPUT, 1, slave_0_pdos + 1, EC_WD_DISABLE},
{0xff}
};
-----------------------------------------------------------
the configuration part of my code

// process data
static uint8_t *domain1_pd; // process data memory


#define DigOutSlavePos 1, 0

#define Lenze_EPMS130 0x0000003B, 0x00000514


// offsets for PDO entries
static unsigned int off_dig_out;

const static ec_pdo_entry_reg_t domain1_regs[] = {
{DigOutSlavePos, Lenze_EPMS130, 0x7000,0x01, &off_dig_out},
{}
};

static unsigned int counter = 0;
static unsigned int blink = 0;


#if CONFIGURE_PDOS

// Digital out ------------------------

/* Master 0, Slave 0, "Lenze EPM-S130"
* Vendor ID: 0x0000003b
* Product code: 0x00000514
* Revision number: 0x00000011
*/

ec_pdo_entry_info_t s130_channels[] = {
{0x7000, 0x01, 1}, /* Output */
{0x7000, 0x02, 1}, /* Output */
{0x0000, 0x00, 6}, /* Gap */
{0xf100, 0x01, 32}, /* Hardware Interrupt Counter */
{0xf100, 0x02, 32}, /* Diagnostic Interrupt Counter */
};

ec_pdo_info_t s130_pdos[] = {
{0x1600, 3, s130_channels + 0}, /* RxPDO Map */
{0x1aff, 2, s130_channels + 3}, /* Status PDO */
};

ec_sync_info_t s130_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 1, s130_pdos + 0, EC_WD_DISABLE},
{3, EC_DIR_INPUT, 1, s130_pdos + 1, EC_WD_DISABLE},
{0xff}
};

#endif
-----------------------------------------------------------
kernel message buffer

[13787.239527] ec_mini: Starting...
[13787.239533] EtherCAT: Requesting master 0...
[13787.239535] EtherCAT DEBUG 0: IDLE -> OPERATION.
[13787.239538] EtherCAT: Successfully requested master 0.
[13787.239542] EtherCAT DEBUG 0: ecrt_master_callbacks(master =
0xffff88003c27d000, send_cb = 0xffffffffa0095040, receive_cb =
0xffffffffa0095000, cb_data = 0xffff88003c27d000)
[13787.239546] ec_mini: Registering domain...
[13787.239549] EtherCAT DEBUG 0: ecrt_master_create_domain(master =
0xffff88003c27d000)
[13787.239552] EtherCAT DEBUG 0: Created domain 0.
[13787.239555] EtherCAT DEBUG 0: ecrt_master_slave_config(master =
0xffff88003c27d000, alias = 1, position = 0, vendor_id = 0x0000003b,
product_code = 0x00000514)
[13787.239559] EtherCAT DEBUG 0: Creating slave configuration for 1:0,
0x0000003B/0x00000514.
[13787.239564] EtherCAT DEBUG 0 1:0: Attached slave 0.
[13787.239575] EtherCAT DEBUG 0 1:0: ecrt_slave_config_pdos(sc =
0xffff880039647000, n_syncs = 4294967295, syncs = 0xffffffffa0095880)
[13787.239579] EtherCAT DEBUG 0 1:0: ecrt_slave_config_sync_manager(sc =
0xffff880039647000, sync_index = 0, dir = 1, watchdog_mode = 2)
[13787.239583] EtherCAT DEBUG 0 1:0: ecrt_slave_config_sync_manager(sc =
0xffff880039647000, sync_index = 1, dir = 2, watchdog_mode = 2)
[13787.239588] EtherCAT DEBUG 0 1:0: ecrt_slave_config_sync_manager(sc =
0xffff880039647000, sync_index = 2, dir = 1, watchdog_mode = 2)
[13787.239592] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_assign_clear(sc = 0xffff880039647000, sync_index = 2)
[13787.239597] EtherCAT DEBUG 0 1:0: ecrt_slave_config_pdo_assign_add(sc
= 0xffff880039647000, sync_index = 2, pdo_index = 0x1600)
[13787.239601] EtherCAT DEBUG 0 1:0: Loading default mapping for PDO
0x1600.
[13787.239604] EtherCAT DEBUG 0 1:0: Found PDO name "RxPDO Map".
[13787.239607] EtherCAT DEBUG 0 1:0: Entry 0x7000:01.
[13787.239609] EtherCAT DEBUG 0 1:0: Entry 0x7000:02.
[13787.239611] EtherCAT DEBUG 0 1:0: Entry 0x0000:00.
[13787.239614] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_clear(sc = 0xffff880039647000, pdo_index =
0x1600)
[13787.239619] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_add(sc = 0xffff880039647000, pdo_index =
0x1600, entry_index = 0x7000, entry_subindex = 0x01, entry_bit_length = 1)
[13787.239625] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_add(sc = 0xffff880039647000, pdo_index =
0x1600, entry_index = 0x7000, entry_subindex = 0x02, entry_bit_length = 1)
[13787.239630] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_add(sc = 0xffff880039647000, pdo_index =
0x1600, entry_index = 0x0000, entry_subindex = 0x00, entry_bit_length = 6)
[13787.239635] EtherCAT DEBUG 0 1:0: ecrt_slave_config_sync_manager(sc =
0xffff880039647000, sync_index = 3, dir = 2, watchdog_mode = 2)
[13787.239639] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_assign_clear(sc = 0xffff880039647000, sync_index = 3)
[13787.239644] EtherCAT DEBUG 0 1:0: ecrt_slave_config_pdo_assign_add(sc
= 0xffff880039647000, sync_index = 3, pdo_index = 0x1AFF)
[13787.239648] EtherCAT DEBUG 0 1:0: Loading default mapping for PDO
0x1AFF.
[13787.239650] EtherCAT DEBUG 0 1:0: Found PDO name "Status PDO".
[13787.239653] EtherCAT DEBUG 0 1:0: Entry 0xF100:01.
[13787.239656] EtherCAT DEBUG 0 1:0: Entry 0xF100:02.
[13787.239658] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_clear(sc = 0xffff880039647000, pdo_index =
0x1AFF)
[13787.239663] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_add(sc = 0xffff880039647000, pdo_index =
0x1AFF, entry_index = 0xF100, entry_subindex = 0x01, entry_bit_length = 32)
[13787.239668] EtherCAT DEBUG 0 1:0:
ecrt_slave_config_pdo_mapping_add(sc = 0xffff880039647000, pdo_index =
0x1AFF, entry_index = 0xF100, entry_subindex = 0x02, entry_bit_length = 32)
[13787.239673] ec_mini: Registering PDO entries...
[13787.239675] EtherCAT DEBUG 0: ecrt_domain_reg_pdo_entry_list(domain =
0xffff880032b9f240, regs = 0xffffffffa0095400)
[13787.239679] EtherCAT DEBUG 0: ecrt_master_slave_config(master =
0xffff88003c27d000, alias = 1, position = 0, vendor_id = 0x0000003b,
product_code = 0x00000514)
[13787.239684] EtherCAT DEBUG 0 1:0: ecrt_slave_config_reg_pdo_entry(sc
= 0xffff880039647000, index = 0x7000, subindex = 0x01, domain =
0xffff880032b9f240, bit_position = 0x (null))
[13787.239690] EtherCAT DEBUG 0: Domain 0: Added 1 bytes, total 1.
[13787.239693] EtherCAT DEBUG 0: ecrt_domain_external_memory(domain =
0xffff880032b9f240, mem = 0xffff88000f11c520)
[13787.239696] ec_mini: Activating master...
[13787.239698] EtherCAT DEBUG 0: ecrt_master_activate(master =
0xffff88003c27d000)
[13787.239703] EtherCAT 0: Domain0: Logical address 0x00000000, 1 byte,
expected working counter 1.
[13787.239706] EtherCAT 0: Datagram domain0-0: Logical offset
0x00000000, 1 byte, type LWR.
[13787.239709] EtherCAT DEBUG 0: Stopping master thread.
[13787.239714] EtherCAT DEBUG 0: Master IDLE thread exiting...
[13787.239739] EtherCAT 0: Master thread exited.
[13787.239741] EtherCAT DEBUG 0: FSM datagram is ffff88003c27d648.
[13787.239743] EtherCAT 0: Starting EtherCAT-OP thread.
[13787.239789] ec_mini: Starting cyclic sample thread.
[13787.239791] ec_mini: Started.
[13787.243169] EtherCAT DEBUG 0: Operation thread running with fsm
interval = 1000 us, max data size=11250
[13787.243175] EtherCAT WARNING 0: 1 datagram UNMATCHED!
[13787.249023] ec_mini: 1 slave(s).
[13787.249026] ec_mini: AL states: 0x02.
[13787.249028] ec_mini: Link is up.
[13787.249037] EtherCAT DEBUG 0: Configuration changed (aborting state
check).
[13787.249040] EtherCAT DEBUG 0: Writing system time offsets...
[13787.249042] EtherCAT WARNING 0: No app_time received up to now, but
master already active.
[13787.249045] EtherCAT DEBUG 0: Requesting OP...
[13787.289031] EtherCAT DEBUG 0-0: Changing state from PREOP to OP.
[13787.289036] EtherCAT DEBUG 0-0: Configuring...
[13787.329025] EtherCAT DEBUG 0-0: Now in INIT.
[13787.329029] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
[13787.349021] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
[13787.369026] EtherCAT DEBUG 0-0: Clearing DC assignment...
[13787.389024] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
[13787.389030] EtherCAT DEBUG 0-0: SM0: Addr 0x1C00, Size 512, Ctrl
0x26, En 1
[13787.389033] EtherCAT DEBUG 0-0: SM1: Addr 0x1E00, Size 512, Ctrl
0x22, En 1
[13787.449029] EtherCAT DEBUG 0-0: Now in PREOP.
[13787.449050] EtherCAT DEBUG 0-0: SM2: Addr 0x1000, Size 1, Ctrl 0x24,
En 1
[13787.449053] EtherCAT DEBUG 0-0: SM3: Addr 0x1600, Size 8, Ctrl 0x00,
En 0
[13787.469026] EtherCAT DEBUG 0 1:0: FMMU: LogAddr 0x00000000, Size 1,
PhysAddr 0x1000, SM2, Dir out
[13787.499019] EtherCAT 0: Domain 0: Working counter changed to 1/1.
[13787.499023] ec_mini: Domain1: WC 1.
[13787.499025] ec_mini: Domain1: State 2.
[13787.529023] EtherCAT ERROR 0-0: Failed to set SAFEOP state, slave
refused state change (PREOP + ERROR).
[13787.549024] EtherCAT ERROR 0-0: AL status message 0x001E: "Invalid
input configuration".
[13787.589025] EtherCAT 0-0: Acknowledged state PREOP.


_______________________________________________
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users



--
Matthieu Bec                GMTO Corp.
cell:  +1 626 354 9367      P.O. Box 90933
phone: +1 626 204 0527      Pasadena, CA 91109-0933

_______________________________________________
etherlab-users mailing list
etherlab-users@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users

Reply via email to