Main Content

F2838x-M4 TCP Receive

Receive data over TCP/IP network from remote host

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

  • F2838x-M4 TCP Receive block

Description

The TCP Receive block receives data from a remote host or other target hardware over a network. The server(client mode) must be up and running before deploying the model that contains the TCP Receive block to the target.

The block outputs data either in blocking mode or in non-blocking mode. In blocking mode, the model blocks the execution while it waits for the requested data to be available. In non-blocking mode, the model runs continuously. To set the block in blocking mode, select the Wait until data received option.

At each time step, the Data port outputs data as a vector of the size specified in the Data size (N) parameter. The Status port outputs 0 or a nonzero value indicating whether new data is received. 0 at the Status port indicates that a valid data is received.

Note

  • Your antivirus software or firewall might block TCP 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.

Ports

Output

expand all

At each time step, the port outputs data as a 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

Parameters

expand all

Set the block as TCP/IP server or client.

When you set connection mode parameter to Server, provide a Local IP Port. The local port acts as the listening port on the TCP/IP server.

When you set connection mode parameter to Client, provide the Server IP Address and the Server IP Port of the TCP/IP server from which you want to receive the data.

This local port number acts as a listening port on the TCP/IP server. Match the local port number with the remote port number of the sending host.

Specify the IP address of the sending server from which the data is received.

Dependencies

This parameter appears only when Connection mode parameter is set to Client.

Specify port number on the sending server from which data is received.

Dependencies

This parameter appears only when Connection mode is set to Client.

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

Specify number of data bytes to receive at each time step.

  • 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 (the block outputs 0). 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