FreeRTOS + TCP, tutorial, STM32F7 questions.

heinbali01 wrote on Monday, August 19, 2019:

Hello Pavan, are you using one of the latest version of NetworkInterface for STM?

The drivers on Github/AWS still run behind.

On the FreeRTOS SVN you will find the latest versions

The driver in STM32Fxx works for both STM32F4 and STM32F7. You will also have to include Common/phyHandler.c into your project, and ad a -I for this include directory: source/portable/NetworkInterface/include

The module phyHandler.c will try all PHY addresses to look for a connected PHY. If you have logging, you can see what happens. Otherwise you can also set breaks in the code and inspect variables.

So in xPhyDiscover() you should see that your PHY will answer.

Make sure you have ipconfigUSE_RMII defined to 1 in case the connection is RMII. Define it as 0 if you have a MII.

The next step will be to see if the Link Status becomes high. You see that reflected in the variable xPhyObject.ulLinkStatusMask.

While you are debugging it is maybe easier to disable DHCP:

#define ipconfigUSE_DHCP    0

When you see that the PHY status is high, you will see so-called gratuitous ARP requests coming from your device.

pavanshah2001 wrote on Monday, August 19, 2019:

Hello Hein,

are you using one of the latest version of NetworkInterface for STM?

I used the one attached in your previous discussion. I will try with the latest one as well.

The driver in STM32Fxx works for both STM32F4 and STM32F7. You will also have to include Common/phyHandler.c into your project, and ad a -I for this include directory: source/portable/NetworkInterface/include

Yes i have defined STM32f7xx, and I’m including phyHandler.c and have also included the said directory. And code compiles fine.

Make sure you have ipconfigUSE_RMII defined to 1 in case the connection is RMII. Define it as 0 if you have a MII.

Yes i’m using RMII and this setting is done in my FreeRTOSIPConfig.h

So I think my code is getting stuck when I Initialise the ETH module. This doesnt happen when I’m using the ETH file supplied with STM HAL files. I assume some problem with GPIO init?? With similar GPIO init I have got LWIP working.

I will try using the latest files mentioned by you and update you.

heinbali01 wrote on Tuesday, August 20, 2019:

One question, does the code hang in stm32fxx_hal_eth.c in HAL_ETH_Init() ?

	/* Wait for software reset */
	while ((heth->Instance->DMABMR & ETH_DMABMR_SR) != (uint32_t)RESET)
	{
		/* If your program hangs here, please check the value of 'ipconfigUSE_RMII'. */
	}

Yes i’m using RMII and this setting is done in my FreeRTOSIPConfig.h

And so ipconfigUSE_RMII is defined as 1 ?

With similar GPIO init I have got LWIP working.

This happens with a call-back from the function HAL_ETH_Init()

		/* Init the low level hardware : GPIO, CLOCK, NVIC. */
		HAL_ETH_MspInit( heth );

Can you confirm that your implementation of HAL_ETH_MspInit() is being called?