ESP32 KSZ8863 Simple Switch Example Error

PKCubed
Posts: 3
Joined: Thu Aug 07, 2025 4:00 pm

ESP32 KSZ8863 Simple Switch Example Error

Postby PKCubed » Wed Aug 20, 2025 5:35 pm

I'm using an ESP32-WROVER-E module with the KSZ8863 chip to give my ESP32 an Ethernet interface while also allowing my device to be daisy-chained to other devices. At first, I was testing the KSZ8863 with this breadboard mess.

Image

I followed the schematic from the KSZ8863 ESP-IDF library example here: https://github.com/espressif/esp-eth-dr ... 863RLL.pdf with a few changes. For one thing, I'm using an external 50MHz oscillator and I wired it according to the datasheet for the KSZ8863 for clocking mode 4. With the breadboard circuit, after some troubleshooting, I got the I2C connection to the ESP32 to work, intermittently. For a little while after a reset, it would be able to detect when the Ethernet port was connected, and send that over the I2C interface. After a while, it would start throwing errors. I'm blaming the messy breadboard, but I'm not sure that is the problem as I've never had issues with long wires for I2C before. I only had one Ethernet jack wired, and when I plugged in a cable with a computer on the other end, the link light would light up, and start flashing wildly without stopping. Wireshark didn't show anything special. When I disconnected the cable, the lights stayed on forever, and the I2C never sent a disconnection message.

Anyway, now my PCB has arrived, and I've populated all the Ethernet related components. I did order a couple of the wrong values, so those have been replaced by through-hole resistors for this prototype.

Image

This is the schematic for the PCB I designed: https://drive.google.com/file/d/1lTv22X ... sp=sharing

I'm running the simple switch example here: https://github.com/espressif/esp-eth-dr ... ple_switch

This is the error I'm getting:

Code: Select all

E (376) i2c.master: I2C hardware NACK detected
I ran the Arduino I2C scan program, and after adding a few lines to keep the KSZ8863's reset line high, it found the chip on the I2C bus at 0x5F as it should.

Thanks for any help! :D

Sprite
Espressif staff
Espressif staff
Posts: 10599
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 KSZ8863 Simple Switch Example Error

Postby Sprite » Thu Aug 21, 2025 1:42 am

Do you have an oscilloscope so you can take a better look at those I2C lines?

PKCubed
Posts: 3
Joined: Thu Aug 07, 2025 4:00 pm

Re: ESP32 KSZ8863 Simple Switch Example Error

Postby PKCubed » Fri Aug 22, 2025 5:08 pm

Actually, I've figured it out. I had the I2C lines running next to the 50MHz clock, and that induced enough 50MHz "noise" onto the I2C lines, (about 1v peak to peak in amplitude), to make the KSZ8863 Ethernet switch unable to differentiate between the actual 1s and 0s. Next revision will be a 4 layer board rather than 2, with a better, proper shield around the 50MHz lines.

Sprite
Espressif staff
Espressif staff
Posts: 10599
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32 KSZ8863 Simple Switch Example Error

Postby Sprite » Mon Aug 25, 2025 2:24 am

If you need to hack it to make it work, some capacitors of a few (tens of) pF from the I2C lines to ground will help. (They'll form a RC filter combined with the pullups that filters out the 50MHz but not the lower-frequency I2C signals.)

Who is online

Users browsing this forum: Bing [Bot], PerplexityBot and 8 guests