Page 1 of 1

Cannot get IP

Posted: Thu Mar 28, 2019 4:39 pm
by gpezzella
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:

Code: Untitled.txt Select all

TYPE LAN8720 OK
INITIALIZED OK
ENABLED OK
ETH Started Event raised
ETH Connected Event raised
ETH GOT IP Event raised
ETH MAC: 24:0A:C4:9E:F0:3F, IPv4: 10.0.30.92, FULL_DUPLEX, 100Mbps

Output log on our board is:

Code: Untitled.txt Select all

TYPE LAN8720 OK
INITIALIZED OK
ENABLED OK
ETH Started Event raised
ETH Connected Event raised


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

Code: Untitled.cpp Select all

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

Code: Untitled.cpp Select all

const eth_config_t phy_lan8710_default_ethernet_config = {

.phy_addr = 0,
.mac_mode = ETH_MODE_RMII,
.clock_mode = ETH_CLOCK_GPIO0_IN,
.flow_ctrl_enable = true,
.phy_init = phy_lan8710_init,
.phy_check_init = phy_lan8710_check_phy_init,
.phy_power_enable = phy_lan8710_power_enable,
.phy_check_link = phy_mii_check_link_status,
.phy_get_speed_mode = phy_lan8710_get_speed_mode,
.phy_get_duplex_mode = phy_lan8710_get_duplex_mode,
.phy_get_partner_pause_enable = phy_mii_get_partner_pause_enable,
};

Code: Untitled.cpp Select all

void phy_lan8710_init(void)
{

esp_eth_smi_write(MII_BASIC_MODE_CONTROL_REG, MII_SOFTWARE_RESET);
while(esp_eth_smi_read(MII_BASIC_MODE_CONTROL_REG) & 0x8000);

esp_eth_smi_write(MII_BASIC_MODE_CONTROL_REG, 0x3100);
esp_eth_smi_write(MII_AUTO_NEG_ADVERTISEMENT_REG, 0x01E1);

esp_err_t res1, res2;
do {
// Call esp_eth_smi_wait_value() with a timeout so it prints an error periodically
res1 = esp_eth_smi_wait_value(MII_PHY_IDENTIFIER_1_REG, LAN8710_PHY_ID1, UINT16_MAX, 1000);
res2 = esp_eth_smi_wait_value(MII_PHY_IDENTIFIER_2_REG, LAN8710_PHY_ID2, LAN8710_PHY_ID2_MASK, 1000);
} while(res1 != ESP_OK || res2 != ESP_OK);

#if 0
esp_eth_smi_write(SW_STRAP_CONTROL_REG,
DEFAULT_STRAP_CONFIG | SW_STRAP_CONFIG_DONE);
#endif

ets_delay_us(300);

// TODO: only enable if config.flow_ctrl_enable == true
phy_mii_enable_flow_ctrl();
}