MATLAB Link for Code Composer Studio Development Tools    

Configuring Communications Channels

Communications channels to the target do not exist until you open and enable them through the MATLAB Link for Code Composer Studio and CCS IDE. Opening channels consists of opening and configuring each channel for reading or writing, and enabling the channels.

In the open function, you provide the channel names as strings for the channel name property. The channel name you use is not random. The channel name string must match a channel defined in the executable file. If you specify a string that does not identify an existing channel in the executable, the open operation fails. In this tutorial, two channels exist on the target--ichan and ochan. Although the channels are named ichan for input channel and ochan for output channel, neither channel is configured for input or output until you configure them from MATLAB or CCS IDE. You could configure ichan as the output channel and ochan as the input channel. The links would work just the same. For simplicity, the tutorial configures ichan for input and ochan for output. One more note--read and write are defined as seen by the target. When you write data from MATLAB, you write to the channel that the target reads, ichan in this case. Conversely, when you read from the target, you read from ochan, the channel that the target writes to:

  1. Configure buffers in RTDX to store the data until MATLAB can read it into your workspace. Often, MATLAB cannot read data as quickly as the target can write it to the channel.
  1. Channel buffers are optional. Adding them provides a measure of insurance that data gets from your target to MATLAB without getting lost.

  1. Define one of the channels as a write channel. Use 'ichan' for the channel name and 'w' for the mode. Either 'w' or 'r' fits here, for write or read.
  2. Now enable the channel you opened.
  3. Repeat steps 2 and 3 to prepare a read channel.
  4. To use the new channels, enable RTDX by typing
  1. You could do this step before you configure the channels--the order does not matter.

  1. Reset the global timeout to 20 s to provide a little room for error. ccsdsp applies a default timeout value of 10 s. In some cases this may not be enough.
  2. Check that the timeout property value is now 20 s and that your link has the correct configuration for the rest of the tutorial.

  Creating the Links Running the Application