FreeRTOS+TCP V10.04.1 STM32F4xx STM32CubeIDE

I’m fairly new to FreeRTOS and FreeRTOS+TCP.

My FreeRTOS+TCP log looks like this…

Autonego ready: 20000fcc: 0Network buffers: 536885788 lowest 2779096485
prvInitialiseDHCP: start after 536875044 ticks
Network buffers: 536885788 lowest 2779096485
vDHCPProcess: discover
Network buffers: 536885788 lowest 2779096485
vDHCPProcess: discover
Network buffers: 536885788 lowest 2779096485

The numbers are obviously too large. Is there something obvious that I’ve not configured correctly? I can see the DHCP requests with wireshark, The board ignores standard offers and pings requests. I have a couple of separate tasks running LED patterns and LCD test messages completely fine. I’ve spent hours trying to work out what I might not have setup the FreeRTOSIPConfig.h file correctly.

It would be fantastic if there was a very basic FreeRTOS+TCP demo project for STM32Fxx that I could see where I’m going wrong. I can’t find any of the old demos that are mentioned on the website and documentation.

First a quick question: how did you define FreeRTOS_printf() and FreeRTOS_debug_printf()?

Is the prototype of your debug-printing routine visible to the code that uses mentioned macro’s?

For instance, this definition works OK:

extern int lUDPLoggingPrintf( const char *pcFormatString, ... ) __attribute__ ((format (__printf__, 1, 2)));

/* Set to 1 to print out debug messages.  If ipconfigHAS_DEBUG_PRINTF is set to
1 then FreeRTOS_debug_printf should be defined to the function used to print
out the debugging messages. */

#define ipconfigHAS_DEBUG_PRINTF	1

#if( ipconfigHAS_DEBUG_PRINTF == 1 )
	#define FreeRTOS_debug_printf( X )	( void ) lUDPLoggingPrintf X
#endif

I can’t find any of the old demos that are mentioned
on the website and documentation.

I’m sorry about that. They were removed because they were not maintained for a long time ( 4 years ).
I will prepare a new up-to-date testing projects and put them on github.

It would be fantastic if there was a very basic
FreeRTOS+TCP demo project for STM32Fxx
that I could see where I’m going wrong

I am not sure if it helps solving your problem with logging, but here you find a sample project for STM32F4xx.

This is the root of the repo freertos_plus_projects.

The 5 projects under /plus use make. Check out the readme.md that explains how to change the location of the compiler.

Note that it is a private repo, and not an official release from FreeRTOS or AWS.

If you have any questions or remarks, you can put them here in this post.

Thanks,

Thanks for the very quick reply!

I’ve defined FreeRTOS_printf() in FreeRTOSIPConfig.h as:

extern void vLoggingPrintf( const char * pcFormatString, ... );

#define ipconfigHAS_PRINTF    1
#if ( ipconfigHAS_PRINTF == 1 )
    #define FreeRTOS_printf( X )    vLoggingPrintf X
#endif

… and vLoggingPrintf(…) in main.c as:

void vLoggingPrintf(const char * pcFormatString, ... )
{
	va_list arg;
	char s[256];

	va_start( arg, pcFormatString );
	snprintf(s, sizeof(s), pcFormatString, arg );
	va_end( arg );

	CONSOLE(s);
}

Looking at these large numbers that I’m getting in the output - they do appear to be decimal representation of memory addresses, so I’m probably am not refrencing/de-refrencing ‘arg’ correctly.

Thank you very much. I’ll take a look at these tomorrow afternoon when I have a bit more time.

I was using snprintf(…) instead of vsnprintf(…) on a va_list. The numbers are now more reasonable.

Autonego ready: 00000004: full duplex 100 mbit high status
Network buffers: 56 lowest 56
prvInitialiseDHCP: start after 250 ticks
vDHCPProcess: discover
Network buffers: 55 lowest 55
vDHCPProcess: discover
vDHCPProcess: timeout 10000 ticks
Network buffers: 54 lowest 54
vDHCPProcess: discover
Network buffers: 53 lowest 53
vDHCPProcess: discover
vDHCPProcess: timeout 40000 ticks
Network buffers: 52 lowest 52
vDHCPProcess: discover
Network buffers: 52 lowest 51

Now to use your example project and configuration to figure out why the network traffic appears to be not receiving packets.

After finding this post https://forums.freertos.org/t/where-can-i-find-the-example-project-freertos-plus-tcp-for-stm32f4xxx/10579/9 I also realised I hadn’t enabled the ETH Interrupt.

And does it work by now?

My usual checklist has these items:

  • Are the necessary interrupts enabled?
  • Are all GPIO’s initialised correctly ( for STM32, a function HAL_ETH_MspInit() will be called by the HAL driver ).
  • Is the PHY recognised?
  • Does the PHY Link Status get high?
  • Are all necessary clocks initialised?

Yes thank you. Tt’s been working fine most of the weekend.