This section provides information about using the
rtiostream API for
communication between your development computer and target hardware during PIL
rtiostream API supports communications
for the target connectivity API. Use the
to implement a communication channel that enables data exchange between
PIL verification requires a host-target communications channel.
This communications channel comprises driver code that runs on the
host and target. The
rtiostream API defines the
signature of target-side and host-side functions that must be implemented
by this driver code.
The API is independent of the physical layer that sends the data. Possible physical layers include RS232, Ethernet, or Controller Area Network (CAN).
rtiostream implementation requires
both host-side and target-side drivers. Code generation software includes
host-side drivers for the default TCP/IP implementation as well as
a version for serial communications. To use:
channel, you must provide, or obtain from a third party, target-specific
TCP/IP device drivers.
The serial communications channel, you must provide, or obtain from a third party, target-specific serial device drivers.
For other communication channels and platforms, the code generation software does not provide default implementations. You must provide both the host-side and the target-side drivers.
rtiostream API comprises the following
For information about:
rtiostream functions in a
connectivity implementation, see Create a Target Connectivity API Implementation.
rtiostream shared library methods from MATLAB® code, see
If you use the
rtiostream API to implement
the communications channel, the host and target must be synchronized,
which prevents MATLAB from transmitting and receiving data before
the target application is fully initialized.
To synchronize the host and target for TCP/IP rtiostream implementations, use the
setInitCommsTimeout method from
rtw.connectivity.RtIOStreamHostCommunicator. This approach works well for
rtiostream implementations because MATLAB automatically waits until the target server is running.
rtiostream implementations, for
example, serial, the MATLAB side of the
opens without waiting for the target to be fully initialized. In this
case, you must make your
wait until the target application is fully initialized. Use one of
the following approaches to synchronize your host and target:
Add a pause at the end of the
that makes the
Launcher wait until target initialization
use third-party downloader or debugger APIs that wait until target
initialization is complete.
Implement a handshaking mechanism in the
that confirms completion of target initialization.
Use a test suite to debug and verify the behavior of custom
The test suite can help you to:
Reduce the time required for integrating custom hardware that does not have
Reduce the time required for testing custom
Analyze the performance of custom
The test suite consists of two parts. One part is an application that runs on the target
hardware. The other part runs in MATLAB. For details, see