Dear Graeme, Thanks for your several times suggestions. I do start try my yaskawa servo out by modificaton of example/mini.c as attached. I create two domains by refer to http://lists.etherlab.org/pipermail/etherlab-users/2012/001737.html <http://lists.etherlab.org/pipermail/etherlab-users/2012/001737.html> .
[ 4543.012637] ec_mini: module verification failed: signature and/or required key missing - tainting kernel [ 4543.013087] ec_mini: Starting... [ 4543.013095] EtherCAT: Requesting master 0... [ 4543.013100] EtherCAT DEBUG 0: IDLE -> OPERATION. [ 4543.013104] EtherCAT: Successfully requested master 0. [ 4543.013109] EtherCAT DEBUG 0: ecrt_master_callbacks(master = 0xe195e000, send_cb = 0xf8122030, receive_cb = 0xf8122000, cb_data = 0xe195e000) [ 4543.013112] ec_mini: Registering domain... [ 4543.013115] EtherCAT DEBUG 0: ecrt_master_create_domain(master = 0xe195e000) [ 4543.013119] EtherCAT DEBUG 0: Created domain 0. [ 4543.013121] EtherCAT DEBUG 0: ecrt_master_create_domain(master = 0xe195e000) [ 4543.013124] EtherCAT DEBUG 0: Created domain 1. [ 4543.013128] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013131] EtherCAT DEBUG 0: Creating slave configuration for 0:1, 0x00000539/0x02200001. [ 4543.013136] EtherCAT DEBUG 0 0:1: Failed to find slave for configuration. [ 4543.013139] ec_mini: Configuring PDOs... [ 4543.013143] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdos(sc = 0xc838fc00, n_syncs = 4294967295, syncs = 0xf8124000) [ 4543.013147] EtherCAT DEBUG 0 0:1: ecrt_slave_config_sync_manager(sc = 0xc838fc00, sync_index = 0, dir = 1, watchdog_mode = 2) [ 4543.013151] EtherCAT DEBUG 0 0:1: ecrt_slave_config_sync_manager(sc = 0xc838fc00, sync_index = 1, dir = 2, watchdog_mode = 2) [ 4543.013154] EtherCAT DEBUG 0 0:1: ecrt_slave_config_sync_manager(sc = 0xc838fc00, sync_index = 2, dir = 1, watchdog_mode = 1) [ 4543.013157] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_clear(sc = 0xc838fc00, sync_index = 2) [ 4543.013161] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_add(sc = 0xc838fc00, sync_index = 2, pdo_index = 0x1600) [ 4543.013166] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_clear(sc = 0xc838fc00, pdo_index = 0x1600) [ 4543.013170] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x6040, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013175] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x607A, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013180] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x60B1, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013184] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x6072, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013189] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x60FE, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013193] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x60B8, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013197] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1600, entry_index = 0x6060, entry_subindex = 0x00, entry_bit_length = 8) [ 4543.013201] EtherCAT DEBUG 0 0:1: ecrt_slave_config_sync_manager(sc = 0xc838fc00, sync_index = 3, dir = 2, watchdog_mode = 2) [ 4543.013205] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_clear(sc = 0xc838fc00, sync_index = 3) [ 4543.013208] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_add(sc = 0xc838fc00, sync_index = 3, pdo_index = 0x1A00) [ 4543.013212] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_clear(sc = 0xc838fc00, pdo_index = 0x1A00) [ 4543.013216] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x6041, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013220] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x6064, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013226] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x606C, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013230] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x6077, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013235] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x60F4, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013239] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x60FD, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013243] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x60BA, entry_subindex = 0x00, entry_bit_length = 32) [ 4543.013247] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A00, entry_index = 0x60B9, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013251] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_add(sc = 0xc838fc00, sync_index = 3, pdo_index = 0x1A01) [ 4543.013255] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_clear(sc = 0xc838fc00, pdo_index = 0x1A01) [ 4543.013259] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A01, entry_index = 0x6061, entry_subindex = 0x00, entry_bit_length = 8) [ 4543.013263] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xc838fc00, pdo_index = 0x1A01, entry_index = 0x603F, entry_subindex = 0x00, entry_bit_length = 16) [ 4543.013266] ec_mini: Registering PDO entries... [ 4543.013269] EtherCAT DEBUG 0: ecrt_domain_reg_pdo_entry_list(domain = 0xef0a2bc0, regs = 0xf8123160) [ 4543.013273] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013277] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6040, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013282] EtherCAT DEBUG 0: Domain 0: Added 19 bytes, total 19. [ 4543.013285] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013289] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x607A, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013293] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013297] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60B1, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013300] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013304] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6072, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013308] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013312] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60FE, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013315] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013319] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60B8, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013323] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013327] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6060, subindex = 0x00, domain = 0xef0a2bc0, bit_position = 0x (null)) [ 4543.013330] EtherCAT DEBUG 0: ecrt_domain_reg_pdo_entry_list(domain = 0xef0a25c0, regs = 0xf8123040) [ 4543.013333] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013337] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6041, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013340] EtherCAT DEBUG 0: Domain 1: Added 29 bytes, total 29. [ 4543.013343] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013348] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6064, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013351] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013355] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x606C, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013359] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013362] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6077, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013366] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013370] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60F4, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013373] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013377] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60FD, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013381] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013385] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60BA, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013388] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013392] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x60B9, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013396] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013400] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x6061, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013403] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xe195e000, alias = 0, position = 1, vendor_id = 0x00000539, product_code = 0x02200001) [ 4543.013407] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xc838fc00, index = 0x603F, subindex = 0x00, domain = 0xef0a25c0, bit_position = 0x (null)) [ 4543.013411] EtherCAT DEBUG 0: ecrt_domain_external_memory(domain = 0xef0a2bc0, mem = 0xefdce880) [ 4543.013414] EtherCAT DEBUG 0: ecrt_domain_external_memory(domain = 0xef0a25c0, mem = 0xefdceb00) [ 4543.013417] ec_mini: Activating master... [ 4543.013419] EtherCAT DEBUG 0: ecrt_master_activate(master = 0xe195e000) [ 4543.013425] EtherCAT DEBUG 0: Adding datagram pair with expected WC 1. [ 4543.013429] EtherCAT 0: Domain0: Logical address 0x00000000, 19 byte, expected working counter 1. [ 4543.013432] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 19 byte, type LWR. [ 4543.013436] EtherCAT DEBUG 0: Adding datagram pair with expected WC 1. [ 4543.013439] EtherCAT 0: Domain1: Logical address 0x00000013, 29 byte, expected working counter 1. [ 4543.013442] EtherCAT 0: Datagram domain1-19-main: Logical offset 0x00000013, 29 byte, type LRD. [ 4543.013445] EtherCAT DEBUG 0: Stopping master thread. [ 4543.013499] EtherCAT DEBUG 0: Master IDLE thread exiting... [ 4543.013569] EtherCAT 0: Master thread exited. [ 4543.013575] EtherCAT DEBUG 0: FSM datagram is e195e420. [ 4543.013579] EtherCAT 0: Starting EtherCAT-OP thread. [ 4543.020995] ec_mini: Starting cyclic sample thread. [ 4543.021007] ec_mini: Started. [ 4543.021017] EtherCAT DEBUG 0: Operation thread running with fsm interval = 4000 us, max data size=45000 [ 4543.021023] EtherCAT WARNING 0: 1 datagram TIMED OUT! [ 4543.060061] ec_mini: 1 slave(s). [ 4543.060068] ec_mini: AL states: 0x02. [ 4543.060071] ec_mini: Link is up. [ 4543.060075] inputdata = 00000000 [ 4543.060078] inputdata = 00000000 [ 4543.060086] EtherCAT DEBUG 0: Configuration changed (aborting state check). [ 4543.060090] EtherCAT WARNING 0: No app_time received up to now, but master already active. [ 4543.060094] EtherCAT DEBUG 0: Requesting OP... [ 4543.092062] EtherCAT DEBUG 0-0: Changing state from PREOP to OP. [ 4543.092070] EtherCAT DEBUG 0-0: Configuring... [ 4543.116045] EtherCAT DEBUG 0-0: Now in INIT. [ 4543.116053] EtherCAT DEBUG 0-0: Clearing FMMU configurations... [ 4543.132022] EtherCAT DEBUG 0-0: Clearing sync manager configurations... [ 4543.148031] EtherCAT DEBUG 0-0: Clearing DC assignment... [ 4543.164043] EtherCAT DEBUG 0-0: Configuring mailbox sync managers... [ 4543.164053] EtherCAT DEBUG 0-0: SM0: Addr 0x1000, Size 128, Ctrl 0x36, En 1 [ 4543.164057] EtherCAT DEBUG 0-0: SM1: Addr 0x1080, Size 128, Ctrl 0x32, En 1 [ 4543.196026] EtherCAT DEBUG 0-0: Now in PREOP. [ 4543.196035] EtherCAT DEBUG 0-0: SM2: Addr 0x1100, Size 6, Ctrl 0x74, En 1 [ 4543.196039] EtherCAT DEBUG 0-0: SM3: Addr 0x1400, Size 6, Ctrl 0x30, En 1 [ 4543.244011] EtherCAT DEBUG 0-0: Now in SAFEOP. [ 4543.268055] EtherCAT DEBUG 0-0: Now in OP. Finished configuration. [ 4543.284095] EtherCAT 0: Slave states on main device: OP. It seems works well, there are no errors show on servo driver,except there are three highlights above. I have several questions as follows: 1. How to deal with Sdos, when I set #define SDO_ACCESS 1 , there always show request ec_mini: still busy... dmesg as follow: /ethercat-master$ tool/ethercat sdos SDO 0x1000, "Device Type" 0x1000:00, r-r-r-, uint32, 32 bit, "Device Type" 0x1000:01, r-r-r-, uint32, 32 bit, "Device Type" SDO 0x1001, "" Failed to get SDO entry: Invalid argument 2. How to make my servo on and motor start to rotate? I have try follow steps by command lines: Firstly Set operation mode 0x6060 as 9 which means cyclic velocity mode Secondly, set control word 0x6040 as 15 Then set target speed 0x607a as 300 Seems there is no reaction, i check set status 0x6041, there is no change even i change 0x6040 So I am wondering how can i make my motor rotate by modify mini.c? Anyone can give me any hints will be appreciated! -cheng xi On Wed, Jan 28, 2015 at 5:18 AM, <etherlab-users-requ...@etherlab.org> wrote: > Send etherlab-users mailing list submissions to > etherlab-users@etherlab.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.etherlab.org/mailman/listinfo/etherlab-users > or, via email, send a message with subject or body 'help' to > etherlab-users-requ...@etherlab.org > > You can reach the person managing the list at > etherlab-users-ow...@etherlab.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of etherlab-users digest..." > > > Today's Topics: > > 1. Yaskawa servo Sychronization Error (Ruika You) > 2. Re: Yaskawa servo Sychronization Error (Graeme Foot) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 27 Jan 2015 23:21:25 +0800 > From: Ruika You <crazylinux...@gmail.com> > To: etherlab-users@etherlab.org > Subject: [etherlab-users] Yaskawa servo Sychronization Error > Message-ID: > < > cabqyfp-lex7zkwt9gbjs36u2zvsnw1xtbmicojt6zo+9jug...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > Dear all, > > When I am trying to using etherlab master with yaskawa servo, > sychronization error occur. > dmesg result as follow: > [705599.272444] EtherCAT 0: Link state of ecm0 changed to UP. > [705599.280070] EtherCAT WARNING 0: 1 datagram TIMED OUT! > [705599.292077] EtherCAT 0: 1 slave(s) responding on main device. > [705599.292087] EtherCAT 0: Slave states on main device: INIT. > [705599.292581] EtherCAT 0: Scanning bus. > [705599.316499] EtherCAT 0: Bus scanning completed in 24 ms. > [705599.316509] EtherCAT 0: Using slave 0 as DC reference clock. > [705599.320410] EtherCAT 0: Slave states on main device: PREOP. > [705602.382934] EtherCAT ERROR 0-0: Corrupt mailbox response received! > [705602.382945] EtherCAT DEBUG: 7E 00 01 00 00 63 00 80 04 00 00 00 01 10 > 05 00 > [705602.382965] EtherCAT DEBUG: 00 07 45 72 72 6F 72 20 52 65 67 69 73 74 > 65 72 > [705602.382983] EtherCAT DEBUG: 65 60 9A 60 B1 60 B2 60 B8 60 B9 60 BA 60 > BC 60 > [705602.383001] EtherCAT DEBUG: C1 60 C2 60 E0 60 E1 60 F4 60 FC 60 FD 60 > FE 60 > [705602.383019] EtherCAT DEBUG: FF 60 02 65 03 27 10 27 20 27 E0 27 3F 60 > 40 60 > [705602.383037] EtherCAT DEBUG: 41 60 5A 60 5B 60 5C 60 5D 60 5E 60 60 60 > 61 60 > [705602.383055] EtherCAT DEBUG: 62 60 63 60 64 60 65 60 66 60 67 60 68 60 > 6B 60 > [705602.383073] EtherCAT DEBUG: 6C 60 6D 60 6E 60 71 60 72 60 74 60 76 60 > 77 60 > [705670.466102] EtherCAT: Requesting master 0... > [705670.466114] EtherCAT: Successfully requested master 0. > [705670.466230] EtherCAT 0: Domain0: Logical address 0x00000000, 6 byte, > expected working counter 1. > [705670.466236] EtherCAT 0: Datagram domain0-0-main: Logical offset > 0x00000000, 6 byte, type LWR. > [705670.466290] EtherCAT 0: Master thread exited. > [705670.466297] EtherCAT 0: Starting EtherCAT-OP thread. > [705670.467927] EtherCAT WARNING 0: 1 datagram TIMED OUT! > [705715.024606] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705715.464737] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705716.183720] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms. > [705716.190654] EtherCAT 0: Domain 0: Working counter changed to 1/1. > [705716.312261] EtherCAT 0: Slave states on main device: OP. > [705716.349656] EtherCAT ERROR 0-0: AL status message 0x001A: > "Synchronization error". > [705716.353660] EtherCAT 0-0: Acknowledged state SAFEOP. > [705716.464063] EtherCAT WARNING 0: 6 datagrams UNMATCHED! > [705717.032627] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 5 times. > [705717.192606] EtherCAT 0: Domain 0: 3 working counter changes - now 0/1. > [705717.464687] EtherCAT WARNING 0: 18 datagrams UNMATCHED! > [705718.036643] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 3 times. > [705719.040649] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705719.464082] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705721.492751] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms. > [705721.499648] EtherCAT 0: Domain 0: Working counter changed to 1/1. > [705722.885394] EtherCAT 0: Domain 0: Working counter changed to 0/1. > [705723.056714] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705723.464068] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705723.888711] EtherCAT 0: Domain 0: Working counter changed to 1/1. > [705726.893333] EtherCAT 0: Domain 0: Working counter changed to 0/1. > [705726.901697] EtherCAT ERROR 0-0: AL status message 0x001A: > "Synchronization error". > [705726.904702] EtherCAT 0-0: Acknowledged state SAFEOP. > [705727.072708] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705727.464031] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705727.896710] EtherCAT 0: Domain 0: 2 working counter changes - now 0/1. > [705731.088737] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705731.464045] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > > It seems there are two issues. First of all, [705602.382934] EtherCAT ERROR > 0-0: Corrupt mailbox response received! > secondly, sychronization error. > > Any idea? > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.etherlab.org/pipermail/etherlab-users/attachments/20150127/94439334/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Tue, 27 Jan 2015 21:18:23 +0000 > From: Graeme Foot <graeme.f...@touchcut.com> > To: Ruika You <crazylinux...@gmail.com>, "etherlab-users@etherlab.org" > <etherlab-users@etherlab.org> > Subject: Re: [etherlab-users] Yaskawa servo Sychronization Error > Message-ID: > <8B370CF9AC667C4E8616D8DD2C3231D52BED8737@Pluto.touchcut.local> > Content-Type: text/plain; charset="utf-8" > > Hi, > > Ignore the ?Corrupt mailbox response received?. Also have a quick read of: > http://lists.etherlab.org/pipermail/etherlab-users/2010/001071.html > > The main problem looks to me like the network is not stable. First of all > make sure that all the network cables are plugged in correctly and of a > high enough standard. Try different cables. Cheap cables can cause > problems. > > Also ensure the realtime loop is polling consistently, with little jitter. > > I also notice that you only have one domain. The yaskawa drives require > the reads to be separated from the writes in two separate domains. > > Are you setting up the drive for Distributed Clock? If you use the > default Etherlab master method where the PC clock is the master then the > yaskawa drives aren?t generally happy. There is too much jitter. Search > the forum history for more info on that one. > > > A few things for you to start checking. > > Regards, > Graeme. > > > From: etherlab-users [mailto:etherlab-users-boun...@etherlab.org] On > Behalf Of Ruika You > Sent: Wednesday, 28 January 2015 4:21 a.m. > To: etherlab-users@etherlab.org > Subject: [etherlab-users] Yaskawa servo Sychronization Error > > Dear all, > When I am trying to using etherlab master with yaskawa servo, > sychronization error occur. > dmesg result as follow: > [705599.272444] EtherCAT 0: Link state of ecm0 changed to UP. > [705599.280070] EtherCAT WARNING 0: 1 datagram TIMED OUT! > [705599.292077] EtherCAT 0: 1 slave(s) responding on main device. > [705599.292087] EtherCAT 0: Slave states on main device: INIT. > [705599.292581] EtherCAT 0: Scanning bus. > [705599.316499] EtherCAT 0: Bus scanning completed in 24 ms. > [705599.316509] EtherCAT 0: Using slave 0 as DC reference clock. > [705599.320410] EtherCAT 0: Slave states on main device: PREOP. > [705602.382934] EtherCAT ERROR 0-0: Corrupt mailbox response received! > [705602.382945] EtherCAT DEBUG: 7E 00 01 00 00 63 00 80 04 00 00 00 01 10 > 05 00 > [705602.382965] EtherCAT DEBUG: 00 07 45 72 72 6F 72 20 52 65 67 69 73 74 > 65 72 > [705602.382983] EtherCAT DEBUG: 65 60 9A 60 B1 60 B2 60 B8 60 B9 60 BA 60 > BC 60 > [705602.383001] EtherCAT DEBUG: C1 60 C2 60 E0 60 E1 60 F4 60 FC 60 FD 60 > FE 60 > [705602.383019] EtherCAT DEBUG: FF 60 02 65 03 27 10 27 20 27 E0 27 3F 60 > 40 60 > [705602.383037] EtherCAT DEBUG: 41 60 5A 60 5B 60 5C 60 5D 60 5E 60 60 60 > 61 60 > [705602.383055] EtherCAT DEBUG: 62 60 63 60 64 60 65 60 66 60 67 60 68 60 > 6B 60 > [705602.383073] EtherCAT DEBUG: 6C 60 6D 60 6E 60 71 60 72 60 74 60 76 60 > 77 60 > [705670.466102] EtherCAT: Requesting master 0... > [705670.466114] EtherCAT: Successfully requested master 0. > [705670.466230] EtherCAT 0: Domain0: Logical address 0x00000000, 6 byte, > expected working counter 1. > [705670.466236] EtherCAT 0: Datagram domain0-0-main: Logical offset > 0x00000000, 6 byte, type LWR. > [705670.466290] EtherCAT 0: Master thread exited. > [705670.466297] EtherCAT 0: Starting EtherCAT-OP thread. > [705670.467927] EtherCAT WARNING 0: 1 datagram TIMED OUT! > [705715.024606] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705715.464737] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705716.183720] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms. > [705716.190654] EtherCAT 0: Domain 0: Working counter changed to 1/1. > [705716.312261] EtherCAT 0: Slave states on main device: OP. > [705716.349656] EtherCAT ERROR 0-0: AL status message 0x001A: > "Synchronization error". > [705716.353660] EtherCAT 0-0: Acknowledged state SAFEOP. > [705716.464063] EtherCAT WARNING 0: 6 datagrams UNMATCHED! > [705717.032627] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 5 times. > [705717.192606] EtherCAT 0: Domain 0: 3 working counter changes - now 0/1. > [705717.464687] EtherCAT WARNING 0: 18 datagrams UNMATCHED! > [705718.036643] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 3 times. > [705719.040649] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705719.464082] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705721.492751] EtherCAT WARNING 0-0: Slave did not sync after 5000 ms. > [705721.499648] EtherCAT 0: Domain 0: Working counter changed to 1/1. > [705722.885394] EtherCAT 0: Domain 0: Working counter changed to 0/1. > [705723.056714] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705723.464068] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705723.888711] EtherCAT 0: Domain 0: Working counter changed to 1/1. > [705726.893333] EtherCAT 0: Domain 0: Working counter changed to 0/1. > [705726.901697] EtherCAT ERROR 0-0: AL status message 0x001A: > "Synchronization error". > [705726.904702] EtherCAT 0-0: Acknowledged state SAFEOP. > [705727.072708] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705727.464031] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > [705727.896710] EtherCAT 0: Domain 0: 2 working counter changes - now 0/1. > [705731.088737] EtherCAT WARNING: Datagram f1fadf0c (domain0-0-main) was > SKIPPED 1 time. > [705731.464045] EtherCAT WARNING 0: 3 datagrams UNMATCHED! > It seems there are two issues. First of all, [705602.382934] EtherCAT > ERROR 0-0: Corrupt mailbox response received! > secondly, sychronization error. > Any idea? > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.etherlab.org/pipermail/etherlab-users/attachments/20150127/18fb6ee9/attachment.html > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > etherlab-users mailing list > etherlab-users@etherlab.org > http://lists.etherlab.org/mailman/listinfo/etherlab-users > > > ------------------------------ > > End of etherlab-users Digest, Vol 92, Issue 8 > ********************************************* >
/****************************************************************************** * * $Id: mini.c,v bc2d4bf9cbe5 2012/09/06 18:22:24 fp $ * * Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH * * This file is part of the IgH EtherCAT Master. * * The IgH EtherCAT Master is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2, as * published by the Free Software Foundation. * * The IgH EtherCAT Master is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * Public License for more details. * * You should have received a copy of the GNU General Public License along * with the IgH EtherCAT Master; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * --- * * The license mentioned above concerns the source code only. Using the * EtherCAT technology and brand is only permitted in compliance with the * industrial property and similar rights of Beckhoff Automation GmbH. * *****************************************************************************/ #include<linux/init.h> #include <linux/version.h> #include <linux/module.h> #include <linux/timer.h> #include <linux/interrupt.h> #include <linux/err.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) #include <linux/slab.h> #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) #include <linux/semaphore.h> #else #include <asm/semaphore.h> #endif #include "../../include/ecrt.h" // EtherCAT realtime interface /*****************************************************************************/ // Module parameters #define FREQUENCY 100 // Optional features #define CONFIGURE_PDOS 1 //#define EL3152_ALT_PDOS 0 #define EXTERNAL_MEMORY 1 #define SDO_ACCESS 1 #define VOE_ACCESS 0 #define ENABLE_INPUTS 1 #define PFX "ec_mini: " /*****************************************************************************/ // EtherCAT static ec_master_t *master = NULL; static ec_master_state_t master_state = {}; struct semaphore master_sem; //static ec_domain_t *domain1 = NULL; /*****************************************\ Seperate domain \*****************************************/ static ec_domain_t *read_domain = NULL; static ec_domain_t *write_domain = NULL; //static ec_domain_state_t domain1_state = {}; static ec_domain_state_t read_domain_state = {}; static ec_domain_state_t write_domain_state = {}; static ec_slave_config_t *sc_ana_in = NULL; static ec_slave_config_state_t sc_ana_in_state = {}; // Timer static struct timer_list timer; /*****************************************************************************/ // process data //static uint8_t *domain1_pd; // process data memory static uint8_t *read_domain_pd; static uint8_t *write_domain_pd; //#define AnaInSlavePos 0, 2 //#define AnaOutSlavePos 0, 1 //#define DigOutSlavePos 0, 3 //#define Beckhoff_EL2004 0x00000002, 0x07D43052 //#define Beckhoff_EL3152 0x00000002, 0x0c503052 //#define Beckhoff_EL4102 0x00000002, 0x10063052 #define YaskawaPos 0, 1 #define Yaskawa_SGDV 0x00000539, 0x02200001 // offsets for PDO entries //static unsigned int off_ana_in; //static unsigned int off_ana_out; //static unsigned int off_dig_out; //static unsigned int off_ana_in; static unsigned int control_word_rw; static unsigned int target_velocity_rw; //static unsigned int target_position_rw; //static unsigned int velocity_offset_rw; //static unsigned int max_torque_rw; //static unsigned int outputs_rw; //static unsigned int latch_control_rw; static unsigned int mode_operation_rw; static unsigned int status_r; static unsigned int actual_position_r; //static unsigned int actual_velocity_r; //static unsigned int actual_torque_r; //static unsigned int actual_following_error_r; //static unsigned int inputs_r; //static unsigned int latch_pos_r; //static unsigned int latch_status_r; //static unsigned int current_mode_operation_r; //static unsigned int last_error_code_r; //const static ec_pdo_entry_reg_t domain1_regs[] = { //#if EL3152_ALT_PDOS // {AnaInSlavePos, Beckhoff_EL3152, 0x6401, 1, &off_ana_in}, //#else // {AnaInSlavePos, Beckhoff_EL3152, 0x3101, 2, &off_ana_in}, //#endif // {AnaOutSlavePos, Beckhoff_EL4102, 0x3001, 1, &off_ana_out}, // {DigOutSlavePos, Beckhoff_EL2004, 0x3001, 1, &off_dig_out}, // {} //}; const static ec_pdo_entry_reg_t write_domain_regs[] = { // {YaskawaPos, Yaskawa_SGDV, 0x6040, 0, &control_word_rw}, // {YaskawaPos, Yaskawa_SGDV, 0x607a, 0, &target_position_rw}, // {YaskawaPos, Yaskawa_SGDV, 0x60b1, 0, &velocity_offset_rw}, // {YaskawaPos, Yaskawa_SGDV, 0x6072, 0, &max_torque_rw}, // {YaskawaPos, Yaskawa_SGDV, 0x60fe, 0, &outputs_rw}, // {YaskawaPos, Yaskawa_SGDV, 0x60b8, 0, &latch_control_rw}, // {YaskawaPos, Yaskawa_SGDV, 0x6060, 0, &mode_operation_rw}, {YaskawaPos, Yaskawa_SGDV, 0x6040, 0, &control_word_rw}, {YaskawaPos, Yaskawa_SGDV, 0x60ff, 0, &target_velocity_rw}, {YaskawaPos, Yaskawa_SGDV, 0x6060, 0, &mode_operation_rw}, {} }; const static ec_pdo_entry_reg_t read_domain_regs[] = { {YaskawaPos, Yaskawa_SGDV, 0x6041, 0, &status_r}, {YaskawaPos, Yaskawa_SGDV, 0x6064, 0, &actual_position_r}, // {YaskawaPos, Yaskawa_SGDV, 0x6041, 0, &status_r}, // {YaskawaPos, Yaskawa_SGDV, 0x6064, 0, &actual_position_r}, // {YaskawaPos, Yaskawa_SGDV, 0x606c, 0, &actual_velocity_r}, // {YaskawaPos, Yaskawa_SGDV, 0x6077, 0, &actual_torque_r}, // {YaskawaPos, Yaskawa_SGDV, 0x60f4, 0, &actual_following_error_r}, // {YaskawaPos, Yaskawa_SGDV, 0x60fd, 0, &inputs_r}, // {YaskawaPos, Yaskawa_SGDV, 0x60ba, 0, &latch_pos_r}, // {YaskawaPos, Yaskawa_SGDV, 0x60b9, 0, &latch_status_r}, // {YaskawaPos, Yaskawa_SGDV, 0x6061, 0, ¤t_mode_operation_r}, // {YaskawaPos, Yaskawa_SGDV, 0x603f, 0, &last_error_code_r}, {} }; static unsigned int counter = 0; static unsigned int blink = 0; ///*****************************************************************************/ //#if CONFIGURE_PDOS //// Analog in -------------------------- //static ec_pdo_entry_info_t el3152_pdo_entries[] = { // {0x3101, 1, 8}, // channel 1 status // {0x3101, 2, 16}, // channel 1 value // {0x3102, 1, 8}, // channel 2 status // {0x3102, 2, 16}, // channel 2 value // {0x6401, 1, 16}, // channel 1 value (alt.) // {0x6401, 2, 16} // channel 2 value (alt.) //}; //#if EL3152_ALT_PDOS //static ec_pdo_info_t el3152_pdos[] = { // {0x1A10, 2, el3152_pdo_entries + 4}, //}; //static ec_sync_info_t el3152_syncs[] = { // {2, EC_DIR_OUTPUT}, // {3, EC_DIR_INPUT, 1, el3152_pdos}, // {0xff} //}; //#else //static ec_pdo_info_t el3152_pdos[] = { // {0x1A00, 2, el3152_pdo_entries}, // {0x1A01, 2, el3152_pdo_entries + 2} //}; //static ec_sync_info_t el3152_syncs[] = { // {2, EC_DIR_OUTPUT}, // {3, EC_DIR_INPUT, 1, el3152_pdos}, // {0xff} //}; //#endif //// Analog out ------------------------- //static ec_pdo_entry_info_t el4102_pdo_entries[] = { // {0x3001, 1, 16}, // channel 1 value // {0x3002, 1, 16}, // channel 2 value //}; //static ec_pdo_info_t el4102_pdos[] = { // {0x1600, 1, el4102_pdo_entries}, // {0x1601, 1, el4102_pdo_entries + 1} //}; //static ec_sync_info_t el4102_syncs[] = { // {2, EC_DIR_OUTPUT, 2, el4102_pdos}, // {3, EC_DIR_INPUT}, // {0xff} //}; //// Digital out ------------------------ //static ec_pdo_entry_info_t el2004_channels[] = { // {0x3001, 1, 1}, // Value 1 // {0x3001, 2, 1}, // Value 2 // {0x3001, 3, 1}, // Value 3 // {0x3001, 4, 1} // Value 4 //}; //static ec_pdo_info_t el2004_pdos[] = { // {0x1600, 1, &el2004_channels[0]}, // {0x1601, 1, &el2004_channels[1]}, // {0x1602, 1, &el2004_channels[2]}, // {0x1603, 1, &el2004_channels[3]} //}; //static ec_sync_info_t el2004_syncs[] = { // {0, EC_DIR_OUTPUT, 4, el2004_pdos}, // {1, EC_DIR_INPUT}, // {0xff} //}; //#endif /*****************************************************************************/ static ec_pdo_entry_info_t yaskawaSGDV_pdoEntries[] = {/* {0x6040, 0x00, 16}, // pg 8-21 control (rw) {0x607a, 0x00, 32}, // pg 8-30 target position (rw) (for cyclic sync pos mode) {0x60b1, 0x00, 32}, // pg 8-37 velocity offset (rw) (for cyclic sync pos mode) {0x6072, 0x00, 16}, // pg 8-40 max torque (rw) in 0.1% increments, what is +ve torque lim and - torque lim? pdo or sdo?? // {0x60fe, 0x01, 32}, // pg 8-44 outputs (rw) (bits 17, 18, 19 control outputs 1, 2, 3) {0x60fe, 0x00, 32}, // pg 8-44 outputs (rw) (bits 17, 18, 19 control outputs 1, 2, 3) {0x60b8, 0x00, 16}, // pg 8-41 latchControl (rw) (bits: 0 enable latch, 1 single/continuous trigger, // 2 0=latch on S14 | 1=latch on C, 4 enable latch sampling???) {0x6060, 0x00, 8}, // pg 8-28 mode of operation (rw) (8=cyclic pos, 9=cyclic vel) {0x6041, 0x00, 16}, // pg 8-23 status (r) {0x6064, 0x00, 32}, // pg 8-34 actual position (r) {0x606c, 0x00, 32}, // pg 8-38 actual velocity (r) required?? {0x6077, 0x00, 16}, // pg 8-39 actual torque (r) {0x60f4, 0x00, 32}, // pg 8-35 actual following error (r) {0x60fd, 0x00, 32}, // pg 8-43 inputs (r) (available inputs: 0 (rev lim), 1 (fwd lim), 2 (hm), // 16 - 22 (via CN1), 25 - 25 (via base block)) {0x60ba, 0x00, 32}, // pg 8-42 latchPos (r) (via touch probe 1) {0x60b9, 0x00, 16}, // pg 8-42 latchStatus (r) (bits: 0 latch enabled, 1 latched, 7 latched toggle (for continuous mode)) {0x6061, 0x00, 8}, // pg 8-28 current mode of operation {0x603f, 0x00, 16}, // pg 8-21 last error codedomain1_state*/ {0x6040, 0x00, 16}, {0x60ff, 0x00, 32}, {0x6060, 0x00, 8}, // pg 8-28 mode of operation (rw) (8=cyclic pos, 9=cyclic vel) {0x6041, 0x00, 16}, {0x6064, 0x00, 32} }; ec_pdo_info_t yaskawaSGDV_pdos[] = { // {0x1600, 7, yaskawaSGDV_pdoEntries + 0}, // {0x1a00, 8, yaskawaSGDV_pdoEntries + 7}, // {0x1a01, 2, yaskawaSGDV_pdoEntries + 15}, {0x1602, 3, yaskawaSGDV_pdoEntries + 0}, {0x1a02, 2, yaskawaSGDV_pdoEntries + 3}, }; ec_sync_info_t yaskawaSGDV_syncs[] = { {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE}, {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE}, {2, EC_DIR_OUTPUT, 1, yaskawaSGDV_pdos + 0, EC_WD_ENABLE}, // {3, EC_DIR_INPUT, 2, yaskawaSGDV_pdos + 1, EC_WD_DISABLE}, {3, EC_DIR_INPUT, 1, yaskawaSGDV_pdos + 1, EC_WD_DISABLE}, {0xff} }; /*****************************************************************************/ #if SDO_ACCESS static ec_sdo_request_t *sdo; #endif #if VOE_ACCESS static ec_voe_handler_t *voe; #endif /*****************************************************************************/ //void check_domain1_state(void) //{ // ec_domain_state_t ds; // down(&master_sem); // ecrt_domain_state(domain1, &ds); // up(&master_sem); // if (ds.working_counter != domain1_state.working_counter) // printk(KERN_INFO PFX "Domain1: WC %u.\n", ds.working_counter); // if (ds.wc_state != domain1_state.wc_state) // printk(KERN_INFO PFX "Domain1: State %u.\n", ds.wc_state); // domain1_state = ds; //} void check_read_domain_state(void) { ec_domain_state_t ds; down(&master_sem); ecrt_domain_state(read_domain, &ds); up(&master_sem); if (ds.working_counter != read_domain_state.working_counter) printk(KERN_INFO PFX "Read Domain: WC %u.\n", ds.working_counter); if (ds.wc_state != read_domain_state.wc_state) printk(KERN_INFO PFX "Read Domain: State %u.\n", ds.wc_state); read_domain_state = ds; } void check_write_domain_state(void) { ec_domain_state_t ds; down(&master_sem); ecrt_domain_state(write_domain, &ds); up(&master_sem); if (ds.working_counter != write_domain_state.working_counter) printk(KERN_INFO PFX "Write Domain: WC %u.\n", ds.working_counter); if (ds.wc_state != write_domain_state.wc_state) printk(KERN_INFO PFX "Write Domain: State %u.\n", ds.wc_state); write_domain_state = ds; } /*****************************************************************************/ void check_master_state(void) { ec_master_state_t ms; down(&master_sem); ecrt_master_state(master, &ms); up(&master_sem); if (ms.slaves_responding != master_state.slaves_responding) printk(KERN_INFO PFX "%u slave(s).\n", ms.slaves_responding); if (ms.al_states != master_state.al_states) printk(KERN_INFO PFX "AL states: 0x%02X.\n", ms.al_states); if (ms.link_up != master_state.link_up) printk(KERN_INFO PFX "Link is %s.\n", ms.link_up ? "up" : "down"); master_state = ms; } /*****************************************************************************/ void check_slave_config_states(void) { ec_slave_config_state_t s; down(&master_sem); ecrt_slave_config_state(sc_ana_in, &s); up(&master_sem); if (s.al_state != sc_ana_in_state.al_state) printk(KERN_INFO PFX "AnaIn: State 0x%02X.\n", s.al_state); if (s.online != sc_ana_in_state.online) printk(KERN_INFO PFX "AnaIn: %s.\n", s.online ? "online" : "offline"); if (s.operational != sc_ana_in_state.operational) printk(KERN_INFO PFX "AnaIn: %soperational.\n", s.operational ? "" : "Not "); sc_ana_in_state = s; } /*****************************************************************************/ #if SDO_ACCESS void read_sdo(void) { switch (ecrt_sdo_request_state(sdo)) { case EC_REQUEST_UNUSED: // request was not used yet ecrt_sdo_request_read(sdo); // trigger first read break; case EC_REQUEST_BUSY: printk(KERN_INFO PFX "Still busy...\n"); break; case EC_REQUEST_SUCCESS: printk(KERN_INFO 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_REQUEST_ERROR: printk(KERN_INFO PFX "Failed to read SDO!\n"); ecrt_sdo_request_read(sdo); // retry reading break; } } #endif /*****************************************************************************/ #if VOE_ACCESS void read_voe(void) { switch (ecrt_voe_handler_execute(voe)) { case EC_REQUEST_UNUSED: ecrt_voe_handler_read(voe); // trigger first read break; case EC_REQUEST_BUSY: printk(KERN_INFO PFX "VoE read still busy...\n"); break; case EC_REQUEST_SUCCESS: printk(KERN_INFO PFX "VoE received.\n"); // get data via ecrt_voe_handler_data(voe) ecrt_voe_handler_read(voe); // trigger next read break; case EC_REQUEST_ERROR: printk(KERN_INFO PFX "Failed to read VoE data!\n"); ecrt_voe_handler_read(voe); // retry reading break; } } #endif /*****************************************************************************/ //void cyclic_task(unsigned long data) //{ // // receive process data // down(&master_sem); // ecrt_master_receive(master); // ecrt_domain_process(domain1); // up(&master_sem); // // check process data state (optional) // check_domain1_state(); // if (counter) { // counter--; // } else { // do this at 1 Hz // counter = FREQUENCY; // // calculate new process data // blink = !blink; // // check for master state (optional) // check_master_state(); // // check for islave configuration state(s) (optional) // check_slave_config_states(); //#if SDO_ACCESS // // read process data SDO // read_sdo(); //#endif //#if VOE_ACCESS // read_voe(); //#endif // } // // write process data // EC_WRITE_U8(domain1_pd + off_dig_out, blink ? 0x06 : 0x09); // // send process data // down(&master_sem); // ecrt_domain_queue(domain1); // ecrt_master_send(master); // up(&master_sem); // // restart timer // timer.expires += HZ / FREQUENCY; // add_timer(&timer); //} void cyclic_task(unsigned long data) { unsigned short inputdata; // static unsigned short ctrlword = 0; // receive process data down(&master_sem); ecrt_master_receive(master); ecrt_domain_process(write_domain); #ifdef ENABLE_INPUTS ecrt_domain_process(read_domain); #endif up(&master_sem); if (counter) { counter--; } else { // do this at 1 Hz counter = FREQUENCY*10;///10; // calculate new process data // blink ^= 0xFFFF; blink *= 2; // check process data state (optional) check_read_domain_state(); // check for master state (optional) check_master_state(); // check for islave configuration state(s) (optional) check_slave_config_states(); if (blink > 0x8000) blink = 1; } #if SDO_ACCESS // read process data SDO read_sdo(); #endif // write process data EC_WRITE_U16(write_domain_pd + control_word_rw, 0x09); #ifdef ENABLE_INPUTS inputdata = EC_READ_U16(read_domain_pd + status_r); // if(counter == FREQUENCY*10) // printk(KERN_ALERT "inputdata = %08X\n",inputdata); // inputdata = EC_READ_U16(read_domain_pd + current_mode_operation_r); // if(counter == FREQUENCY*10) // printk(KERN_ALERT "inputdata = %08X\n",inputdata); #endif // send process data down(&master_sem); ecrt_domain_queue(write_domain); ecrt_domain_queue(read_domain); ecrt_master_send(master); up(&master_sem); // restart timer timer.expires += HZ / FREQUENCY; add_timer(&timer); // if(control_word_rw == 0) // control_word_rw = 6; // else if(control_word_rw == 6) // control_word_rw = 7; // else if(control_word_rw == 7) // control_word_rw = 15; } /*****************************************************************************/ void send_callback(void *cb_data) { ec_master_t *m = (ec_master_t *) cb_data; down(&master_sem); ecrt_master_send_ext(m); up(&master_sem); } /*****************************************************************************/ void receive_callback(void *cb_data) { ec_master_t *m = (ec_master_t *) cb_data; down(&master_sem); ecrt_master_receive(m); up(&master_sem); } /*****************************************************************************/ int __init init_mini_module(void) { int ret = -1; #if CONFIGURE_PDOS ec_slave_config_t *sc; #endif #if EXTERNAL_MEMORY unsigned int size; #endif printk(KERN_INFO PFX "Starting...\n"); master = ecrt_request_master(0); if (!master) { ret = -EBUSY; printk(KERN_ERR PFX "Requesting master 0 failed.\n"); goto out_return; } sema_init(&master_sem, 1); ecrt_master_callbacks(master, send_callback, receive_callback, master); printk(KERN_INFO PFX "Registering domain...\n"); if (!(write_domain = ecrt_master_create_domain(master))) { printk(KERN_ERR PFX "Domain creation failed!\n"); goto out_release_master; } if (!(read_domain = ecrt_master_create_domain(master))) { printk(KERN_ERR PFX "Domain creation failed!\n"); goto out_release_master; } if (!(sc_ana_in = ecrt_master_slave_config( master, YaskawaPos, Yaskawa_SGDV))) { printk(KERN_ERR PFX "Failed to get slave configuration.\n"); goto out_release_master; } // // slaveConfig = ecrt_master_slave_config(master, alias, position, // vendorID, productCode); // ecrt_slave_config_pdos(slaveConfig, EC_END, yaskawaSGDV_syncs); // #if CONFIGURE_PDOS printk(KERN_INFO PFX "Configuring PDOs...\n"); if (ecrt_slave_config_pdos(sc_ana_in, EC_END, yaskawaSGDV_syncs)) { printk(KERN_ERR PFX "Failed to configure PDOs.\n"); goto out_release_master; } // if (!(sc = ecrt_master_slave_config( // master, AnaOutSlavePos, Beckhoff_EL4102))) { // printk(KERN_ERR PFX "Failed to get slave configuration.\n"); // goto out_release_master; // } // if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) { // printk(KERN_ERR PFX "Failed to configure PDOs.\n"); // goto out_release_master; // } // if (!(sc = ecrt_master_slave_config( // master, DigOutSlavePos, Beckhoff_EL2004))) { // printk(KERN_ERR PFX "Failed to get slave configuration.\n"); // goto out_release_master; // } // if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) { // printk(KERN_ERR PFX "Failed to configure PDOs.\n"); // goto out_release_master; // } #endif #if SDO_ACCESS printk(KERN_INFO PFX "Creating SDO requests...\n"); if (!(sdo = ecrt_slave_config_create_sdo_request(sc_ana_in, 0x6061, 0x00, 4))) { printk(KERN_ERR PFX "Failed to create SDO request.\n"); goto out_release_master; } ecrt_sdo_request_timeout(sdo, 500); // ms #endif //#if VOE_ACCESS // printk(KERN_INFO PFX "Creating VoE handlers...\n"); // if (!(voe = ecrt_slave_config_create_voe_handler(sc_ana_in, 1000))) { // printk(KERN_ERR PFX "Failed to create VoE handler.\n"); // goto out_release_master; // } //#endif printk(KERN_INFO PFX "Registering PDO entries...\n"); if (ecrt_domain_reg_pdo_entry_list(write_domain, write_domain_regs)) { printk(KERN_ERR PFX "write PDO entry registration failed!\n"); goto out_release_master; } if (ecrt_domain_reg_pdo_entry_list(read_domain, read_domain_regs)) { printk(KERN_ERR PFX "read PDO entry registration failed!\n"); goto out_release_master; } #if EXTERNAL_MEMORY if ((size = ecrt_domain_size(write_domain))) { if (!(write_domain_pd = (uint8_t *) kmalloc(size, GFP_KERNEL))) { printk(KERN_ERR PFX "Failed to allocate %u bytes of process data" " memory!\n", size); goto out_release_master; } ecrt_domain_external_memory(write_domain, write_domain_pd); } if ((size = ecrt_domain_size(read_domain))) { if (!(read_domain_pd = (uint8_t *) kmalloc(size, GFP_KERNEL))) { printk(KERN_ERR PFX "Failed to allocate %u bytes of process data" " memory!\n", size); goto out_release_master; } ecrt_domain_external_memory(read_domain, read_domain_pd); } #endif printk(KERN_INFO PFX "Activating master...\n"); if (ecrt_master_activate(master)) { printk(KERN_ERR PFX "Failed to activate master!\n"); #if EXTERNAL_MEMORY goto out_free_process_data; #else goto out_release_master; #endif } #if !EXTERNAL_MEMORY // Get internal process data for domain write_domain_pd = ecrt_domain_data(write_domain); read_domain_pd = ecrt_domain_data(read_domain); #endif printk(KERN_INFO PFX "Starting cyclic sample thread.\n"); init_timer(&timer); timer.function = cyclic_task; timer.expires = jiffies + 10; add_timer(&timer); printk(KERN_INFO PFX "Started.\n"); return 0; #if EXTERNAL_MEMORY out_free_process_data: kfree(write_domain_pd); kfree(read_domain_pd); #endif out_release_master: printk(KERN_ERR PFX "Releasing master...\n"); ecrt_release_master(master); out_return: printk(KERN_ERR PFX "Failed to load. Aborting.\n"); return ret; } /*****************************************************************************/ void __exit cleanup_mini_module(void) { printk(KERN_INFO PFX "Stopping...\n"); del_timer_sync(&timer); #if EXTERNAL_MEMORY kfree(write_domain_pd); kfree(read_domain_pd); #endif printk(KERN_INFO PFX "Releasing master...\n"); ecrt_release_master(master); printk(KERN_INFO PFX "Unloading.\n"); } /*****************************************************************************/ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Florian Pose <f...@igh-essen.com>"); MODULE_DESCRIPTION("EtherCAT minimal test environment"); module_init(init_mini_module); module_exit(cleanup_mini_module); /*****************************************************************************/
ec_mini
Description: Binary data
_______________________________________________ etherlab-users mailing list etherlab-users@etherlab.org http://lists.etherlab.org/mailman/listinfo/etherlab-users