Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Updated Jun 2025

Outputting TCP Log Messages via UDP

FreeRTOS-Plus-TCP and FreeRTOS-Plus-FAT Examples

FreeRTOS_debug_printf() and FreeRTOS_printf() are used to output log messages from within the FreeRTOS-Plus-TCP TCP/IP stack, and can be used by the application writer for the same purpose. The UDP logging example demonstrates how to send FreeRTOS_debug_printf() and FreeRTOS_printf() output to a UDP port.

The following settings in FreeRTOSConfig.h configure the UDP logging functionality.

1/* If set to 1 then each message sent via the UDP logging facility will end
2 with rn. If set to 0 then each message sent via the UDP logging facility will
3 end with n. */
4
5 #define configUDP_LOGGING_NEEDS_CR_LF ( 1 )
6
7/* Sets the maximum length for a string sent via the UDP logging facility. */
8 #define configUDP_LOGGING_STRING_LENGTH ( 200 )
9
10/* The UDP logging facility buffers messages until the UDP logging task is able
11 to transmit them. configUDP_LOGGING_MAX_MESSAGES_IN_BUFFER sets the maximum
12 number of messages that can be buffered at any one time. */
13 #define configUDP_LOGGING_MAX_MESSAGES_IN_BUFFER ( 20 )
14
15/* The UDP logging facility creates a task to send buffered messages to the UDP
16 port. configUDP_LOGGING_TASK_STACK_SIZE sets the task's stack size. */
17 #define configUDP_LOGGING_TASK_STACK_SIZE ( 512 )
18
19/* The UDP logging facility creates a task to send buffered messages to the UDP
20 port. configUDP_LOGGING_TASK_PRIORITY sets the task's priority. It is
21 suggested to give the task a low priority to ensure it does not adversely effect
22 the performance of other TCP/IP stack activity. */
23 #define configUDP_LOGGING_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
24
25 /* The UDP port numbers to use. */
26 #define configUDP_LOGGING_PORT_LOCAL 1499
27 #define configUDP_LOGGING_PORT_REMOTE 1500
28
29/* The IP address to which the UDP messages are sent.
30 NOTE: If these settings are omitted then the UDP messages will be sent to
31 the local broadcast address, although broadcast messages can be blocked by switches
32 and routers. */
33 #define configUDP_LOGGING_ADDR0 192
34 #define configUDP_LOGGING_ADDR1 168
35 #define configUDP_LOGGING_ADDR2 0
36 #define configUDP_LOGGING_ADDR3 3

Logging messages produced by the free RTOS TCP/IP stack
UDP logging output viewed using UDPTermexternal_link, from Cinetix