# FreeRTOS+TCP V10.04.1 STM32F4xx STM32CubeIDE

**URL:** <https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868>\
**Category:** Libraries\
**Created:** [October 9, 2020, 10:30pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868 "2020-10-09T22:30:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 9, 2020, 10:30pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/1 "2020-10-09T22:30:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 9, 2020, 10:32pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/2 "2020-10-09T22:32:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 10, 2020, 7:31am UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/3 "2020-10-10T07:31:30Z")

</div>

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:

```c
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.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 10, 2020, 9:00am UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/4 "2020-10-10T09:00:50Z")

</div>

> 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](https://github.com/htibosch/freertos_plus_projects/tree/master/plus/stm32F40) you find a sample project for STM32F4xx.

This is the root of the repo [freertos\_plus\_projects](https://github.com/htibosch/freertos_plus_projects).

The 5 projects under `/plus` use make. Check out the [readme.md](https://github.com/htibosch/freertos_plus_projects/blob/master/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](https://github.com/freertos/freertos) or [AWS](https://github.com/aws/amazon-freertos/).

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

Thanks,

---

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 10, 2020, 12:03pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/5 "2020-10-10T12:03:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 10, 2020, 12:04pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/6 "2020-10-10T12:04:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 10, 2020, 12:20pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/7 "2020-10-10T12:20:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 10, 2020, 4:17pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/8 "2020-10-10T16:17:14Z")

</div>

After finding this post [https://forums.freertos.org/t/where-can-i-find-the-example-project-freertos-plus-tcp-for-stm32f4xxx/10579/9](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.

---

<div class="post-metadata">

**Author:** ![htibosch](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/htibosch/32/62_2.png) [@htibosch](https://forums.freertos.org/u/htibosch)\
**Post date:** [October 10, 2020, 6:36pm UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/9 "2020-10-10T18:36:17Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![krakatou](https://avatars.discourse-cdn.com/v4/letter/k/bcef8e/32.png) [@krakatou](https://forums.freertos.org/u/krakatou)\
**Post date:** [October 12, 2020, 11:30am UTC](https://forums.freertos.org/t/freertos-tcp-v10-04-1-stm32f4xx-stm32cubeide/10868/10 "2020-10-12T11:30:28Z")

</div>

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