Ethernet

Github Repo C Header C source JS source
mongoose-os-libs/ethernet      

ESP32

ESP32 includes an Ethernet MAC and requires an external PHY, connected over RMII interface.

Two PHY models are currently supported:

  • Microchip LAN87x0 (LAN8710 supports both MII and RMII
  • LAN8720 is RMII only) and TI TLK110. PHY model selection is a compile-time option and is set here.

There is a detailed article on how to connect a PHY yourself. It is much easier to buy a dev board which already has one, for example, Olimex ESP32-EVB.

Once wired, mos config-set eth.enable=true to enable Ethernet (see below).

STM32

ESP32 includes an Ethernet MAC and requires an external PHY, connected over RMII interface. Currently only LAN8742a PHY in RMII mode is supported.

MAC pin configuration

Since ETH MAC functions can be assigned to different pins, you need to specify pin assignments. These are provided as C macros and can be specified in the cdefs section. See example definitions for NUCLEO and Discovery boards in mos_stm32.yml.

Configuration

Common settings

"eth": {
  "enable": true       // Enable Ethernet support
}

ESP32 specific

"eth": {
  "phy_addr": 0,       // RMII PHY address
  "mdc_gpio": 23,      // GPIO to use for RMII MDC signal
  "mdio_gpio": 18      // GPIO to use for RMII MDIO signal
}

Note: the defaults match the EVB-ESP32 board, so if you use that, you won't need to adjust anything except setting eth.enable to true.


edit this doc