Main Content

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.

  1. Create a new SoC Blockset model and set the Hardware board parameter to TI F2837D Launchpad.

  2. Construct an empty event driven task that is driven by an ADC Interface block. This figure shows the sample model.

    SoC model top level

    SoC model ref level

  3. 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.

    SoC task with ADC block

  4. In the ADC block, set the SOCx trigger source parameter to Software.

  5. Launch the Hardware Mapping tool. Set the ADC_Task parameter to ADCA1_isr. This setting maps the ADCA1_isr interrupt to the task containing the ADC block.

  6. 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.

  1. Create a new SoC Blockset model and set the Hardware board parameter to TI F2837D Launchpad.

  2. Construct an empty event driven task that is driven by an ADC Interface block. This figure shows the sample model.

    SoC model top level

    SoC model ref level

  3. 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.

    Task model with ADC block

  4. In the ADC block, set the SOCx trigger source parameter to Software.

  5. Launch the Hardware Mapping tool. Set the ADC_Task parameter to ADCA1_isr. This maps the ADCA1_isr interrupt to the task containing the ADC block.

    Task mapping interrupts

  6. 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 TypeBlock Interrupt ParameterTask Mapping Interrupt Parameter
Analog to Digital Converter (ADC)ADCAnADCAn_isr
Pulse Width Modulator (PWM)EPWMn_TZEPWMn_TZ_isr
EPWMnEPWMn_isr
Electrically Evoked Compound Action Potential (ECAP)ECAPnECAPn_isr
Enhanced Quadrature Encoder Pulse (eQEP)EQEPnEQEPn_isr
Serial Peripheral Interface (SPI)SPIA_RX_isrSPIA_RX_isr
SPIA_TX_isrSPIA_TX_isr
Direct Memory Address (DMA)DMA_CHnDMA_CHn_isr
Inter-Integrated Circuit (I2C)I2CAI2CA_INT_isr
I2CA_FIFOI2CA_FIFO_isr
Serial Communication Interface (SCI)SCIA_RXSCIA_RX_isr
SCIA_TXSCIA_TX_isr
Controller Area Network (CAN)CANA_nCANA_n_isr
External Interrupt (XINT)XINTnXINTn_isr
Fixed Point Unit (FPU)FPU_OVERFLOWFPU_OVERFLOW_isr
FPU_UNDERFLOWFPU_UNDERFLOW_isr
Viterbi, Complex Math, and CRC Unit (VCU)VCUVCU_isr

See Also

| |