-
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
The sync0 signals of 2 slaves cannot be aligned #618
Comments
Forgot to say, my slaves are 2 LAN9252 demo boards with STM32F7 as MCU |
What are the values of I have tested the sync code with many slaves and never found a large sync0 shift (always +-25ns). Although not critical but might I suggest a different order for slave synchronization? |
The value of #487 (comment) helped me a lot, I made changes to my program by referring to it before I will try to continue modifying according to #520, looking forward to good results |
Could you test your set-up with an unmodified SOEM slaveinfo? It shows the propagation delay for each slave. I have tested this with a set of LAN9252 and they yield exactly 700ns propagation delay between two slaves. The propagation delay measurement algorithm in SOEM is not perfect and could be improved. But even as-is you can measure cable delays quite accurately. For cat5e cable I find an average delay of around 4.7ns/m. The biggest influence on variable delay is still the PHY. By design the delay can be +- one symbol at 25Msymbols/s for ethernet 100TX. On the other hand there are very few applications that require better accuracy. |
From what you said, I tried adjusting the order of the slave syncs, but I didn't get good results, or even worse - sometimes there is no I ran This is the ESI file I use to configure |
There is also a very strange problem. In the process of debugging, I can occasionally measure the delay of slave2 to be 740ns because I hit a breakpoint. This result should be reasonable, but if I run directly without a breakpoint, The measured delay is always 0ns. The environment where I run SOEM is ZYNQ7015, and the underlying MAC communication is transplanted by myself. I don't have enough confidence to ensure that my MAC communication is no problem, but it seems that the communication should be no problem at present. |
Just to make things clear, you have unexplained behaviour with SOEM and yourself programmed MAC driver. When something does not work properly, do you suspect SOEM or your driver? It is not simple to make a robust packet driver, mistakes are easily made. The propagation delay calculation is simple and robust, it just reads data directly from ESC hardware. When this fails then there is most likely a communication failure between SOEM and the slave. Therefore I suspect either your driver or the cabling. I would suggest to test your code on a standard Linux system with unmodified SOEM. Then you can also see the results with Wireshark. When that works transfer the code to your ZYNQ system and work out the bugs. |
Yes, in the Windows environment, I use the unmodified SOEM to execute slavainfo, and I can correctly get the delay of slave2 to be 720ns. I think there is a problem with my MAC driver, thank you for your reply, you provided me with an excellent idea to solve the problem. |
my app code:
SOEM_Task.txt
Question 1
When I use the
ecx_configdc
function in the originalethercatdc.c
file, I will use it in the application codeec_FPRD(ec_slave[2].configadr, ECT_REG_DCSYSDIFF, sizeof(diff_time_2), &diff_time_2, EC_TIMEOUTRET);
When I read a large value, it is about 1.2 seconds in seconds, so I had to rewrite the
ecx_configdc
function as follows:After modification, a relatively small diff_time can be read in the application code, about within 50ns
Question 2
When I use the same sync_shift, there is a phase difference of about 700ns between the sync0 signals of the two slave stations. The phase difference can only be achieved by manually adjusting the sync_shift of different slave stations, as shown in the following figure:
I wonder if this is reasonable? Is there a way to make it align itself while setting the same sync0 shift? In addition, I can see in the packet capture file of TwinCAT that the value set by TwinCAT for the sync0 start time of the two slave stations is exactly the same
The text was updated successfully, but these errors were encountered: