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
simulates the field-oriented control (FOC) algorithm for implementing speed control for
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:
|Interface||Pin on LAUNCHXL-F28379D|
|Phase-A input of the motor||ADCINC2|
|Phase-B input of the motor||ADCINB2|
|PWM A output from the motor||EPWM1A|
|PWM B output from the motor||EPWM2A|
|PWM C output from the motor||EPWM3A|
|Enable Driver BOOSTXL-DRV8305||GPIO124|
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 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.
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.