Nucleo f767zi force ethernet at 10Mbps

Hi,

In order to ease troubleshooting, I’d like to force my ethernet link to run at 10Mbps.
This would permit to observe packets with an affordable oscillocope.
I understand that I should disable auto-negociation and deselect 100Mbps in PHY init.
But I have no idea about doing this.
EthernetInterface doesn’t provide any adequat API.

all the best

Jean-Paul

Hello Jean-Paul,

Try to make the following modification to the ‘mbed-os\features\netsocket\emac-drivers\TARGET_STM\stm32xx_emac.cpp’ file:

bool STM32_EMAC::low_level_init_successful()
#ifndef ETH_IP_VERSION_V2
{
    /* Init ETH */
    uint8_t MACAddr[6];
    EthHandle.Instance = ETH;
//    EthHandle.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE;
//    EthHandle.Init.Speed = ETH_SPEED_100M;
    EthHandle.Init.AutoNegotiation = ETH_AUTONEGOTIATION_DISABLE;
    EthHandle.Init.Speed = ETH_SPEED_10M;
...
}

Hello Zoltan,

Sorry for the mbed-newbie question. I am using online compiler.
Is it possible to modify the mbed library ?
If yes, how to ?

Regards

JP

I’m afraid not. Try to do it offline either in Mbed Studio or using Mbed CLI.

Best regards, Zoltan

Hello again,

I have tested your recommendation, it works great!
For conveniance, I wrapped your code with an “ETH_FORCE_SPEED_10M” #ifdef (see here below).
Regards,

Jean-Paul