very low ethernet speed using ksz8863 on ESP32D0W

droman
Posts: 8
Joined: Tue May 17, 2022 10:12 am

very low ethernet speed using ksz8863 on ESP32D0W

Postby droman » Thu Sep 29, 2022 2:09 pm

Hello. We faced some difficulties while we tried to send data through ethernet using the official driver for ksz8863 chip (https://github.com/espressif/esp-eth-dr ... er/ksz8863 ). The transmission speed is very low, ~13KB/s, that's incredibly low bandwidth. For this setup we connected the 50 MHz clock to GPIO_16 and set ETH_RMII_CLK_MODE to ETH_RMII_CLK_OUTPUT. We also set ksz8863_p3_rmii_internal_clk to true. We used the examples of the drivers source as the basis for our code.

We also tried to change the hardware to ETH_RMII_CLK_INPUT but then it returned a "reset timeout" error.
We tried different things (a little bit blindly) like inverting the P3 clock, setting the p3_rmii_internal_clk to false and so but anything we did worked.

Do someone had similar problems with ksz8863 chip or something similar or have some idea about how to debug it?

Thank you very much

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

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby ESP_ondrej » Mon Oct 03, 2022 6:18 am

Could you please provide more details to reproduce the issue?

Which example do you use?

How did you test the throughput?

What is you network topology?
The transmission speed is very low,
In which direction? I mean, are you trying to transmit from ESP32 or from one end node to another?

droman
Posts: 8
Joined: Tue May 17, 2022 10:12 am

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby droman » Mon Oct 03, 2022 2:46 pm

I followed simple_switch example (https://github.com/espressif/esp-eth-dr ... ple_switch). For the throughput I sent a 5 KB buffer to the ESP and receive the same buffer from the ESP and then I calculate how many time it take and calculate the throughput.

The ESP is connected to a switch. It's also important to note that when I used the ESP system as a switch (ie: I connect the ESP and a PC to a switch and then I connect another PC to the ESP which act like a switch and run iperf between the two PC) the throughput is as expected (12 MB/s)

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

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby ESP_ondrej » Mon Oct 03, 2022 4:51 pm

It is still not enough information to make any conclusion...
I followed simple_switch example (https://github.com/espressif/esp-eth-dr ... ple_switch). For the throughput I sent a 5 KB buffer to the ESP and receive the same buffer from the ESP and then I calculate how many time it take and calculate the throughput.
Did you create some kind of echo server? What protocol do you use? How is it implemented?
The ESP is connected to a switch
So, one ESP32 Ethernet port is connected to the switch and the other one is unconnected?

droman
Posts: 8
Joined: Tue May 17, 2022 10:12 am

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby droman » Tue Oct 04, 2022 7:34 am

Sorry, I thought that if someone had similar problems that information will be enough. Yes I created an echo server using TCP sockets, the server reads the number of bytes to read and then reads that number of bytes. When testing the same using a different hardware it works properly so I don't really think it's very relevant that information.

Yes, we thought that for testing this problem it will be better to only connect one ethernet port.

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

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby ESP_ondrej » Tue Oct 04, 2022 12:08 pm

I thought that if someone had similar problems that information will be enough.
Well, I need to know all details to make any conclusion. I just cannot make any assumptions since it time to time happens that reporters do not report real issue. They might overlook something or make some silly mistake. It happens to everybody and I am not an exception.

Anyway, I modified "Basic switch" example and ran TCP iperf. I got results of ~36 Mbits/s which is OK. So there should not be an issue in driver. Since you claim that your SW works well on other hardware, let's check your design. You mentioned, that RMII CLK is generated by ESP32, right? Therefore, it sounds strange you set ksz8863_p3_rmii_internal_clk to true. Please check your RMII Clock Configuration Modes and properly configure it based on http://ww1.microchip.com/downloads/en/D ... 03048A.pdf (Section 6.1.1)

I shared our test board reference design, please check at https://github.com/espressif/esp-eth-dr ... 863RLL.pdf

You can also try to run the iperf. Please find my changes at https://github.com/kostaond/esp-idf/tre ... 8863_iperf. Update lines 206-214 per your actual hardware needs.

If nothing does help, you can share your HW design and code.

droman
Posts: 8
Joined: Tue May 17, 2022 10:12 am

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby droman » Tue Oct 11, 2022 8:37 am

Thank you very much for your response.

We tried with the iperf code you provided (changing the values of the I2C, P3 and so accordingly). My coworker, who develops the hardware part, have looked at the schematics and according to him we have almost the same schematics with the only difference we are using a 25 Mhz crystal instead of the 25 Mhz oscillator. If we configure it to output RMII clock from internal it is very slow (~0.03 Mb/s) but if we configure it to input RMII clock from external we have a reset timeout issue.

I attach the schematics we have of our system.
Attachments
ethernet.pdf
(879.38 KiB) Downloaded 184 times

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

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby ESP_ondrej » Tue Oct 11, 2022 12:50 pm

Why there is resistor with 49.9R value between REFCLKO_3 and REFCLKI_3? And why there is 1K pull-down?
Either:
- try to replace it 49.9R with 0R and desolder 1K. RMII REFCLK CONNECTION would be MODE 3 in this case and you should set ksz8863_p3_rmii_internal_clk to false.
- desolder 49.9R and keep the 1K (or better replace 1K with 10K). RMII REFCLK CONNECTION would be MODE 5 in this case and you should set ksz8863_p3_rmii_internal_clk to true.

Please consult with http://ww1.microchip.com/downloads/en/D ... 03048A.pdf

In general "reset timeout" error usually occurs when there is a problem with external clock. So you can also measure if CLK is present with oscilloscope at GPIO0.

droman
Posts: 8
Joined: Tue May 17, 2022 10:12 am

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby droman » Mon Oct 17, 2022 10:18 am

Hi. We removed the 49.9R and put a 0R instead. The pull-down is not currently soldered to the PCB in our board.

We tried both mode 5 and mode 3 as suggested (setting p3_rmii_internal_clk accordingly)
We also tested that CLK was present at GPI0 but without success.
The error we face change between a "reset timeout" and an I2C error when executing the software reset. In the later case the error message we get is the next:
W (763) ksz8863_eth: SW reset resets all Global, MAC and PHY registers!
E (763) ksz8863_ctrl_intf: ksz8863_i2c_write(77): I2C master command begin error
E (773) ksz8863_eth: ksz8863_sw_reset(142): write reset failed
E (773) ksz8863_init: ksz8863_board_specific_init(284): software reset failed
E (783) esp_eth: eth_on_state_changed(119): extra lowlevel init failed
E (803) esp.emac: emac_esp32_init(351): lowlevel init failed
E (803) esp_eth: esp_eth_driver_install(228): init mac failed
ESP_ERROR_CHECK failed: esp_err_t 0x107 (ESP_ERR_TIMEOUT) at 0x400d7f06

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

Re: very low ethernet speed using ksz8863 on ESP32D0W

Postby ESP_ondrej » Mon Oct 17, 2022 2:37 pm

We tried both mode 5 and mode 3 as suggested (setting p3_rmii_internal_clk accordingly)
Just for sure, you tried it along with hardware changes right?
We also tested that CLK was present at GPI0 but without success.
Does it mean, 50 MHz CKL was present but you still had timeout error?

Anyway, it is strange. It still seems to me you have trouble with CLK integrity at GPIO0. Could you please try to desolder the other 49.9 ohm resistor as shown in the figure and replace it with 0R
RMII_CLK_res.png
RMII_CLK_res.png (33.28 KiB) Viewed 2577 times
?

Who is online

Users browsing this forum: techtoys and 29 guests