SB-PWM - Sandbox PWM

The FPGA sandbox PWM block allows driving the PWM output from a user-made modulator from within the FPGA.

Information on FPGA edition is available on  Editing the FPGA firmware (sandbox) (PN116)

Usage examples of the FPGA sandbox PWM block are available on:

Because the user-generated FPGA signals still go through the PWM output chain, it supports dead time generation and can be activated or deactivated. More information is available on the PWM page.

Simulink block

Signal specification

The input A allows the activation (>0) or deactivation (<=0) of the PWM output(s).

Parameters

  • Device ID: selects which device to address when used in a multi-device configuration.
  • Show ”activate” input: makes the A signal input visible. If not checked, the CB-PWM block is active by default.
  • Output configuration:
    • use checkbox: selects which PWM outputs are driven from the FPGA sandbox
    • output configuration: selects between a single PWM signal or complementary signals with a deadtime.
    • dead-time: configures the dead-time duration if the Output mode is set at Dual (PWM_H + PWM_L).

Example of SB PWM configuration

Configuration of the SB-PWM block in Simulink
Mapping between sb_pwm and pwm ports of the imperix IP in Vivado

PLECS block

Signal specification

The input A allows the activation (>0) or deactivation (<=0) of the PWM output(s).

Parameters

  • Device ID selects which device to address when used in a multi-device configuration.
  • Output mode selects between a single PWM signal or complementary signals with a deadtime.
  • Output lane(s) or Output channel(s)(vectorizable) selects which PWM outputs are driven from the FPGA sandbox.
  • PWM activation makes the A signal input visible if the option Use block input is selected. If not, the CB-PWM block is activated by default.
  • Dead-time duration configures the dead-time duration if the Output mode is set at Dual (PWM_H + PWM_L).

C++ functions

Functions specific to the sandbox PWM

There is no function specific to the sandbox PWM. The function SbPwm_ConfigureOutputMode() must be used to select the PWM outputs to be driven from the FPGA sandbox.

Functions common to all PWM drivers

These functions are common to all PWM blocks. Further documentation is available on the PWM page.

void SbPwm_ConfigureOutputMode(tPwmOutput output, tPwmOutMode outMode, unsigned int device=0);Code language: C++ (cpp)

Selects the PWM output mode.

If the output mode selected is COMPLEMENTARY, a dead-time must be configured using the CbPwm_ConfigureDeadTime() function.

It has to be called in UserInit().

Parameters

  • output: the PWM channel or lane to address
  • outMode: the output mode to use (COMPLEMENTARYINDEPENDENT or PWMH_ACTIVE)
  • device: the B-Box/B-Board to address when used in a multi-device configuration
void SbPwm_ConfigureDeadTime(tPwmOutput output, float deadTime, unsigned int device=0);Code language: C++ (cpp)

Configures the dead-time duration if the output mode is set as COMPLEMENTARY.

It has to be called in UserInit().

Parameters

  • output: the PWM channel or lane to address
  • outMode: the output mode to use (COMPLEMENTARYINDEPENDENT or PWMH_ACTIVE)
  • device: the B-Box/B-Board to address when used in a multi-device configuration
void SbPwm_Activate(tPwmOutput output, unsigned int device=0);
Code language: C++ (cpp)

Activates the addressed PWM output(s). If the addressed PWM output has been set as COMPLEMENTARY or PWMH_ACTIVE this function acts on both outputs.

It can be called in UserInit() or in the control interrupt routine.

Parameters

  • output: the PWM channel or lane to address
  • device: the B-Box/B-Board to address when used in a multi-device configuration
void SbPwm_Deactivate(tPwmOutput output, unsigned int device=0);Code language: C++ (cpp)

Deactivates the addressed PWM output(s). If the addressed PWM output has been set as COMPLEMENTARY or PWMH_ACTIVE this function acts on both outputs.

It can be called in UserInit() or in the control interrupt routine.

Parameters

  • output: the PWM channel or lane to address
  • device: the B-Box/B-Board to address when used in a multi-device configuration