EtherCAT on XMC4300

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

cross mob
lock attach
Attachments are accessible only for community members.
User21273
Level 1
Level 1
Welcome! First question asked First reply posted
Hello,
I’m developing new device, which is based on XMC4300 (our custom PCB) and should work as EtherCAT slave. I’m experiencing problem while trying to run EtherCAT: Master doesn’t receive any frames (neither EtherCAT nor Ethernet) from Slave, while a link is active and TwinCAT is running as Master.
On Master side I can observe frames with Wireshark and I can see only Master frames. On Slave side I can observe transmissions on both RXD and TXD on MII bus.

Master frames seems to be all right on Ethernet side, while Slave frames are all shown as transmit error (H group of 4B/5B decoding). Please find those measurements in attach. Ethernet LEDs are blinking as expected. EtherCAT ERR LEDs blinks on start, then ERR and RUN LEDs stay both off.

I’ve already checked things listed below:
1. Bootstrap-in configuration of KSZ8081MLX seems to be ok. For Port 0 it is: Strap to PHY Address 0, Broadcast Off, MII mode, enabled auto-negotation.
2. KSZ8081MLX status seems to be ok: Normal operation, 100Mbps, Full-duplex, link is up.
3. On EtherCAT: RX_ERR_COUNTp, FWD_RX_ERR_COUNTp, ECAT_PROC_ERR_COUNT, LOST_LINK_COUNTp are all 0x00
4. EtherCAT status:
a. PDI operational/EEPROM loaded correctly – yes
b. Enhanced Link detection – yes
c. Physical link on Port 0 – yes
d. Communication on Port 0 – yes
e. Loop Port 0 – yes
f. Actual State – Init State
5. Turning on Remote Loopback on KSZ8081MLX – I can see all of the Master frames come back properly to Master, so I’m pretty sure that the problem isn’t in the electrical part or with Ethernet connection.

Description of bench and device under development:
Master is laptop with Intel I217 NIC (compatible with TwinCAT-Intel PCI Ethernet Adapter driver). TwinCAT 3 and TwinCAT drivers installs properly. Master works fine with Infineon development board – XMC4800 EtherCAT Relax Kit. Slave can be discovered by scanning and it communicates in Free Run State. I’ve also tested it with other EtherCAT slaves, so I’m pretty sure that Master and cabling are working properly.
My board is based on XMC4300 and KSZ8081MLX as PHY transceivers. I’ve attached schematic of EtherCAT part. XMC4300 has software based on example XMC4300 EtherCAT Relax Kit V3.3 (SSC generated as described in documentation, software patched using patch attached to example). The only differences is that I had to change KSZ8081MLX LED0 functionality from Link/Active to Link to comply EtherCAT Slave requirements for link detection. I’m also reading PHY registers for debug purposes.
So far, I’ve found only small mistake on PCB - there should be Px_LED0_ACT and Px_LED0/NWAYEN connected to RJ45 LEDs instead od Px_LED0_ACT and Px_LED1/SPEED, but it shouldn’t matter for Slave. I’ve checked shape of signals on MII bus and they seems to be good enough. But to be sure, I’ve also checked different values of R322, R326, R327, even I’ve removed all of them – nothing has changed. I’ve also tried to change TX_SHIFT manually (even with P0_TXC disconnected), but again – nothing has changed.

Main function looks like:
int main(void)
{
DAVE_STATUS_t status;
uint16_t data;
initialise_monitor_handles();

status = DAVE_Init(); /* Initialization of DAVE APPs */
XMC_ECAT_WritePhy(0x00, 0x1F, 0x8010);
XMC_ECAT_WritePhy(0x01, 0x1F, 0x8010);

for(int i = 0; i < 50000000; i++)
{
asm("NOP");
}

for(int i = 0; i <= 0x1F; i++)
{
XMC_ECAT_ReadPhy(0x00, i, &data);
XMC_DEBUG("0x%02X: %04X\n", i, data);
}

Init_ECAT_Adapt_LED (); /* Initialize the ports which drive LEDs on EtherCat shield*/
Init_Relax_Button(); /* Initialize buttons on XMC4800 */

if(status == DAVE_STATUS_FAILURE)
{
XMC_DEBUG("DAVE APPs initialization failed\n");
while(1U)
{
}
}

while(1U)
{
MainLoop();
}
}


Of course software contains rest of necessary parts (Slave Stack generated by SSC Tool, SYNCxIRQHanlder, process_app, etc.).

I’ve stucked and don’t have any other ideas, how to make it working. I would really appreciate for any advices.
0 Likes
1 Solution
User21273
Level 1
Level 1
Welcome! First question asked First reply posted
Hello!
It is solved.
The problem was R317 and R319 on my schematic (pull up of pin 44 of KSZ8081MLX - TEST pin for NAND-Tree). After removing them - everything started working.
I misunderstund KSZ8081MLX datasheet. I wanted to implement NAND-Tree functionality for improve reliability - I was planning to test all connections between XMC4300 and KSZ8081MLXs at the beginning. To achieve this functionality it is necessary to add pull-up resistor to pin 44 (TEST pin).
Unfortunatelly I didn't understood that it won't be working in normal conditions with this pull-up resistor.

"Perfect is the enemy of good"...

4995.attach

View solution in original post

0 Likes
2 Replies
User21273
Level 1
Level 1
Welcome! First question asked First reply posted
Hello again,
I made additional measurements on MII bus with logic analyzer and data seems to be valid - Preamble, SFD and Data are being properly recognized by bus decoder. I've checked and decoded also some frames received from Master and frames sent by Slave and I can't see anything improper.
I've checked also RX/TX setup timings - it is 15ns and hold timings - it is 25ns, so it seems to be within the limits.
But still Master doesn't receive frame from Slave.
0 Likes
User21273
Level 1
Level 1
Welcome! First question asked First reply posted
Hello!
It is solved.
The problem was R317 and R319 on my schematic (pull up of pin 44 of KSZ8081MLX - TEST pin for NAND-Tree). After removing them - everything started working.
I misunderstund KSZ8081MLX datasheet. I wanted to implement NAND-Tree functionality for improve reliability - I was planning to test all connections between XMC4300 and KSZ8081MLXs at the beginning. To achieve this functionality it is necessary to add pull-up resistor to pin 44 (TEST pin).
Unfortunatelly I didn't understood that it won't be working in normal conditions with this pull-up resistor.

"Perfect is the enemy of good"...

4995.attach
0 Likes