Use Embedded Coder blocks with SoC Blockset
You can use the Embedded Coder® Support Package for Texas Instruments™ C2000™ F28M3x Concerto™ Processors blocks in SoC Blockset™ and SoC Blockset Support Package for Texas Instruments C2000 Processors.
SoC Blockset blocks that interact with external hardware (for example ADC or PWM) come in pairs. The pair consists of a data input or output block, such as ADC Read, that simulates the behavior of the software drivers and an interface block, such as ADC Interface, that simulates the physical behavior of the hardware. During code generation, the data input or output block becomes the driver code for the given hardware peripheral and the interface block gets removed and replaced by the actual device hardware.
Embedded Coder Support Package for Texas Instruments C2000 Processors blocks are equivalent to the data input or output block in the SoC Blockset block pairs. In code generation, the support package blocks generate the appropriate driver code. In simulation, due to the lack of an interface pair, the blocks do not generate any data and can be treated equivalent to the Constant block for input blocks or the Terminator block for output blocks.
Note
You can add a simulation behavior by using Variant Subsystem, Variant Model block.
Add Embedded Coder into SoC Task
To configure an SoC Blockset model to use the Embedded Coder Support Package for Texas Instruments C2000 Processors driver blocks, follow these steps.
Create a new SoC Blockset model and set the Hardware board parameter to
TI F2837D Launchpad
.Construct an empty event driven task that is driven by an ADC Interface block. This figure shows the sample model.
In the Simulink® library browser, from the Embedded Coder Support Package for Texas Instruments C2000 Processors > F2837xD group, add the ADC block to the task in the model.
In the ADC block, set the SOCx trigger source parameter to
Software
.Launch the Hardware Mapping tool. Set the ADC_Task parameter to
ADCA1_isr
. This setting maps theADCA1_isr
interrupt to the task containing the ADC block.Use the SoC Builder tool to deploy the model to the connected
TI F2837D Launchpad
. The ADC block can now sample the ADCs from the hardware.
Link Embedded Coder Interrupts to Events
To configure an SoC Blockset model to generate interrupts mapped to the Embedded Coder Support Package for Texas Instruments C2000 Processors blocks, follow these steps.
Create a new SoC Blockset model and set the Hardware board parameter to
TI F2837D Launchpad
.Construct an empty event driven task that is driven by an ADC Interface block. This figure shows the sample model.
In the Simulink library browser, from the Embedded Coder Support Package for Texas Instruments C2000 Processors > F2837xD group, add the ADC block to the task in the model.
In the ADC block, set the SOCx trigger source parameter to
Software
.Launch the Hardware Mapping tool. Set the ADC_Task parameter to
ADCA1_isr
. This maps theADCA1_isr
interrupt to the task containing the ADC block.Use the SoC Builder tool to deploy the model to the connected
TI F2837D Launchpad
. The ADC blocks can now samples the ADCs from the hardware on the specified interrupt.
This table shows the mapping between the interrupts in the Embedded Coder Support Package for Texas Instruments C2000 Processors blocks and the interrupts in the Hardware Mapping tool.
Interrupt Type | Block Interrupt Parameter | Task Mapping Interrupt Parameter |
---|---|---|
Analog to Digital Converter (ADC) | ADC | ADC |
Pulse Width Modulator (PWM) | EPWM | EPWM |
EPWM | EPWM | |
Electrically Evoked Compound Action Potential (ECAP) | ECAP | ECAP |
Enhanced Quadrature Encoder Pulse (eQEP) | EQEP | EQEP |
Serial Peripheral Interface (SPI) | SPI | SPI |
SPI | SPI | |
Direct Memory Address (DMA) | DMA_CH | DMA_CH |
Inter-Integrated Circuit (I2C) | I2C | I2C |
I2C | I2C | |
Serial Communication Interface (SCI) | SCI | SCI |
SCI | SCI | |
Controller Area Network (CAN) | CAN | CAN |
External Interrupt (XINT) | XINT | XINT |
Fixed Point Unit (FPU) | FPU_OVERFLOW | FPU_OVERFLOW_isr |
FPU_UNDERFLOW | FPU_UNDERFLOW_isr | |
Viterbi, Complex Math, and CRC Unit (VCU) | VCU | VCU_isr |