Main Content

F2838x-M4 UDP Receive

Receive UDP packets from UDP host

  • Library:
  • Embedded Coder Support Package for Texas Instruments C2000 Processors / F2838x / M4

  • UDP Receive


The UDP Receive block receives UDP packets from a UDP host. Use the block for stateless and connectionless data exchange.

With each sample, the block outputs the contents of a UDP packet as a data vector of the size specified in the Data size (N) parameter.

The block receives the packets on the port number specified in the Local IP Port parameter from the IP address specified in the Remote IP address ( for accepting all) parameter.

You can choose to receive the UDP packets in the blocking or nonblocking mode.


  • Your antivirus software or firewall might block UDP traffic. Configure the software to allow traffic from a specific IP port number.

  • Due to RAM memory limitations on the F2838x(ARM Cortex-M4), loading application to RAM is not supported for this block.

  • CPU Timer 2 of F2838x Arm Cortex-M core (Connectivity Manager) provides time base to lwIP stack. It is configured to trigger an interrupt every 1 ms. This timer should not be re-configured if Ethernet blocks are being used in the model. If the corresponding interrupt is armed through Hardware Interrupt block, it will run the interrupt handler every 1 ms.



expand all

At each sample time, the port outputs the contents of a packet received as a data vector of the size specified in the Data size (N) parameter.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

The port outputs 0 if the data is received at a given time step. Otherwise, it outputs a nonzero value, indicating that no new data is available.

Data Types: uint8


expand all

Specify the port number of the application from which you want to receive the packets. Match the local port number with the remote port number of the sending host.

Specify the IP address of the remote host from which the block receives packets. To receive packets from all the sending hosts, specify

Select the data type of the elements in the UDP packets received by the block. The size of each element depends on its data type.

Specify the number of elements that you want to receive in each packet.

Ensure the following conditions are considered when data is sent to UDP Receive in the target to avoid data loss.


  • The UDP block can handle the maximum packet size (datagram size) of 1472 bytes. Ensure the packet size sent to the target is less than or equal to 1472 bytes.

  • Ensure the size of the data sent to the target is less than or equal the packet size (datagram size).

  • on — When you select this parameter, the read operation runs in the blocking mode. The read operation is blocked when the block is waiting for the requested data. If data is available, the block outputs the data. If data is not available, the block waits for the data.

    A task overrun occurs if the target hardware is still waiting for the data when the next read operation begins.

    To fix overruns, increase the time step by using the Sample time parameter.

  • off — When you clear this parameter, the read operation runs in the nonblocking mode. When reading data, if data is not available, the block contains the packet received in the previous time step. In this mode, the block does not wait for the requested data to be available.

Specify how often the block should read the port buffer. Enter a value greater than 0 or -1 (for inherited sample time).

This value defaults to a sample time of 0.1 seconds. Smaller values require the processor to complete the same number of instructions in less time, and this can cause task overruns.

Version History

Introduced in R2020b