Ethernet autonegotiation problem in ESP32C6

endi83
Posts: 24
Joined: Wed Nov 22, 2023 2:43 pm

Ethernet autonegotiation problem in ESP32C6

Postby endi83 » Wed Feb 14, 2024 10:27 am

I have an ESP32C6 and I want to have an ethernet connection to another device. I enable autonegotiation so that the ESP32C6 selects at which speed it has to work with respect to the connected device.

  1. (ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_AUTONEGO, &auto_nego_en));)

The device can work at 10Mbps or 100Mbps (depending on a setting).

The autonegotiation is always successful and sets the speed of the ESP32C6 always to 100Mbps because the connected device is capable of that speed, so the speed programmed in the ESP32C6 is sometimes not correct.

When the speed is not correct (ESP32C6 working at 100Mbps and the device at 10 Mbps) I have a latency of one second on average in the ping response.
How can I solve this problem?

liaifat85
Posts: 200
Joined: Wed Dec 06, 2023 2:46 pm

Re: Ethernet autonegotiation problem in ESP32C6

Postby liaifat85 » Thu Feb 15, 2024 3:28 pm

You can modify your code to manually set the speed to 10Mbps:

Code: Select all

esp_eth_autoneg_t auto_nego_en = 0; // Disable auto-negotiation
esp_eth_speed_t eth_speed = ETH_SPEED_10M; // Set speed to 10Mbps

// Set auto-negotiation status
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_AUTONEGO, &auto_nego_en));

// Set speed
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_SPEED, &eth_speed));

endi83
Posts: 24
Joined: Wed Nov 22, 2023 2:43 pm

Re: Ethernet autonegotiation problem in ESP32C6

Postby endi83 » Mon Feb 19, 2024 7:59 am

Thanks for the reply. The problem I have is that I would have to know how to detect what speed the connected device is at when I turn on my ESP32. I had thought about defaulting the ESP32 to a speed and if I see that the speed of my ESP32 and the device is not the same, change the speed of the ESP32 manually.

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

Re: Ethernet autonegotiation problem in ESP32C6

Postby ESP_ondrej » Mon Mar 04, 2024 9:15 am

What Ethernet module do you use? If auto-negotiation is enabled it should work out of the box.

Who is online

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