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 end2 with rn. If set to 0 then each message sent via the UDP logging facility will3 end with n. */45 #define configUDP_LOGGING_NEEDS_CR_LF ( 1 )67/* Sets the maximum length for a string sent via the UDP logging facility. */8 #define configUDP_LOGGING_STRING_LENGTH ( 200 )910/* The UDP logging facility buffers messages until the UDP logging task is able11 to transmit them. configUDP_LOGGING_MAX_MESSAGES_IN_BUFFER sets the maximum12 number of messages that can be buffered at any one time. */13 #define configUDP_LOGGING_MAX_MESSAGES_IN_BUFFER ( 20 )1415/* The UDP logging facility creates a task to send buffered messages to the UDP16 port. configUDP_LOGGING_TASK_STACK_SIZE sets the task's stack size. */17 #define configUDP_LOGGING_TASK_STACK_SIZE ( 512 )1819/* The UDP logging facility creates a task to send buffered messages to the UDP20 port. configUDP_LOGGING_TASK_PRIORITY sets the task's priority. It is21 suggested to give the task a low priority to ensure it does not adversely effect22 the performance of other TCP/IP stack activity. */23 #define configUDP_LOGGING_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )2425 /* The UDP port numbers to use. */26 #define configUDP_LOGGING_PORT_LOCAL 149927 #define configUDP_LOGGING_PORT_REMOTE 15002829/* The IP address to which the UDP messages are sent.30 NOTE: If these settings are omitted then the UDP messages will be sent to31 the local broadcast address, although broadcast messages can be blocked by switches32 and routers. */33 #define configUDP_LOGGING_ADDR0 19234 #define configUDP_LOGGING_ADDR1 16835 #define configUDP_LOGGING_ADDR2 036 #define configUDP_LOGGING_ADDR3 3
UDP logging output viewed using UDPTerm,
from Cinetix