Hi:<br><br>I am a new user in Ethercat field, and have recently developed an application using BechHoff products including encoder EL5101. <br><br>The application seems working fine with an early EL5101 encoder module (product code= '0x13ed3052', RevisionNo='0x00010000'). However, the application does not work with new BechHoff EL5101 encoder module (product code='0x13ed3052', RevisionNo='0x03fb0000'). <br>
<br>The program is running on the RTAI platform.<br><br>Can someone give help on how to solve this problem? Below are parts of related code in my test program.<br><br>===================================<br>domain1_regs[0].alias = 1 ;<br>
domain1_regs[0].position = 0; <br>domain1_regs[0].vendor_id = 0x00000002;<br>domain1_regs[0].product_code =0x13ed3052;<br>domain1_regs[0].index = 0x6000;<br>domain1_regs[0].subindex =2; <br>domain1_regs[0].offset = &ec_io_offset[0];<br>
<br><br>void run(long data)<br>{<br> int j ;<br> int return_value, k ;<br> unsigned int index_ ;<br><br><br> while (1) {<br><br> t_last_cycle = get_cycles();<br> //printk(KERN_INFO PFX "t_last_cycle: %d\n",t_last_cycle); <br>
<br> // receive process data<br> rt_sem_wait(&master_sem);<br> ecrt_master_receive(master);<br> ecrt_domain_process(domain1);<br> rt_sem_signal(&master_sem);<br><br> // check process data state (optional)<br>
check_domain1_state();<br><br> if (counter) {<br> counter--;<br> } else { // do this at 1 Hz<br> counter = FREQUENCY*60;<br> // check for master state (optional)<br> check_master_state();<br>
}<br><br> p_ec_io_value->value[domain1_regs[0].alias] = EC_READ_U16(domain1_pd + ec_io_offset[0]) ;<br><br> <br> rt_sem_wait(&master_sem);<br> ecrt_domain_queue(domain1);<br> ecrt_master_send(master);<br>
rt_sem_signal(&master_sem);<br> <br> rt_task_wait_period();<br> }<br>}<br><br><br>int __init init_mod(void)<br>{<br> ......<br> ......<br><br> ecrt_master_callbacks(master, request_lock, release_lock, NULL);<br>
printk(KERN_INFO PFX "Registering domain...\n");<br> if (!(domain1 = ecrt_master_create_domain(master))) {<br> printk(KERN_ERR PFX "Domain creation failed!\n");<br><br> goto out_release_master;<br>
}<br><br> printk(KERN_INFO PFX "Registering Pdo entries...\n");<br> if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {<br> printk(KERN_ERR PFX "Pdo entry registration failed!\n");<br>
goto out_release_master;<br> }<br><br> printk(KERN_INFO PFX "Activating master...\n");<br> if (ecrt_master_activate(master)) {<br> printk(KERN_ERR PFX "Failed to activate master!\n");<br>
goto out_release_master;<br> }<br><br> // Get internal process data for domain<br> domain1_pd = ecrt_domain_data(domain1);<br><br>......<br>......<br>}<br><br>==================================<br><br>After loading the program, encoder slave-status changed happily from preop --> op. However, it only reads encoder value once such as 1296 and then locked there forever. <br>
<br>Thanks in advance for any help.<br><br>Jason Xu<br><br>