ethernet: need to configure two PHYs over internal MAC, but send no data
Posted: Fri Sep 30, 2022 3:21 pm
Hi.
I'm planning to connect an ESP32 to two Ethernet PHYs, but only the SMI (MDC+MDIO) and reset pins, not the data plane (see docs). For the data plane, both PHYs are cross-connected. I don't need the `netif` parts of esp-idf for this.
I need to configure those PHYs, i.e. read and write registers. The idea was to use ESP32's internal EMAC (and esp-idf) because it can already speak the SMI protocol. If that proves too complicated, I'm prepared to bitbang the protocol or implement it with the I/O facilities of the ESP32.
How should I approach this?
I don't have hardware to test on yet, but I do have an ESP32 Ethernet Kit, so I can try some things for now. The intended hardware will involve PHYs similar to IP101 so I can fork and modify that driver.
In the basic Ethernet example, I saw `esp_eth_phy_new_ip101`, which populates some structures with convenient methods, but doesn't actually talk to (init) the PHY yet...
The methods of the `esp_eth_phy_t` object provide some setters on the PHY but no way to access registers. I guess the interface isn't intended for that.
`esp_eth_driver_install` does a lot of work... specifically, the `esp_eth_config_t` object contains fields that relate to transferring actual Ethernet data, which I don't intend the ESP32 to be aware of at all.
I think I can skip the `esp_netif_attach`, `esp_event_handler_register`, and `esp_eth_start` but I'm not quite sure.
I also don't know yet what functions/methods to use to read/write each PHY's registers explicitly. Code in the `ip101` specific driver calls `eth->phy_reg_read()`, going through an `esp_eth_mediator_t` object, which gets set sometime during setup via `ip101_set_mediator` or `set_mediator` in `esp_eth_driver_install`...
Hoping for guidance and suggestions. Thank you!
I'm planning to connect an ESP32 to two Ethernet PHYs, but only the SMI (MDC+MDIO) and reset pins, not the data plane (see docs). For the data plane, both PHYs are cross-connected. I don't need the `netif` parts of esp-idf for this.
I need to configure those PHYs, i.e. read and write registers. The idea was to use ESP32's internal EMAC (and esp-idf) because it can already speak the SMI protocol. If that proves too complicated, I'm prepared to bitbang the protocol or implement it with the I/O facilities of the ESP32.
How should I approach this?
I don't have hardware to test on yet, but I do have an ESP32 Ethernet Kit, so I can try some things for now. The intended hardware will involve PHYs similar to IP101 so I can fork and modify that driver.
In the basic Ethernet example, I saw `esp_eth_phy_new_ip101`, which populates some structures with convenient methods, but doesn't actually talk to (init) the PHY yet...
The methods of the `esp_eth_phy_t` object provide some setters on the PHY but no way to access registers. I guess the interface isn't intended for that.
`esp_eth_driver_install` does a lot of work... specifically, the `esp_eth_config_t` object contains fields that relate to transferring actual Ethernet data, which I don't intend the ESP32 to be aware of at all.
I think I can skip the `esp_netif_attach`, `esp_event_handler_register`, and `esp_eth_start` but I'm not quite sure.
I also don't know yet what functions/methods to use to read/write each PHY's registers explicitly. Code in the `ip101` specific driver calls `eth->phy_reg_read()`, going through an `esp_eth_mediator_t` object, which gets set sometime during setup via `ip101_set_mediator` or `set_mediator` in `esp_eth_driver_install`...
Hoping for guidance and suggestions. Thank you!