-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profile velocity mode works fine, but Cyclic sync velocity mode doesn't move #482
Comments
You are almost there. In the ESI file the AssignActivate value is 0x0700. This means 0x00 has to be written to ESC register 0x0980 and 0x07 to ESC register 0x0981. This will configure both SYNC0 and SYNC1. You only activate SYNC0.
Should be changed to:
Cycleshift parameter does not need to be set. A remark, your code is probably going to work, but it is better to enable DC and sync and stabilization at pre-OP. |
Thanks for the reply! |
I try to move the DC and ec_dcsync 's code around and found they working at a very strange position
Here is the code: I don't know why they get worked here. What is the correct way to write the DC and ec_dcsync ? Waiting for a your response, thank you. |
It's not real working....I check the SYNC manager 2 parameter 0x1c32:01, it is 01 which is Synchronous: Synchronous (with SM2 event). I use twincat to run a demo, the 0x1c32 is 02 and works fine. Here is the wireshark data twincat |
@ArthurKetels The startup cmd is: I think the problem is still at the DC and sync settings. Should I change the ec_dcsync0 or ec_dcsync01 code to make it send the same cmd to let the DC working? Any suggestion is appreciated. |
Throwing mud to the wall to see if it sticks is not advisable to solve your problems. You need a better understanding. |
Dear sir, Huge thanks for your depth explanation, after reading that I finally get correct DC settings and let the driver working in csv mode. I found ec_dcsync01 works in the following parameter. CylcTime1 should be 0.
If CylcTime1=CylcTime0=1000, the 1c32:01 will be 3. There is no mode 3 in my driver so this won't works. With the PREOP->SAFEOP hooks #142 , the ec_dcsync01 correctly set the 1c32:01 to 2 which is DC sync mode in my case.
If don't use the PREOP->SAFEOP hooks, dorun should be 1 after ec_configdc.
Then I try to test the real time performance. I use a FPGA based capture tool(which can take ns timestamp) and wireshark combine to catch 30 second data in OP. My CPU is i7-9700, NIC is intel82575(TwinCAT support hardware), debian 10 with preempt rt patch. The linux time is synced to DC time using the same code in red_test.c. Most of time the jitter is within 50us, but there is still a lot of frames have 100~150us jitter. How could I improve the real time performance? Thanks. |
Well, congratulations with your results. I am happy my write-up helped you in the right direction. About Linux real-time performance. This is not so easy as you have noticed. Although this has nothing to do with SOEM or EtherCAT, here some pieces of advice. Luckily you attached a graph with the measured timing latencies. Good data is always the basis for analysis and improvement. You can see 3 bands in your graph. Each separated almost a perfect 50us. Also larger deviations happen in bursts. This is most likely due to your microprocessor going into deeper C states to conserve energy. Waking up costs some time. There is a tunable in the kernel to prevent this C state regulation. See : https://gist.github.com/SaveTheRbtz/f5e8d1ca7b55b6a7897b Other things to try is to isolate a CPU to use only for SOEM and the NIC driver. Then you are sure no other programs are running on this CPU. This is actually what TwinCAT does. It runs a real-time OS next to windows on its own CPU(s). A source of latency might be a GPU driver. The open linux drivers are mostly fine, but the proprietary versions are know for latency spikes. Make sure you do not have devices on your system that block the system bus for a long time. Known devices are PS/2 keyboard and mouse, USB1 mouse, graphic cards. In general, clean-up the hardware in your system as much as possible. Disable all unnecessary drivers. |
When I did another 30mins test, I got a few warnings in the terminal. They are not very often, 5~7 mins to got one. Then after about 10ms the driver go back to OP mode and keep moving. |
After one week testing and debugging, I still have the random warnings . The driver fall into Safe OP during OP. Sometimes after a few mins to get the warnings, sometimes after a few hours(4~5). I have no idea now. |
You will need to instrument your system to figure out what goes wrong and why. Google around to figure out the linux trace functions, and how to use them on the network stack. Another approach is to split your system in VM's with a RT-hypervisor. One example: Lastly you have to make sure to rule-out hardware stability issues. Is your cabling OK, your power supply, tested with other slaves, etc.? |
A good video explaining general options to improve real-time behavior |
@Linshiyuan , can this issue be closed? |
Hi,
I met a strange problem when trying to control two servo drivers.
I modify the ebox.c example and let the two drivers works in Profile velocity mode ( OPmode 0x6060=3 ). When I change to cyclic sync velocity mode ( OPmode 0x6060=9 ), the driver reach state OP and switched on, but the motor didn't move. I use pc software of the driver to check the register and find the target velocity(0x60FF ) is changed over time, it seems the PBO works fine.
I guess there is something wrong with Distributed Clock settings?
But it can reach op and switched op, I am very confused now.
My code and running result:
move2driver.c.txt
output of move2driver.txt
./slaveinfo -map :
output of Slaveinfo.txt
slave's ESI file:
Stone -E XML_04.23(PC).xml.zip
Your help is very much appreciated!
The text was updated successfully, but these errors were encountered: