Cannot get IP

gpezzella
Posts: 50
Joined: Sun Jan 27, 2019 8:04 pm

Cannot get IP

Postby gpezzella » Thu Mar 28, 2019 4:39 pm

Hello

our board is similar to OLIMEX ESP32-EVB. It use LAN8710 chip
The problem is that we cannot receive IP

Output log on ESP32-EVB is:
  1. TYPE LAN8720 OK
  2. INITIALIZED OK
  3. ENABLED OK
  4. ETH Started Event raised
  5. ETH Connected Event raised
  6. ETH GOT IP Event raised
  7. ETH MAC: 24:0A:C4:9E:F0:3F, IPv4: 10.0.30.92, FULL_DUPLEX, 100Mbps

Output log on our board is:
  1. TYPE LAN8720 OK
  2. INITIALIZED OK
  3. ENABLED OK
  4. ETH Started Event raised
  5. ETH Connected Event raised


On Emac_RXD1 pin I can see signal
I would change original code line for LAN8720:

  1. extern const eth_config_t phy_lan8720_default_ethernet_config;



with new one for LAN8710 but I don't know how to do.
I have found this OLIMEX code but it not compile.
Could you help me?
Thanks

  1. const eth_config_t phy_lan8710_default_ethernet_config = {
  2.  
  3.     .phy_addr = 0,
  4.     .mac_mode = ETH_MODE_RMII,
  5.     .clock_mode = ETH_CLOCK_GPIO0_IN,
  6.     .flow_ctrl_enable = true,
  7.     .phy_init = phy_lan8710_init,
  8.     .phy_check_init = phy_lan8710_check_phy_init,
  9.     .phy_power_enable = phy_lan8710_power_enable,
  10.     .phy_check_link = phy_mii_check_link_status,
  11.     .phy_get_speed_mode = phy_lan8710_get_speed_mode,
  12.     .phy_get_duplex_mode = phy_lan8710_get_duplex_mode,
  13.     .phy_get_partner_pause_enable = phy_mii_get_partner_pause_enable,
  14. };
  1. void phy_lan8710_init(void)
  2. {
  3.  
  4.     esp_eth_smi_write(MII_BASIC_MODE_CONTROL_REG, MII_SOFTWARE_RESET);
  5.     while(esp_eth_smi_read(MII_BASIC_MODE_CONTROL_REG) & 0x8000);
  6.  
  7.     esp_eth_smi_write(MII_BASIC_MODE_CONTROL_REG, 0x3100);
  8.     esp_eth_smi_write(MII_AUTO_NEG_ADVERTISEMENT_REG, 0x01E1);
  9.  
  10.     esp_err_t res1, res2;
  11.     do {
  12.         // Call esp_eth_smi_wait_value() with a timeout so it prints an error periodically
  13.         res1 = esp_eth_smi_wait_value(MII_PHY_IDENTIFIER_1_REG, LAN8710_PHY_ID1, UINT16_MAX, 1000);
  14.         res2 = esp_eth_smi_wait_value(MII_PHY_IDENTIFIER_2_REG, LAN8710_PHY_ID2, LAN8710_PHY_ID2_MASK, 1000);
  15.     } while(res1 != ESP_OK || res2 != ESP_OK);
  16.  
  17. #if 0
  18.     esp_eth_smi_write(SW_STRAP_CONTROL_REG,
  19.                       DEFAULT_STRAP_CONFIG | SW_STRAP_CONFIG_DONE);
  20. #endif
  21.  
  22.     ets_delay_us(300);
  23.  
  24.     // TODO: only enable if config.flow_ctrl_enable == true
  25.     phy_mii_enable_flow_ctrl();
  26. }

Who is online

Users browsing this forum: No registered users and 134 guests