Main Content

Add Hardware Drivers to Simulation Model and Deploy to Target Hardware

This topic explains the steps for adding the hardware drivers to the simulation model and deploying the model to the target hardware.

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

As an example, the procedure explains about deploying the speed control algorithm 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 to the simulation model before deploying the control algorithm to the target hardware LAUNCHXL-F28379D (connected to BOOSTXL-DRV8305).

You can use MATLAB® variables to define or customize parameters like the execution time of the current controller or the speed controller. See the model initialization script associated with the example model mcb_pmsm_foc_sim for details about the variables defined in these steps.

To understand the prerequisites for deploying the control algorithm to any target hardware, see Prepare Target Hardware. For details about the hardware connections, see Hardware Connections.

To implement a simulation model that uses FOC algorithm for a PMSM, 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.