Map Simulation Parameters to Peripheral Configuration Tool
SoC Blockset™ interface blocks, such as PWM Interface (SoC Blockset) and ADC Interface (SoC Blockset), provide a simulation specification of PWM and ADC behavior. To build and deploy the model to a supported hardware board, the simulation parameters in the interface blocks must be equivalently set in the Hardware Mapping (SoC Blockset) tool. These sections describe the mapping of parameters between the interface block and respective parameter groups in the Hardware Mapping tool.
ADC Parameter Mapping
The ADC Interface (SoC Blockset) block includes several generic parameters that specify the ADC measurement in simulation. When connected to a matching ADC Read (SoC Blockset) block, the Hardware Mapping (SoC Blockset) tool provides an equivalent set of hardware parameters for the specified hardware board.
In the Hardware Mapping tool, set the Simulink block parameter to the ADC Read (SoC Blockset) block that is connected to the ADC Interface block to be mapped. This table shows the relationship between the simulation parameters and the hardware parameters.
ADC Interface Block Parameter | Peripheral Configuration ADC Read Parameter | Conversion |
---|---|---|
Acquisition time (s) | SOCx Acquisition window
(cycles) | The SOC SOC The SYSCLKOUT parameter is defined in the Model Configuration Parameters for Texas Instruments C2000 Processors for the given CPU. |
Conversion time (s) | Not HW configurable | The Conversion time (s) is implicitly determined by the conversion granularity. For 12-bit conversion: Conversion time (s) = 10.5 x SYSCLKOUT / ADCCLKDIV Conversion time (s) = 29.5 * SYSCLKOUT / 5 The SYSCLKOUT and ADCCLKDIV parameters defined in the Model Configuration Parameters for Texas Instruments C2000 Processors for the given CPU. |
PWM Parameter Mapping
The PWM Interface (SoC Blockset) block includes several generic parameters that specify the PWM waveform in simulation. When connected to a matching PWM Write (SoC Blockset) block, the Hardware Mapping (SoC Blockset) tool provides an equivalent set of hardware parameters for the specified hardware board.
In the Hardware Mapping tool, set the Simulink block parameter to the PWM Write (SoC Blockset) block that is connected to the PWM Interface (SoC Blockset) block to be mapped. This table shows the relationship between the simulation parameters and the hardware parameters.
PWM Interface Block Parameters | Peripheral Configuration PWM Write Parameters | Conversion |
---|---|---|
PWM Period | Period (clock cycles) | The Period (clock cycles) parameter is measured in processor clock cycles. This expression shows how to derive the Period (clock cycles) parameter from the PWM Period parameter. Period (clock cycles) =
PWM Period x
The SYSCLKOUT and EPWM clock divider (EPWMCLKDIV) parameters are defined in the Model Configuration Parameters for Texas Instruments C2000 Processors for the given CPU. |
Counter Mode | Counting Mode | The value of the Counting Mode parameter must match the value of the Counter Mode parameter for equivalent execution in simulation and on hardware. |
Sampling Mode |
| The sampling mode applies for the all input parameters in simulation.
In the generated code, sampling mode can be configured for the
individual comparator registers reload conditions
(counter=zero , counter is
period , counter zero or
period ) |
Dead time (s) | Dead band (cycles) | The Dead band (cycles) parameter is given PWM clock cycles. This expression shows how to derive the Dead band (cycles) parameter from the Dead time (s) parameter. Dead band (cycles) = Dead time (s) x PWMClockVal PWMClockVal is calculated: PWMClockVal = SYSCLKOUT / (EPWMCLKDIV x HSPCLKDIV x TBCLK) The SYSCLKOUT and EPWM clock divider (EPWMCLKDIV) parameters are defined in the Model Configuration Parameters for Texas Instruments C2000 Processors for the given CPU. |
Event trigger mode |
| If the PWM Interface (SoC Blockset) block event signal is connected to an ADC Interface (SoC Blockset) block, then use the ADC start of conversion parameter. If the PWM Interface (SoC Blockset) block event signal is connected to a Task Manager (SoC Blockset) block, then use the PWM Interrupt parameter. |
|
| These parameters can be matched effectively one-to-one by using this conversion of parameter values.
|
Phase (degrees) |
| The Timer phase offset parameter is given in clock cycles and is dependent on the Enable phase offset parameter. This expression shows how to derive the Timer phase offset parameter from the Phase (degrees) parameter. Timer phase offset = PWMClockVal/(360/Phase (degrees) PWMClockVal is calculated as: PWMClockVal = SYSCLKOUT/EPWMCLKDIV/HSPCLKDIV/TBCLK The SYSCLKOUT and EPWM clock divider (EPWMCLKDIV) parameters are defined in the Model Configuration Parameters for Texas Instruments C2000 Processors for the given CPU. |
See Also
Hardware Mapping (SoC Blockset) | PWM Interface (SoC Blockset) | ADC Interface (SoC Blockset)