Open XBigRiceH opened 3 months ago
Note: currently using the free-run mode, lan9252 chip, normal spi@21Mbits/s
I then tried the same thing in the Ubuntu system, the result is much better but still not good. The delay between packets is reduced to ~0.04ms but I still need ~0.7ms to get an updated value in round-trip testing. After some measurement, I got each loop of ecat_slv() used ~0.4ms
When running in free-run mode the SOEM & SOES update loops are decoupled.
The picture below highlight that you would need to send frames at a faster rate than required. Also, the local application would need to run faster to be able to read data, run application, write data,
When running in free-run mode the SOEM & SOES update loops are decoupled.
The picture below highlight that you would need to send frames at a faster rate than required. Also, the local application would need to run faster to be able to read data, run application, write data,
Running decoupled is OK for me because I don't need any sync feature I just want to transport data as fast as they can. Does anyone ever measure the communication time of one read&write cycle using SPI? Because I think the slave will always read the latest data, so maybe the delay I find is totally caused by the slow communication speed?
The Microchip reference driver for lan9252 is quit slow, several places where you wait for completion.
Since you have a system up and running you can try to profile it? Either measure the time using a timer clock or use a physical GPIO and oscilloscope?
Today I tried to use ax58100, because its HW interface seems much faster than LAN9252, and the actual test results support this. Even if my PDO length increases to 96 bytes, the roundtrip time is still reduced to ~0.3ms.
However, I then used GPIO and logic signal analyzer to measure the time cost of SOES. The result shows the ecat_slv()
loop only costs ~71us, of which TXPDO write takes ~23us and RXPDO read takes ~21us, which is much less than the roundtrip time(~0.3ms = ~300us)...?
Note: Now using AX58100 by SPI@50M, SOEM running on Ubuntu22 with realtime-kernel. Wireshark shows the ECAT packet is sent every ~50us Note 2: Since I'm new to EtherCAT and spi protocols, I wanted to ask if someone may have measured the latency before for my reference because I'm unsure if I've messed something up.
My new PDO info:
#ifndef __UTYPES_H__
#define __UTYPES_H__
#include "cc.h"
/* Object dictionary storage */
typedef struct
{
/* Identity */
uint32_t serial;
/* Inputs */
uint64_t New_Array6000[8];
/* Outputs */
uint64_t New_Array7000[4];
/* Parameters */
uint8_t New_Array2000[128];
} _Objects;
extern _Objects Obj;
#endif /* __UTYPES_H__ */
My latency test result:
Green: one ecat_slv()
loop
Blue: one RXPDO_update()
loop
Purple: one TXPDO_update()
loop
Test method: Write one GPIO to High at the start and write it to LOW at the end
Hi there,
I'm currently using SOEM and SOES.
SOEM is running on my Windows laptop and SOES is running on stm32f407. When I test the round trip latency, I always need around 3ms to receive an updated value.
So I used Wireshark to find out what the problem was, and then I found that each packet from the slave had a 1ms delay between the last packet from the master.
I have no idea about what should I do next........What could be the reason for this?
The screenshot of Wireshark and my esi files are as follows: