rtiostreamtest
Test custom rtiostream
interface implementation
Syntax
Description
rtiostreamtest(
runs a test suite to verify your custom connection
, parameterOne
, parameterTwo
, verbosityFlag
)rtiostream
interface
implementation.
rtiostreamtest('tcp', host, port)
, via TCP/IP communication,
connects MATLAB® to the target hardware using the specified host
and
port
.
rtiostreamtest('serial', port, baud)
, via serial communication,
connects MATLAB to the target hardware using the specified port
and
baud
value.
During initialization, the function uses basic rtiostream
I/O. The
function determines:
Byte ordering of data on the target hardware.
Granularity of memory address.
Size of data types.
Whether
rtIOStreamRecv
blocks, that is, when there is no data whetherrtIOStreamRecv
waits for data or returns immediately with size received==
0.The size (
BUFFER_SIZE
) of its internal buffer for receiving or transmitting data throughrtiostream
. The default is 128 bytes.
In Test 1 (fixed size data exchange)
, the function:
Checks data can be sent and received correctly in different chunk sizes. The chunk sizes for your development computer and target hardware are symmetric.
Sends data as a known sequence that it can validate.
Performs “host-to-target” tests. Your development computer sends data and your target hardware receives data in successive chunks of 1, 4, and 128 bytes.
Performs “target-to-host” tests. Your target hardware sends data and your development computer receives data in successive chunks of 1, 4, and 128 bytes.
In Test 2 (varying size data exchange)
, the function:
Checks that data can be sent and received correctly in different chunk sizes. The chunk sizes for your development computer and target hardware are asymmetric.
Sends data as a known sequence that it can validate.
Performs “host-to-target” tests:
Your development computer sends data in chunks of 128 bytes and your target hardware receives data in chunks of 64 bytes.
Your development computer sends data in chunks of 64 bytes and your target hardware receives data in chunks of 128 bytes.
Performs “target-to-host” tests:
Your target hardware sends data in chunks of 64 bytes and your development computer receives data in chunks of 128 bytes.
Your target hardware sends data in chunks of 128 bytes and your development computer receives data in chunks of 64 bytes.
In Test 3 (receive buffer detection)
, the function determines the
data that it can store in between calls to rtIOStreamRecv
on the target
hardware. The function uses an iterative process:
The development computer transmits a data sequence while the target hardware sleeps.
rtIOStreamRecv
is not called while the target hardware sleeps.When the target hardware wakes up, it calls
rtIOStreamRecv
to receive data from the internal buffer of the driver.The function determines whether the internal buffer overflowed by checking for errors and checking the received data values.
If there are no overflow errors and the transmitted data is received correctly, the function starts another iteration, performing step 1 with a larger data sequence.
The function reports the size of the last known good buffer.
Examples
Verify Behavior of Custom rtiostream
Interface Implementation
The test suite consists of two parts. One part of the test suite is an application that runs on the target hardware. The other part runs in MATLAB.
To create the target application, compile and link these files:
The
rtiostream
implementation under investigation, for example,rtiostream_tcpip.c
.
rtiostreamtest.c
,rtiostreamtest.h
, andmain.c
are located in
.matlabroot
/toolbox/coder/rtiostream/src/rtiostreamtestDownload and run the application on your target hardware.
To run the MATLAB part of the test suite, invoke the
rtiostreamtest
function. For example:rtiostreamtest('tcp','myProcessor','2345')
The function produces an output like this:
### Test suite for rtiostream ### Initializing connection with target... ### Hardware characteristics discovered Size of char : 8 bit Size of short : 16 bit Size of int : 32 bit Size of long : 32 bit Size of float : 32 bit Size of double : 64 bit Size of pointer : 64 bit Byte ordering : Little Endian ### rtiostream characteristics discovered Round trip time : 0.25098 ms rtIOStreamRecv behavior : non-blocking ### Test results Test 1 (fixed size data exchange): ......... PASS Test 2 (varying size data exchange): ......... PASS ### Test suite for rtiostream finished successfully ###
The function also generates the average bandwidth profile.
Input Arguments
Version History
Introduced in R2013a