Main Content

Host-Target Communication

Motor Control Blockset™ uses a communication interface between the host model and the target model to control the motor and observe feedback.

Host Model

The host model is a user interface for the controller hardware board. Run the host model on the host computer. Before you run the host model on the host computer, make sure to deploy the target model on the controller hardware board.

The host model commands, controls, and exchanges data with the target hardware. You can perform these operations using the host model available in the Motor Control Blockset:

  • Find the serial communication port (COM port) in the host system. For more details, see Find Communication Port section in this page.

  • Configure the serial port and baud rate by using the Serial Setup block.

  • Start or stop the motor.

  • Specify the motor speed.

  • View the debug or output signals that the host receives from the target by using the Time Scope and Display blocks.

Target Model

The target model runs on the controller hardware board. Deploy the target model to the embedded target hardware that controls the motor. The target model communicates with the host model to receive commands from the user (for example, the command to start or stop the motor). Some common operations that a target model available in Motor Control Blockset performs:

  • Serial communication with the host model to receive user commands and exchange binary data.

  • Read data from the position and current sensors attached to the motor and inverter.

  • Control motor speed and torque by running the control algorithms and processing the feedback.

  • Generate duty cycle inputs for the inverter.

  • Enable fast serial data monitoring for debugging the signals.

Serial Communication Blocks

The host and target models interact by using these Motor Control Blockset blocks that enable serial communication:

  • Host Serial Receive

  • Host Serial Setup

  • Host Serial Transmit

Using these blocks you can monitor, control, and customize the motor operation in real time. For example, you can view the debug signals, stop or start the motor, and change the motor speed without repeated deployment of the target model.

Fast Serial Data Monitoring

The Motor Control Blockset example models use the fast serial data monitoring algorithm, which performs control and diagnostic operations through the host model. This algorithm enables you to observe data from the target device at the same rate as the execution sample time (for example, PWM frequency of 20kHz). This, in turn, helps in diagnostics and analysis of transients.

Evaluation boards often provide serial communication over USB connections that enable fast serial transfers. The models running on the Texas Instruments™ LaunchPad hardware boards send signals like Ia and Ib currents over the serial interface. Use the host model to receive these signals on your host computer. The Motor Control Blockset examples implementing Field Oriented Control (FOC) algorithm for the F28379D LaunchPad use mcb_pmsm_foc_host_model_f28379d.slx. Examples that implement the FOC algorithm for the F28069M targets, use mcb_pmsm_foc_host_model_f28069m.slx. The Motor Control Blockset also provides other host models for the application-based examples.

Selecting COM port and baud rate

Select the appropriate COM port that matches your board in the Serial Setup block of the host model. Adjust the baud rate for your board:

Texas Instruments LaunchPadBaud Rate

F28027 LaunchPad

3.75e6

F28069 LaunchPad

5.625e6

F28377S LaunchPad

12e6

F28379D LaunchPad

12e6

After you deploy the target model on the target device, run the host model and observe the debug signals update at 20 kHz, on the time scope. You can use the same technique to monitor other signals on other processors.

Note

SCI_A is usually connected to the FTDI chip that allows serial transfers over USB on the LaunchPad boards, docking stations, and ISO control cards.

Find Communication Port

Use these steps to find the serial communication port in the Device Manager of Windows® PC, after you connect the target hardware to your system:

  1. Open Device Manager on your Windows PC.

  2. Look for an entry under Ports (COM & LPT) titled USB Serial Port (COMX), where X is a number. You can note down this number to configure the serial setup block in the host model.

If you face difficulty in finding the COM port, follow these steps to determine the COM port:

  1. Open Device Manager on your Windows PC.

  2. Look for an entry under Ports (COM & LPT) titled USB Serial Port (COMX), where X is a number. If there are multiple COM ports, you can disconnect and reconnect the C2000 board and observe the updates in Device Manager to determine the COM port.

  3. Alternatively, follow these steps to determine the correct port name for the connected target hardware:

    1. Right-click a communication port and click Properties.

    2. In the Details tab, select Hardware Ids property.

    3. If the port indicates the following IDs, the communication port belongs to the connected TI’s C2000™ controller hardware board:

      • VID: 0403

      • PID: A6D0

  4. If you do not see or find the right port in Ports (COM & LPT), navigate to Texas Instruments Debug Probes and follow these steps:

    1. Right-click XDS100 Class Auxiliary Port Properties and select Properties. Navigate to Advanced tab and select Load VCP.

    2. Right-click XDS100 Class Debug Port Properties and select Properties. Navigate to Advanced tab and clear Load VCP.

    3. Disconnect and reconnect the USB cable to the system and observe the updates in Device Manager to determine the COM port. The system now displays the COM port that belongs to the connected TI’s C2000 controller hardware board.

    Tip

    VCP stands for Virtual COM Port (for devices that support serial over USB communication).

  5. If Texas Instruments Debug Probes do not appear in the Device Manager, expand Universal Serial Bus controllers in the Device Manager and follow these steps:

    1. Right-click TI XDS 100 Channel B and select Properties. Navigate to Advanced tab and select Load VCP.

    2. Right-click TI XDS 100 Channel A and select Properties. Navigate to Advanced tab and clear Load VCP.

    3. Disconnect and reconnect the USB cable to the system and observe the updates in Device Manager to determine the COM port. The system now displays the COM port that belongs to the connected TI’s C2000 controller hardware board.

  6. If Device Manager does not detect the target hardware, follow these steps:

    1. Check that the target hardware is connected to the system.

    2. Check if the device drivers are installed correctly. Generally, device drivers are installed with the Code Composer Studio™(CCS). Check if the CCS software is installed on your system. Alternatively, try re-installing the device drivers suggested by Texas Instruments.

    3. Check if the serial connection cable is intact.

    4. If the problem persists, try connecting the hardware to another system and check if Device Manager detects the hardware.

    5. If you still face the problem, the target hardware may be faulty.