Creating a debug diagram

1.    Open the source diagram containing the compound block that describes the controller algorithm.

2.    Choose File > Save As and save the diagram with the same name but with a -d suffix. For example, if your source diagram is named BlinkLED.vsm, save your debug diagram as BlinkLED-d.vsm.

You are now working in your debug diagram.

3.    Choose Embedded > your-target-device >  your-target-device Config.

4.    Do one of the following:

      For C2000, ARM Cortex M3, and STM32: Under JTAG Connection, select the JTAG connector and click OK, or press ENTER.

      For Arduino: Under Virtual Comport, select the serial port number for your Arduino and click OK, or press ENTER.

      For Linux AMD64 and Raspberry Pi: Choose the IP address of the target.

5.    Choose System > System Properties and under the Range tab, do the following:

      Set Time Step to 0.01.

      Activate Run in Real-time, Auto Restart, and Retain State. Since the JTAG bandwidth is around 100-200Hz, there is little sense in running the diagram any faster, even though the target may be running much faster.

      Click OK, or press ENTER.

6.    From Embedded > your-target-device, insert a Target Interface block. The Target Interface block is automatically configured with the last OUT or ELF file created for the diagram, along with the same number of inputs and outputs the compound block had when you compiled it. An additional output pin to monitor %CPU usage is created.

7.    Wire the Target Interface block into the diagram in the same way that the compound block containing the simulated controller is wired.

8.    Connect a display block to the %CPU usage output pin on the Target Interface block.

9.    Choose File > Save.

10.  If the Target Interface block is not automatically configured, right-click the block and set the OUT or ELF file path and input and output pin counts.