Skip to content

Where is best place to call LAN8742_StartAutoNego()? #8

@gausstop

Description

@gausstop

I have a custom stm32f407igt6 board with LAN8742A eth interface.

I got a problem that i can get eth work in 10MBITS_HALFDUPLEX mode only.
I have checked nx_stm32_phy_driver.c and nx_stm32_eth_driver.c,
there are no LAN8742_StartAutoNego() calling.

After add following modification, It's work fine.

int32_t nx_eth_phy_init(void)
{
    int32_t ret = ETH_PHY_STATUS_ERROR;
    /* Set PHY IO functions */

    LAN8742_RegisterBusIO(&LAN8742, &LAN8742_IOCtx);
    /* Initialize the LAN8742 ETH PHY */

    if (LAN8742_Init(&LAN8742) == LAN8742_STATUS_OK)
    {
      printf("LAN8742 Inital OK\n");
      ret = ETH_PHY_STATUS_OK;
    }else{
      printf("LAN8742 Fail\n");
      ret = ETH_PHY_STATUS_ERROR;
    }

    if (LAN8742_StartAutoNego(&LAN8742) == LAN8742_STATUS_OK)
    {
      ret = ETH_PHY_STATUS_OK;
    }else{
      ret = ETH_PHY_STATUS_ERROR;
    }

    do{
      //wait AUTONEGO done
    }while(LAN8742_STATUS_AUTONEGO_NOTDONE == LAN8742_GetLinkState(&LAN8742));

    do{
      //wait link state go up
    }while(LAN8742_STATUS_LINK_DOWN == LAN8742_GetLinkState(&LAN8742));
    
    return ret;
}

but after update souce code with stm32cubemx , it will be replaced.

please help work it around.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions