Main Content

Signal Logging and Parameter Tuning in XCP External Mode with Packed Mode

This example shows how to perform parameter tuning and data logging with a Simulink® model enabled with Packed Mode running on Texas Instruments™ C2000™ targets.

Packed Mode leads to enhanced signal logging performance in models containing signals of high sample rates. However, the enhanced performance comes at an additional cost because Packed Mode requires higher RAM on the target as multiple samples need to be stored on the target before transmission.

Introduction

XCP External Mode is used to log signal data and tune parameters on the Texas Instruments C2000 targets in real-time. However, there is a limited bandwidth available for communication between the host and target. This limits the data that can be sent from the target. With Packed Mode, multiple data points of multiple signals are combined in a single packet which is sent over a transport. This reduces the overhead introduced by additional bytes of framing the packet.

Prerequisite

Complete the Getting Started with Embedded Coder Support Package for TI C2000 Processors video.

Note: Starting R2023a, the workflow for getting started tutorial for support package will continue to support in C2000™ Microcontroller Blockset.

Required Hardware

Any Texas Instruments C2000 board

Model

Open the pre-configured c28x_xcp_packed model.

This is a multirate model where you log signals at the sample rates of 25 microseconds and 50 microseconds. It is preconfigured to run on the F28379D LaunchPad at a baud rate of 12 Mbps.

Configuring the Model

In this example, you will configure a Simulink® model and enable packed mode.

Note: These steps are not required in the pre-configured model. Perform these steps if you have changed the hardware or not using the pre-configured model.

1. Open the model.

2. In the Hardware tab, in the Prepare gallery, select Control Panel.

3. In the External Model Control Panel, click Signal & Triggering.

4. In the External & Signal Triggering dialog box, select Send multiple contiguous samples in same packet and enter a value for Duration.

This enables the XCP Packed mode and multiple contiguous samples are sent in a single packet whose length is the value specified for Duration parameter.

Note: Clearing the Send multiple contiguous samples in same packet option might lead to data drops. To optimize the performance and memory utilization, tune the value of Duration parameter.

5. Click Apply and OK.

6. In the Hardware tab, click Hardware Settings to open the Configuration Parameters dialog box.

7. In the Hardware Implementation window, navigate to Target hardware resources > External Mode.

8. Set the parameter Maximum number of contiguous samples to a value greater than or equal to the value of Duration parameter set in External Mode Control Panel. This parameter dictates the maximum number of samples that can be filled in a single packet and the memory is allocated accordingly.

Note: The Duration parameter can be changed dynamically to any value that is less than or equal to Maximum number of contiguous samples without rebuilding the model.

9. Click Apply and OK.

Initiate Monitor and Tune Action for the Model

On the Hardware tab of the Simulink toolstrip, click Monitor & Tune to monitor signals and tune parameters.