mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-18 06:35:35 +03:00
feat(esp_eth): removed SPI Ethernet and PHY drivers from IDF
This commit is contained in:
@@ -305,15 +305,13 @@ The Ethernet driver is implemented in an Object-Oriented style. Any operation on
|
||||
phy_config.phy_addr = CONFIG_ETHERNET_PHY_ADDR; // alter the PHY address according to your board design
|
||||
phy_config.reset_gpio_num = CONFIG_ETHERNET_PHY_RST_GPIO; // alter the GPIO used for PHY reset
|
||||
esp_eth_phy_t *phy = esp_eth_phy_new_generic(&phy_config); // create generic PHY instance
|
||||
// ESP-IDF officially supports several different specific Ethernet PHY chip driver
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||
|
||||
.. note::
|
||||
Any Ethernet PHY chip compliant with IEEE 802.3 can be used when creating new PHY instance with :cpp:func:`esp_eth_phy_new_generic`. However, while basic functionality should always work, some specific features might be limited, even if the PHY meets IEEE 802.3 standard. A typical example is loopback functionality, where certain PHYs may require setting a specific speed mode to operate correctly. If this is the concern and you need PHY driver specifically tailored to your chip needs, use drivers for PHY chips the ESP-IDF already officially supports or consult with :ref:`Custom PHY Driver <custom-phy-driver>` section to create a new custom driver.
|
||||
|
||||
.. tip::
|
||||
Espressif provides drivers for several specific Ethernet PHY chips in the `esp-eth-drivers <https://github.com/espressif/esp-eth-drivers>`_ repository. Drivers are distributed as components and are available in the `ESP Component Registry <https://components.espressif.com/>`_.
|
||||
|
||||
Optional Runtime MAC Clock Configuration
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -329,7 +327,7 @@ The Ethernet driver is implemented in an Object-Oriented style. Any operation on
|
||||
|
||||
esp32_emac_config.interface = EMAC_DATA_INTERFACE_RMII; // alter EMAC Data Interface
|
||||
esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_OUT; // select EMAC REF_CLK mode
|
||||
esp32_emac_config.clock_config.rmii.clock_gpio = EMAC_CLK_OUT_GPIO; // select GPIO number used to input/output EMAC REF_CLK
|
||||
esp32_emac_config.clock_config.rmii.clock_gpio = 17; // select GPIO number used to input/output EMAC REF_CLK
|
||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // create MAC instance
|
||||
|
||||
|
||||
@@ -375,6 +373,8 @@ SPI-Ethernet Module
|
||||
|
||||
* The SPI device configuration (i.e., `spi_device_interface_config_t`) may slightly differ for other Ethernet modules or to meet SPI timing on specific PCB. Please check out your module's specs and the examples in ESP-IDF.
|
||||
|
||||
.. tip::
|
||||
Espressif provides drivers for various SPI-Ethernet modules in the `esp-eth-drivers <https://github.com/espressif/esp-eth-drivers>`_ repository. Drivers are distributed as components and are available in the `ESP Component Registry <https://components.espressif.com/>`_.
|
||||
|
||||
Install Driver
|
||||
--------------
|
||||
@@ -383,7 +383,7 @@ To install the Ethernet driver, we need to combine the instance of MAC and PHY a
|
||||
|
||||
* :cpp:member:`esp_eth_config_t::mac`: instance that created from MAC generator (e.g., :cpp:func:`esp_eth_mac_new_esp32`).
|
||||
|
||||
* :cpp:member:`esp_eth_config_t::phy`: instance that created from PHY generator (e.g., :cpp:func:`esp_eth_phy_new_ip101`).
|
||||
* :cpp:member:`esp_eth_config_t::phy`: instance that created from PHY generator (e.g., :cpp:func:`esp_eth_phy_new_generic`).
|
||||
|
||||
* :cpp:member:`esp_eth_config_t::check_link_period_ms`: Ethernet driver starts an OS timer to check the link status periodically, this field is used to set the interval, in milliseconds.
|
||||
|
||||
@@ -644,11 +644,11 @@ The majority of PHY management functionality required by the ESP-IDF Ethernet dr
|
||||
|
||||
**Steps to create a custom PHY driver:**
|
||||
|
||||
1. Define vendor-specific registry layout based on the PHY datasheet. See :component_file:`esp_eth/src/phy/esp_eth_phy_ip101.c` as an example.
|
||||
1. Define vendor-specific registry layout based on the PHY datasheet.
|
||||
2. Prepare derived PHY management object info structure which:
|
||||
|
||||
* must contain at least parent IEEE 802.3 :cpp:class:`phy_802_3_t` object
|
||||
* optionally contain additional variables needed to support non-IEEE 802.3 or customized functionality. See :component_file:`esp_eth/src/phy/esp_eth_phy_ksz80xx.c` as an example.
|
||||
* optionally contain additional variables needed to support non-IEEE 802.3 or customized functionality.
|
||||
|
||||
3. Define chip-specific management call-back functions.
|
||||
4. Initialize parent IEEE 802.3 object and re-assign chip-specific management call-back functions.
|
||||
|
||||
@@ -43,6 +43,32 @@ Removed the following RMII clock Kconfig options from `components/esp_eth`. Cloc
|
||||
**Impact**: Applications using ``ETH_ESP32_EMAC_DEFAULT_CONFIG()`` continue to work. Custom clock configurations must be set explicitly in the EMAC config structure or use the `Ethernet Init component <https://components.espressif.com/components/espressif/ethernet_init>`_.
|
||||
|
||||
|
||||
Ethernet PHY and Ethernet SPI Module drivers are moved from ESP-IDF to external repo
|
||||
------------------------------------------------------------------------------------
|
||||
|
||||
The Ethernet PHY and Ethernet SPI Module drivers have been removed from ESP-IDF and have been migrated to `esp-eth-drivers <https://github.com/espressif/esp-eth-drivers>`_ repository. If you are using these drivers, you need to use the drivers as component in your project. The drivers are now available in the `ESP Component Registry <https://components.espressif.com/>`_.
|
||||
|
||||
**Removed APIs**:
|
||||
- :cpp:func:`esp_eth_phy_new_ip101`
|
||||
- :cpp:func:`esp_eth_phy_new_lan87xx`
|
||||
- :cpp:func:`esp_eth_phy_new_rtl8201`
|
||||
- :cpp:func:`esp_eth_phy_new_dp83848`
|
||||
- :cpp:func:`esp_eth_phy_new_ksz80xx`
|
||||
- :cpp:func:`esp_eth_mac_new_dm9051`
|
||||
- :cpp:func:`esp_eth_phy_new_dm9051`
|
||||
- :cpp:func:`esp_eth_mac_new_ksz8851snl`
|
||||
- :cpp:func:`esp_eth_phy_new_ksz8851snl`
|
||||
- :cpp:func:`esp_eth_mac_new_w5500`
|
||||
- :cpp:func:`esp_eth_phy_new_w5500`
|
||||
|
||||
|
||||
**Impact**: Applications using Ethernet PHY and Ethernet SPI Module drivers that used to be part of ESP-IDF will no longer work.
|
||||
|
||||
**Migration**:
|
||||
|
||||
Add driver component from `IDF Component Manager <https://components.espressif.com/>`_ to your project using `idf.py add-dependency` and include `esp_eth_phy_xxxx.h` and `esp_eth_mac_xxxx.h` or use the `Ethernet Init component <https://components.espressif.com/components/espressif/ethernet_init>`_.
|
||||
|
||||
|
||||
ESP-NETIF
|
||||
*********
|
||||
|
||||
|
||||
@@ -305,15 +305,13 @@ ESP-IDF 在宏 :c:macro:`ETH_MAC_DEFAULT_CONFIG` 和 :c:macro:`ETH_PHY_DEFAULT_C
|
||||
phy_config.phy_addr = CONFIG_ETHERNET_PHY_ADDR; // 根据开发板设计更改 PHY 地址
|
||||
phy_config.reset_gpio_num = CONFIG_ETHERNET_PHY_RST_GPIO; // 更改用于 PHY 复位的 GPIO
|
||||
esp_eth_phy_t *phy = esp_eth_phy_new_generic(&phy_config); // 创建通用 PHY 实例
|
||||
// ESP-IDF 为数种特定以太网 PHY 芯片驱动提供官方支持
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config);
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config);
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config);
|
||||
// esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config);
|
||||
|
||||
.. note::
|
||||
使用 :cpp:func:`esp_eth_phy_new_generic` 创建新的 PHY 实例时,可以使用任何符合 IEEE 802.3 标准的以太网 PHY 芯片。然而,尽管 PHY 芯片符合 IEEE 802.3 标准,能提供基本功能,但某些特定的功能可能无法完全实现。例如,某些以太网 PHY 芯片可能需要配置特定的速度模式才能启用环回功能。遇到这种情况,需要配置 PHY 驱动程序以满足特定芯片需求,请使用 ESP-IDF 官方支持的 PHY 芯片驱动程序,或参阅 :ref:`Custom PHY Driver <custom-phy-driver>` 小节以创建新的自定义驱动程序。
|
||||
|
||||
.. tip::
|
||||
乐鑫为多种特定的以太网 PHY 芯片提供了驱动程序,这些驱动程序可在 `esp-eth-drivers <https://github.com/espressif/esp-eth-drivers>`_ 仓库中获取。驱动以组件形式分发,并可在 `ESP 组件库 <https://components.espressif.com/>`_ 上获取。
|
||||
|
||||
可选的运行时 MAC 时钟配置
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -329,7 +327,7 @@ ESP-IDF 在宏 :c:macro:`ETH_MAC_DEFAULT_CONFIG` 和 :c:macro:`ETH_PHY_DEFAULT_C
|
||||
|
||||
esp32_emac_config.interface = EMAC_DATA_INTERFACE_RMII; // 更改 EMAC 数据接口
|
||||
esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_OUT; // 配置 EMAC REF_CLK 模式
|
||||
esp32_emac_config.clock_config.rmii.clock_gpio = EMAC_CLK_OUT_GPIO; // 配置用于输入/输出 EMAC REF_CLK 的 GPIO 编号
|
||||
esp32_emac_config.clock_config.rmii.clock_gpio = 17; // 配置用于输入/输出 EMAC REF_CLK 的 GPIO 编号
|
||||
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); // 创建 MAC 实例
|
||||
|
||||
|
||||
@@ -375,6 +373,8 @@ SPI-Ethernet 模块
|
||||
|
||||
* 针对不同的以太网模块,或是为了满足特定 PCB 上的 SPI 时序,SPI 从机设备配置(即 `spi_device_interface_config_t`)可能略有不同。具体配置请查看模块规格以及 ESP-IDF 中的示例。
|
||||
|
||||
.. tip::
|
||||
乐鑫为多种 SPI-Ethernet 模块提供了驱动程序,这些驱动程序可在 `esp-eth-drivers <https://github.com/espressif/esp-eth-drivers>`_ 仓库中获取。驱动以组件形式分发,并可在 `ESP 组件库 <https://components.espressif.com/>`_ 上获取。
|
||||
|
||||
安装驱动程序
|
||||
--------------
|
||||
@@ -383,7 +383,7 @@ SPI-Ethernet 模块
|
||||
|
||||
* :cpp:member:`esp_eth_config_t::mac`:由 MAC 生成器创建的实例(例如 :cpp:func:`esp_eth_mac_new_esp32`)。
|
||||
|
||||
* :cpp:member:`esp_eth_config_t::phy`:由 PHY 生成器创建的实例(例如 :cpp:func:`esp_eth_phy_new_ip101`)。
|
||||
* :cpp:member:`esp_eth_config_t::phy`:由 PHY 生成器创建的实例(例如 :cpp:func:`esp_eth_phy_new_generic`)。
|
||||
|
||||
* :cpp:member:`esp_eth_config_t::check_link_period_ms`:以太网驱动程序会启用操作系统定时器来定期检查链接状态。该字段用于设置间隔时间,单位为毫秒。
|
||||
|
||||
@@ -644,11 +644,11 @@ ESP-IDF 以太网驱动程序所需的大部分 PHY 管理功能都已涵盖在
|
||||
|
||||
**创建自定义 PHY 驱动程序的步骤:**
|
||||
|
||||
1. 请根据 PHY 数据手册,定义针对供应商的特定注册表布局。示例请参见 :component_file:`esp_eth/src/phy/esp_eth_phy_ip101.c`。
|
||||
1. 请根据 PHY 数据手册,定义厂家私有的寄存器。
|
||||
2. 准备衍生的 PHY 管理对象信息结构,该结构:
|
||||
|
||||
* 必须至少包含 IEEE 802.3 :cpp:class:`phy_802_3_t` 父对象
|
||||
* 可选择包含额外的变量,以支持非 IEEE 802.3 或定制功能。示例请参见 :component_file:`esp_eth/src/phy/esp_eth_phy_ksz80xx.c`。
|
||||
* 可选择包含额外的变量,以支持非 IEEE 802.3 或定制功能。
|
||||
|
||||
3. 定义针对芯片的特定管理回调功能。
|
||||
4. 初始化 IEEE 802.3 父对象并重新分配针对芯片的特定管理回调功能。
|
||||
|
||||
@@ -43,6 +43,32 @@
|
||||
**影响**:使用 ``ETH_ESP32_EMAC_DEFAULT_CONFIG()`` 的应用程序可继续正常工作。自定义时钟配置需在 EMAC 配置结构体中显式设置,或使用 `Ethernet Init 组件 <https://components.espressif.com/components/espressif/ethernet_init>`_。
|
||||
|
||||
|
||||
以太网 PHY 和以太网 SPI 模块驱动已从 ESP-IDF 移至外部仓库
|
||||
-------------------------------------------------------------
|
||||
|
||||
以太网 PHY 和以太网 SPI 模块驱动已从 ESP-IDF 中移除,并迁移至 `esp-eth-drivers <https://github.com/espressif/esp-eth-drivers>`_ 仓库。如果你在项目中使用这些驱动,需要将其作为组件集成。相关驱动现已在 `ESP 组件库 <https://components.espressif.com/>`_ 上提供。
|
||||
|
||||
**移除的 API**:
|
||||
- :cpp:func:`esp_eth_phy_new_ip101`
|
||||
- :cpp:func:`esp_eth_phy_new_lan87xx`
|
||||
- :cpp:func:`esp_eth_phy_new_rtl8201`
|
||||
- :cpp:func:`esp_eth_phy_new_dp83848`
|
||||
- :cpp:func:`esp_eth_phy_new_ksz80xx`
|
||||
- :cpp:func:`esp_eth_mac_new_dm9051`
|
||||
- :cpp:func:`esp_eth_phy_new_dm9051`
|
||||
- :cpp:func:`esp_eth_mac_new_ksz8851snl`
|
||||
- :cpp:func:`esp_eth_phy_new_ksz8851snl`
|
||||
- :cpp:func:`esp_eth_mac_new_w5500`
|
||||
- :cpp:func:`esp_eth_phy_new_w5500`
|
||||
|
||||
|
||||
**影响**:原本依赖 ESP-IDF 内置以太网 PHY 和以太网 SPI 模块驱动的应用将无法继续工作。
|
||||
|
||||
**迁移方式**:
|
||||
|
||||
请通过 `idf.py add-dependency` 命令,从 `IDF 组件管理器 <https://components.espressif.com/>`_ 添加驱动组件到你的项目,并包含相应的 `esp_eth_phy_xxxx.h` 和 `esp_eth_mac_xxxx.h` 头文件,或使用 `Ethernet Init 组件 <https://components.espressif.com/components/espressif/ethernet_init>`_。
|
||||
|
||||
|
||||
ESP-NETIF
|
||||
*********
|
||||
|
||||
|
||||
Reference in New Issue
Block a user