TCP stack pinging problem

Trying to solve pinging problem and the following symptoms found:
xPhyObject.ulLinkStatusMask variable is always 0.
As result function xNetworkInterfaceInitialise() returns Fail
and in function xNetworkInterfaceOutput() the function
iptraceNETWORK_INTERFACE_TRANSMIT() is not executed.
Checked HAL_ETH_Init() it always returned HAL_OK

Which hardware and network driver are you using, and where did the driver come from?

I’m using STM32F407 based XCore407I dev. board as hardware. As software, the latest
FreeRTOS + TCP in STM32Cube IDE.

The version number is at the top of each FreeRTOS+TCP file. Please open one of the TCP source files then cut and past the comment block found at the top of the file into a forum post - thanks.

/*

  • Some constants, hardware definitions and comments taken from ST’s HAL driver
  • library, COPYRIGHT© 2015 STMicroelectronics.
    */

/*

  • FreeRTOS+TCP V2.3.2
  • Copyright © 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  • Permission is hereby granted, free of charge, to any person obtaining a copy of
  • this software and associated documentation files (the “Software”), to deal in
  • the Software without restriction, including without limitation the rights to
  • use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  • the Software, and to permit persons to whom the Software is furnished to do so,
  • subject to the following conditions:
  • The above copyright notice and this permission notice shall be included in all
  • copies or substantial portions of the Software.
  • THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  • FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  • COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  • IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  • CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • http://aws.amazon.com/freertos
  • http://www.FreeRTOS.org
    */

FreeRTOS+TCP V2.3.2

That’s indeed the latest, thank you.

As you may have guessed, xPhyObject.ulLinkStatusMask reflects the status of the PHY, the connection to your LAN. It does not get a Link Status.

Are you using a standard Discovery board, or a custom PCB?
If it has MII, please define ipconfigUSE_RMII as zero, meaning that you do not have reduced pins ( like the STM32F7x board has ).

Do you connect it to a switch or a router? Does the switch or router show a LED, saying that there is a device connected? You can check this without running any firmware, just connect it.

Again about the PHY, does the function xPhyDiscover() in phyHandling.c find the PHY? When found, pxPhyObject->xPortCount will become 1.
Can you check that?

Hi Hein, Thanks for fast responding.
Those are my answers:

  • the hardware is: XCore407I eval. board based on stm32F407IG MCU, which is connected to DP83848 Phy, which I chose to initialize in RMII mode. To make sure Phy is linked to the MAC I traced HAL_ETH_Init() function and it returned HAL_OK, which proves that Phy is linked to the MAC.
  • connection is direct ethernet connection from my PC to the board.
  • In the code xPhyDiscover() is called by vMACBProbePhy(), which is not called by any other function. So, it wasn’t used in the code.
    Thanks.

You will notice that this can complicate testing: the PC will start up it stack at the same time as the board. Will the PC use DHCP to obtain its address?
I would choose static addresses for both sides.
But I found it more convenient to have a switch in between. In that case the PC is ready immediately when the board is booting.

In the code xPhyDiscover() is called by vMACBProbePhy(), which is not called by any other function. So, it wasn’t used in the code

And now it is used in the code? Does it get recognised?

which is connected to DP83848 Phy, which I chose to initialize in RMII mode

But is it also connected as an RMII device?

“You will notice that this can complicate testing: the PC will start up it stack at the same time as the board. Will the PC use DHCP to obtain its address?
I would choose static addresses for both sides.
But I found it more convenient to have a switch in between. In that case the PC is ready immediately when the board is booting.”

Currently I have static addresses on both sides. Will try to use switch.

“And now it is used in the code? Does it get recognized?”

May be I did not phrase it correctly. The xPhyDiscover() function is part of the FreeRTOS + TCP code and, as I understand, it should be internally called by someone, but it isn’t. As result
vMACBProbePhy() also isn’t requested. I thought that may be because of pragma (#ifdef) switches the code which supposed to call xPhyDiscover() was disabled but did not find such a switch.

“But is it also connected as an RMII device?”

Yes, according schematic , it is connected as RMII device.
Also I have old firmware which is based on old FreeRTOS and LWIP and after downloading it
to the same eval board it does pinging without any problems.

Hein, I injected vMACBProbePhy() function in xNetworkInterfaceInitialize() after the HAL_ETH_Init() and ping started working. Thanks.