rtiostreamtest - Test custom rtiostream interface implementation - MATLAB (original) (raw)

Test custom rtiostream interface implementation

Syntax

Description

rtiostreamtest([connection](#mw%5F51bb2875-4a6a-421e-928f-7fb50877e94c), [parameterOne](#mw%5Fdfc2505b-f321-45cd-b28b-5351b97d4dce), [parameterTwo](#mw%5Fba6c2a87-3ea2-46f0-ad29-abe1f02fd64b), [verbosityFlag](#mw%5F99355747-d108-4793-8f60-ed7e0955dac7)) runs a test suite to verify your custom rtiostream interface implementation.

rtiostreamtest('tcp', host, port), via TCP/IP communication, connects MATLAB® to the target hardware using the specified host andport.

rtiostreamtest('serial', port, baud), via serial communication, connects MATLAB to the target hardware using the specified port andbaud value.

During initialization, the function uses basic rtiostream I/O. The function determines:

In Test 1 (fixed size data exchange), the function:

In Test 2 (varying size data exchange), the function:

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:

  1. The development computer transmits a data sequence while the target hardware sleeps. rtIOStreamRecv is not called while the target hardware sleeps.
  2. When the target hardware wakes up, it calls rtIOStreamRecv to receive data from the internal buffer of the driver.
  3. The function determines whether the internal buffer overflowed by checking for errors and checking the received data values.
  4. 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.

  1. To create the target application, compile and link these files:
    • [rtiostreamtest.c](https://mdsite.deno.dev/matlab:edit%28fullfile%28matlabroot,'/toolbox/coder/rtiostream/src/rtiostreamtest/rtiostreamtest.c'%29%29)
    • [rtiostreamtest.h](https://mdsite.deno.dev/matlab:edit%28fullfile%28matlabroot,'/toolbox/coder/rtiostream/src/rtiostreamtest/rtiostreamtest.h'%29%29)
    • [rtiostream.h](https://mdsite.deno.dev/matlab:edit%28fullfile%28matlabroot,'/toolbox/coder/rtiostream/src/rtiostream.h'%29%29)
    • The rtiostream implementation under investigation, for example, [rtiostream_tcpip.c](https://mdsite.deno.dev/matlab:edit%28fullfile%28matlabroot,'/toolbox/coder/rtiostream/src/rtiostreamtcpip/rtiostream%5Ftcpip.c'%29%29).
    • [main.c](https://mdsite.deno.dev/matlab:edit%28fullfile%28matlabroot,'/toolbox/coder/rtiostream/src/rtiostreamtest/main.c'%29%29)
      rtiostreamtest.c, rtiostreamtest.h, andmain.c are located in matlabroot/toolbox/coder/rtiostream/src/rtiostreamtest.
  2. Download and run the application on your target hardware.
  3. 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

collapse all

Specify transport protocol for communication channel:

If connection is 'tcp', specify name of target processor. For example, if your development computer is the target processor, you can specify 'localhost'.

If connection is 'serial', specify serial port ID, for example, 'COM1' for COM1, ‘'COM2' for COM2, and so on.

If connection is 'tcp', specify port number of TCP/IP server, an integer value between 256 and 65535.

If connection is 'serial', specify baud value, for example, 9600.

If you specify 'verbose', the function displays messages that contain progress information. You can use the messages to debug runtime failures.

Version History

Introduced in R2013a

See Also

Topics