KSZ8863 Ethernet Driver (beta) failing in I2C client mode

derricksenva
Posts: 21
Joined: Tue Aug 02, 2022 8:19 pm

KSZ8863 Ethernet Driver (beta) failing in I2C client mode

Postby derricksenva » Tue Sep 24, 2024 7:52 pm

We're attempting to prototype the KSZ8863 Daughter Board with an ESP32-PICO-DevKitM-2. We started with the KSZ8863 Ethernet Driver (beta) and have made the following configurations/modifications:
  1. Configured the simple switch example for I2C client mode.
  2. Added an I2C write to the example code to configure the RMII for MAC mode (to interface with the ESP's RMII).
  3. Wired the RMII pins and reset pin.
  4. Placed the necessary components for a 25 MHz crystal to feed the KSZ8863.
  5. Placed a pull-down on P2LED1 and pull-up on P2LED0 for I2C client mode.
  6. Connected a GPIO from the ESP32 to EN_REFCLKO_3 to enable the clock at run time.
  7. Replaced I2C pull-ups with 4.7k Ω resistors per the schematic.
  8. Placed a pull-down resistor on REFCLKI_3 (since it's unused).
  9. Removed R21 so that X1 is not pulled down by the pull-down on REFCLKI_3.
  10. Soldered a wire to REFCLKO_3 (off of R22) to feed the ESP32's integrated Ethernet MAC.
  11. Removed R23 from SMTXD32 for the 25 MHz crystal configuration.
With this setup, KSZ8863's PHY/MAC 1 and 2 (with the RJ-45 connectors populated) work fine as a simple switch. I can connect other Ethernet devices on these two ports and it functions as expected across both ports. But, the RMII/I2C is having issues with the ESP32:
  1. Out of over 100 power-cycles/soft resets, the Ethernet/RMII between the ESP32 and KSZ8863 has worked only once (captured traffic from PHY 2 of the KSZ8863 via Wireshark).
  2. The KSZ8863 always fails to ACK any I2C communications when REFCLKO_3 is enabled. The analog captures of the I2C commands from the ESP32 look correct (most of the time). If REFCLKO_3 is disabled, the KSZ8863 responds fine to I2C commands. The analog captures look almost identical in either case. We require the RMII clock to be generated externally to feed the ESP32's RMII, so we need this to work.
  3. The I2C commands will occasionally generate nonsense traffic, and I suspect it's coming from the ESP32. For example, after the ESP32 generates a stop condition after receiving a NAK from the KSZ8663, it will generate another stop condition some time later.
  4. EN_REFCLKO_3 does not act as a strapping pin on reset (even though the KSZ8663 data sheet calls it one). The clock output is simply active when EN_REFCLKO_3 is high, and inactive (low) when driven low.
Is there an I2C issue with the ESP32 or KSZ8863? We are running jumper wires between both development boards that are about 8 inches long.

Why is the RMII from the ESP32 not working? I can see REFCLKO_3 is generating the 50 MHz clock properly after configuring the initial KSZ8633 registers, but then the EMAC_TXD0 and EMAC_TXD1 lines from the ESP32 stay low and do nothing (except for the one time they worked).

I've also posted this on the Microchip forums in case this is specifically a KSZ8863 issue.

Here are captures of the I2C communications working while REFCLKO_3 is disabled, and then failing after it's enabled. This happens almost every time.
2024-09-24 11_26_57-esp-idf.bat - python.exe  _C__Espressif_frameworks_esp-idf-v5.3.1_tools_idf.py_ .png
2024-09-24 11_26_57-esp-idf.bat - python.exe _C__Espressif_frameworks_esp-idf-v5.3.1_tools_idf.py_ .png (99.49 KiB) Viewed 1435 times
2024-09-24 11_33_41-Logic 2 [Logic 8 - Connected] [Session 0].png
2024-09-24 11_33_41-Logic 2 [Logic 8 - Connected] [Session 0].png (250.38 KiB) Viewed 1435 times
2024-09-24 11_32_59-Logic 2 [Logic 8 - Connected] [Session 0].png
2024-09-24 11_32_59-Logic 2 [Logic 8 - Connected] [Session 0].png (201.54 KiB) Viewed 1435 times
Last edited by derricksenva on Tue Sep 24, 2024 8:26 pm, edited 1 time in total.

derricksenva
Posts: 21
Joined: Tue Aug 02, 2022 8:19 pm

Re: KSZ8863 Ethernet Driver (beta) failing in I2C client mode

Postby derricksenva » Tue Sep 24, 2024 7:56 pm

I couldn't attach more photos in my original post, so here's a capture of the nonsense double stop condition after an address/command NAK.
2024-09-24 12_15_25-Logic 2 [Logic 8 - Connected] [I2C fail with REFCLKO_3].png
2024-09-24 12_15_25-Logic 2 [Logic 8 - Connected] [I2C fail with REFCLKO_3].png (231.55 KiB) Viewed 1429 times

Here is an Ethernet capture from Wireshark (monitored from KSZ8633's PHY 2) when it happened to run successfully one time. The RMII was working, but the I2C traffic was failing as usual (no ACKs from KSZ8663).
2024-09-24 11_49_28-ksz8863 p3 eth and i2c working.pcapng.png
2024-09-24 11_49_28-ksz8863 p3 eth and i2c working.pcapng.png (183.84 KiB) Viewed 1429 times
2024-09-24 12_55_24-Logic 2 [Logic 8 - Disconnected] [ksz8863 rmii ethernet working].png
2024-09-24 12_55_24-Logic 2 [Logic 8 - Disconnected] [ksz8863 rmii ethernet working].png (153.75 KiB) Viewed 1429 times

ESP_ondrej
Posts: 210
Joined: Fri May 07, 2021 10:35 am

Re: KSZ8863 Ethernet Driver (beta) failing in I2C client mode

Postby ESP_ondrej » Wed Sep 25, 2024 8:05 am

Hi, it seems to be more like a HW problem of your setup. 8 inches (~20 cm) long wires are too long. RMII CLK is 50 MHz so signal integrity is an concern, see https://resources.pcb.cadence.com/blog/ ... r-ethernet I have experience that ~5 cm log wires still work OK with RMII. Please try shorter wires. They should also have matching length. Soldering to pins is recommended since loose contacts may cause trouble as well.

Consider also double checking you follow https://github.com/espressif/esp-eth-dr ... 863RLL.pdf

ESP_ondrej
Posts: 210
Joined: Fri May 07, 2021 10:35 am

Re: KSZ8863 Ethernet Driver (beta) failing in I2C client mode

Postby ESP_ondrej » Wed Sep 25, 2024 8:09 am

Go over https://ww1.microchip.com/downloads/en/ ... 03048A.pdf, identify the clock mode you use in your HW setup and properly configure the example in Kconfig.

derricksenva
Posts: 21
Joined: Tue Aug 02, 2022 8:19 pm

Re: KSZ8863 Ethernet Driver (beta) failing in I2C client mode

Postby derricksenva » Wed Sep 25, 2024 9:14 pm

ESP_ondrej wrote:
Wed Sep 25, 2024 8:05 am
Hi, it seems to be more like a HW problem of your setup. 8 inches (~20 cm) long wires are too long. RMII CLK is 50 MHz so signal integrity is an concern, see https://resources.pcb.cadence.com/blog/ ... r-ethernet I have experience that ~5 cm log wires still work OK with RMII. Please try shorter wires. They should also have matching length. Soldering to pins is recommended since loose contacts may cause trouble as well.

Consider also double checking you follow https://github.com/espressif/esp-eth-dr ... 863RLL.pdf
Thanks for the response. We suspected this might be an issue. We'll try shortening the wires and do direct soldering. If that still has issues, we can probably look into a simple, custom layout for demo purposes as an intermediate step before doing our fully featured PCB layout.

We've also been referencing the two documents you cited but haven't found anything new after working on this for about two weeks now. We think the configuration is "mostly" correct since the I2C does work (but only with REFCLKO_3 disabled) and the RMII worked once (I'd expect it to work zero times if the configuration was incorrect).

Here's a more detailed breakdown of our setup. Pins on the same row are connected between the two boards. Maybe there's something obvious we're doing wrong here?
2024-09-25 14_11_12-BCM Firmware Notes.xlsx - Excel.png
2024-09-25 14_11_12-BCM Firmware Notes.xlsx - Excel.png (40.96 KiB) Viewed 1182 times

Who is online

Users browsing this forum: Bing [Bot] and 372 guests