ESP32 Ethernet: How to get current link speed
This is how you can get the current link speed of an Ethernet connection on the ESP32 using the ESP-IDF framework.
#include <esp_eth.h>
// Get link speed
eth_speed_t link_speed;
if (esp_eth_ioctl(eth_handle, ETH_CMD_G_SPEED, &link_speed) == ESP_OK) {
const char* speed_str = (link_speed == ETH_SPEED_10M) ? "10 Mbps" :
(link_speed == ETH_SPEED_100M) ? "100 Mbps" : "1000 Mbps";
ESP_LOGI(TAG, "Ethernet Speed: %s", speed_str);
}
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow