Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lan8720_reset_hw() out of spec, doesn't pull low for >100us (IDFGH-3584) #5528

Closed
brianbienvenu opened this issue Jul 1, 2020 · 2 comments
Closed
Assignees

Comments

@brianbienvenu
Copy link

brianbienvenu commented Jul 1, 2020

lan8720_reset_hw() doesn't contain any delay when pulsing the reset pin low. In the real world, this makes a ~250ns wide negative pulse. The chip in production LAN8720A datasheet asks for t_rstia >100us:
image

The datasheet for the EOL SMSC LAN8720 also specified T11.1 Reset Pulse Width >100us.

I first noticed this issue in v4.0.1, it's unchanged in master today:
https://github.com/espressif/esp-idf/blob/master/components/esp_eth/src/esp_eth_phy_lan8720.c#L262

I added a busy wait ets_delay_us(100); to resolve this issue:

static esp_err_t lan8720_reset_hw(esp_eth_phy_t *phy)
{
    phy_lan8720_t *lan8720 = __containerof(phy, phy_lan8720_t, parent);
    if (lan8720->reset_gpio_num >= 0) {
        gpio_pad_select_gpio(lan8720->reset_gpio_num);
        gpio_set_direction(lan8720->reset_gpio_num, GPIO_MODE_OUTPUT);
        gpio_set_level(lan8720->reset_gpio_num, 0);
        ets_delay_us(100);
        gpio_set_level(lan8720->reset_gpio_num, 1);
    }
    return ESP_OK;
}
@github-actions github-actions bot changed the title lan8720_reset_hw() out of spec, doesn't pull low for >100us lan8720_reset_hw() out of spec, doesn't pull low for >100us (IDFGH-3584) Jul 1, 2020
@suda-morris
Copy link
Collaborator

@brianbienvenu Well spotted! Will fix it ASAP.

@suda-morris suda-morris self-assigned this Jul 2, 2020
mahavirj pushed a commit to espressif/esp-afr-sdk that referenced this issue Jul 16, 2020
@Alvin1Zhang
Copy link
Collaborator

Thanks for reporting and sorry for slow turnaround, the fix is available at 5a99038. Feel free to reopen if the issue still happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants