Main Content

Add Hardware Drivers to Simulation Model and Deploy to Target Hardware

This topic explains the steps to add hardware drivers to a simulation model and deploy the model to the target hardware.

This topic uses the model mcb_pmsm_foc_sim as a reference to explain the steps involved in the hardware deployment. The model mcb_pmsm_foc_sim simulates the field-oriented control (FOC) algorithm for implementing speed control for a PMSM.

The speed control algorithm is deployed to the target hardware Texas Instruments™ LAUNCHXL-F28379D (connected to Texas Instruments BOOSTXL-DRV8305). These are the hardware interface details:

InterfacePin on LAUNCHXL-F28379D
Phase-A input of the motorADCINC2
Phase-B input of the motorADCINB2
PWM A output from the motorEPWM1A
PWM B output from the motorEPWM2A
PWM C output from the motorEPWM3A
Enable Driver BOOSTXL-DRV8305GPIO124

These steps explain how to add the hardware driver blocks from the Embedded Coder® Support Package for Texas Instruments C2000™ Processors so as to deploy the control algorithm to the target hardware LAUNCHXL-F28379D (connected to BOOSTXL-DRV8305).

These steps use variables to define the datatypes, the execution time of the current controller, and the execution time of the speed controller. See the model initialization script of the example model mcb_pmsm_foc_sim for details on the variables defined in these steps.

To understand the prerequisites needed to deploy the control algorithm to any target hardware, see Prepare Target Hardware. For details related to the hardware connections, see Hardware Connections.

To implement a simulation model with a PMSM motor FOC control algorithm, see Design Field-Oriented Control Algorithm.

A basic understanding of Simulink® is a prerequisite to follow these steps. For details about the ADC driver, the quadrature encoder driver, and the hardware interrupt block, see the example model mcb_pmsm_foc_qep_f28379d, which uses an architecture similar to what we describe.

Note

For target hardware other than LAUNCHXL-F28379D (connected to BOOSTXL-DRV8305), you can follow these steps, but select the driver blocks (ADC, PWM, Interrupt) from the appropriate supported hardware library.