XMC4800 EtherCAT high speed sync event

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User11870
Level 1
Level 1
First like given 5 replies posted Welcome!
Hello,
I am using xmc4800 chip for bldc etherrcat driver. The DC sync0 is enable in this project.
When I control the slave with dc sync0 enable by ethercat master, it works only if the sync0 cycle time is larger than 500us (<=2khz). What paramater which I can change to obtain high speed dc sync event?
Thank you!
0 Likes
6 Replies
MichaelIFX
Employee
Employee
50 replies posted 25 replies posted 10 replies posted
Hi Mophong,
I've just reviewed the behaviour and did not find any issue.

So first i have addad a DIGITAL_IO output APP and assigned pin 2.14 to this APP on the XMC4300 Relax Kit.
This pin I toggle inside APPL_Application of the example application:
void APPL_Application(void)
{

process_app(&OUT_GENERIC0x7000,&IN_GENERIC0x6000);
DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0);
}

After copying the xml-file to the PLC, I restart TwinCAT and rescan the bus.

I've implemented a small PLC-program with two boolean variables which I assign a button as input (IN_GENERIC/IN_GEN_Bit1) and LED1 as output (OUT_GENERIC/OUT_GEN_Bit1)
Basically I just toggle the LED in the PLC-program. However the cycle time I monitor on the P2.14. So the LED is just nice to have as a visual indicator.

After enabling DC-sync:
2612.attach

Setting cycle time of base cycle to e.g. 125us:
2614.attach

Setting 1 cycle for your task:
2613.attach

I see on the oscilloscope the 125us cycle time of the pin-toggling:
2615.attach

The cycle time of the device is limited by the default setting for the SSC code generation inside the SSC-Tool.
By default this limitation is set to 125us. But this default value you can modify to your specific limitations (processing time).
As I do not really process anything, I have adjusted it to a value below 50us. With this setting, you can also set the cycle time to 50us inside TwinCAT without problem:
2616.attach

Could you please point out in detail at which point this fails for you?

Thanks

Michael
0 Likes
User11870
Level 1
Level 1
First like given 5 replies posted Welcome!
Hello MichaelIFX ,
Thank you for your replying and sorry for late.
I has checked and found that the problem is due to variable 'MIN_PD_CYCLE_TIME', by default is is set 500us so I can't use DC at higher 2kHz. Your replying is very useful.
Regards,
0 Likes
Not applicable
Hi Michael,
I have some questions as mophong, When I control the slave with dc sync0 enable by ethercat master, it works only if the sync0 cycle time is larger than 500us (<=2khz).
I modify the MIN_PD_CYCLE_TIME,What is the mean about "After copying the xml-file to the PLC, I restart TwinCAT and rescan the bus."
Thanks!
Yang
0 Likes
User19397
Level 1
Level 1
Hi,Michael。

I followed the user guide to develop the xmc4300 relax ethercat kit,and the default setting of the MIN_PD_CYCLE_TIME is 125us。
but I still can‘t request op state when the cycletime is less than 500us。
Can you give some advice?

Thanks
Wade
0 Likes
MichaelIFX
Employee
Employee
50 replies posted 25 replies posted 10 replies posted
Dear Wade,
just as described inside this thread here, I could set the cycle time to 125us without a problem when setting up a task inside the TwinCAT-Host and started this task with distributed clock.

Still be aware about the implemenbtation specific limitations described here:
https://www.infineonforums.com/threads/12208-XMC4300-Ethercat-slave-can-t-change-to-op-state-when-th...

Please measure the time consumed in the mentioned functions to check if it is possible to work.

Kind Regards

Michael

Edit: I do not remember the details anymore of executing the test at that time, but what I could imagine that I have enabled full optimization of the code to reduce runtime to the lowest time possible.
Even it worked for me at that time, still 125us are quite challenging to implement more complex tasks than simple I/O switching inside process_app. Such short cycle times for my understanding are also quite uncommon.
0 Likes
User22058
Level 1
Level 1
For those who struggled with this problem like me, make sure you use a proper Ethercat master. Using my laptop with a Realtek network adapter, I could not get a sync at cycle times less than 1ms, the slave stack would keep reporting SM event missed and drop to SAFE PREOP. Twincat also reports high level of lost frames no matter the cycle times. So I did some investigation in Wireshark and it seems that the network adapter was not transmitting periodically but in bursts, meaning some frames were being transmitted faster or slower than others which is bad for DC.

So i switched to dedicated Beckhoff IPC and all my problems went away, even managed to get DC sync at 50us cycle time. Just make sure your MIN_PD_CYCLE_TIME is set lower than the default 125us.
0 Likes