MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
eFlexPWM: Enhanced Flexible Pulse Width Modulator Driver

Read Guidance

This document consists of sections titled with Driver Overview, Data Structures, Enumerations, Functions, etc., each with an overview list and detailed documentation. It is recommended to read the Driver Overview first for it includes a comprehensive description of the peripheral, driver and driver changes. Other sections give detailed information for APIs, enums, macros, etc., for your further reference.

Driver Overview

 The Driver Change Log
 The current PWM driver version is 2.0.0.
 
 eFlexPWM Peripheral and Driver Overview
 Content including 1) peripheral features, work logic and work method; 2) driver design logic and use method; 3) typical use case.
 

Data Structures

struct  pwm_sm_counter_config_t
 The structure for configuring PWM submodule counter logic. More...
 
struct  pwm_sm_reload_logic_config_t
 The structure for configuring PWM submodule reload logic. More...
 
struct  pwm_sm_value_register_config_t
 The structure for configuring PWM submodule value registers. More...
 
struct  pwm_sm_force_logic_config_t
 The structure for configuring PWM submodule force logic. More...
 
struct  pwm_sm_deadtime_value_t
 The structure of the inserted dead time value, applies only to KPWM_Complementaryxxx mode. More...
 
struct  pwm_sm_deadtime_logic_config_t
 The structure for configuring PWM submodule force out logic, works on the deadtime logic output. More...
 
struct  pwm_sm_fractional_delay_logic_config_t
 The structure for configuring PWM submodule fractional delay logic, works on the deadtime logic output. More...
 
struct  pwm_sm_output_logic_config_t
 The structure for configuring PWM submodule output logic. More...
 
struct  pwm_sm_input_capture_config_t
 The structure for configuring PWM submodule input capture logic. More...
 
struct  pwm_sm_capture_dma_config_t
 The structure for configuring PWM submodule read capture DMA. More...
 
struct  pwm_sm_dma_config_t
 The structure for configuring PWM submodule DMA. More...
 
struct  pwm_sm_fault_input_mapping_t
 The enumeration for PWM submodule output fault enable mask for one fault protection channel. More...
 
struct  pwm_sm_config_t
 PWM submodule config structure. More...
 
struct  pwm_fault_protection_config_t
 The structure for configuring PWM fault protection channel, a PWM module can have multiple fault protection channels, PWM sub-module can choose to mapping any one or more fault input from fault protection channels. More...
 
struct  pwm_config_t
 PWM module config structure which contain submodule config structure pointers and fault protection filter config structure pointers. More...
 

Enumerations

enum  pwm_sm_number_t {
  kPWM_SubModule0 = 0U,
  kPWM_SubModule1,
  kPWM_SubModule2,
  kPWM_SubModule3
}
 The enumeration for PWM submodule number. More...
 
enum  _pwm_sm_enable {
  kPWM_SubModule0Enable = (1U << 0U),
  kPWM_SubModule1Enable = (1U << 1U),
  kPWM_SubModule2Enable = (1U << 2U),
  kPWM_SubModule3Enable = (1U << 3U)
}
 The enumeration for PWM submodule enable. More...
 
enum  pwm_sm_count_clock_source_t {
  kPWM_ClockSrcBusClock = 0U,
  kPWM_ClockSrcExternalClock,
  kPWM_ClockSrcSubmodule0Clock
}
 The enumeration for PWM submodule clock source. More...
 
enum  pwm_sm_count_clock_prescaler_t {
  kPWM_ClockPrescaleDivide1 = 0U,
  kPWM_ClockPrescaleDivide2,
  kPWM_ClockPrescaleDivide4,
  kPWM_ClockPrescaleDivide8,
  kPWM_ClockPrescaleDivide16,
  kPWM_ClockPrescaleDivide32,
  kPWM_ClockPrescaleDivide64,
  kPWM_ClockPrescaleDivide128
}
 The enumeration for PWM submodule prescaler factor selection for clock source. More...
 
enum  pwm_sm_count_init_source_t {
  kPWM_InitOnLocalSync = 0U,
  kPWM_InitOnMasterReload,
  kPWM_InitOnMasterSync,
  kPWM_InitOnExtSync
}
 The enumeration for PWM submodule counter initialization options. More...
 
enum  pwm_sm_reload_signal_select_t {
  kPWM_LocalReloadSignal = 0U,
  kPWM_MasterReloadSignal
}
 The enumeration for PWM submodule local reload take effect timing. More...
 
enum  pwm_sm_local_reload_effect_timing_t {
  kPWM_TakeEffectAtReloadOportunity = 0U,
  kPWM_TakeEffectImmediately
}
 The enumeration for PWM submodule local reload take effect timing. More...
 
enum  pwm_sm_local_reload_oportunity_t {
  kPWM_LoadEveryOportunity = 0U,
  kPWM_LoadEvery2Oportunity,
  kPWM_LoadEvery3Oportunity,
  kPWM_LoadEvery4Oportunity,
  kPWM_LoadEvery5Oportunity,
  kPWM_LoadEvery6Oportunity,
  kPWM_LoadEvery7Oportunity,
  kPWM_LoadEvery8Oportunity,
  kPWM_LoadEvery9Oportunity,
  kPWM_LoadEvery10Oportunity,
  kPWM_LoadEvery11Oportunity,
  kPWM_LoadEvery12Oportunity,
  kPWM_LoadEvery13Oportunity,
  kPWM_LoadEvery14Oportunity,
  kPWM_LoadEvery15Oportunity,
  kPWM_LoadEvery16Oportunity
}
 The enumeration for PWM submodule reload opportunities selection under kPWM_ReloadWithLocalReloadOportunity. More...
 
enum  pwm_sm_val_compare_mode_t {
  kPWM_CompareOnEqual = 0U,
  kPWM_CompareOnEqualOrGreater
}
 The enumeration for PWM submodule VALn register compare mode. More...
 
enum  pwm_sm_val_register_t {
  kPWM_VAL0 = 0U,
  kPWM_VAL1,
  kPWM_VAL2,
  kPWM_VAL3,
  kPWM_VAL4,
  kPWM_VAL5
}
 The enumeration for PWM submodule VAL registers. More...
 
enum  pwm_sm_force_signal_select_t {
  kPWM_LocalSoftwareForce = 0U,
  kPWM_MasterSoftwareForce,
  kPWM_LocalReloadForce,
  kPWM_MasterReloadForce,
  kPWM_LocalSyncForce,
  kPWM_MasterSyncForce,
  kPWM_ExternalForceForce,
  kPWM_ExternalSyncForce
}
 The enumeration for PWM submodule FORCE_OUT source which can trigger force logic output update. More...
 
enum  pwm_sm_force_deadtime_source_t {
  kPWM_GeneratedPwm = 0U,
  kPWM_InvertedGeneratedPwm,
  kPWM_SoftwareControlValue,
  kPWM_UseExternal
}
 The enumeration for PWM submodule force out logic output (PWM23 and PWM45) source, which will transfer to output logic when a FORCE_OUT signal is asserted. More...
 
enum  pwm_sm_force_software_output_value_t {
  kPWM_SoftwareOutputLow = 0U,
  kPWM_SoftwareOutputHigh
}
 The enumeration for PWM submodule software controlled force out signal value. More...
 
enum  pwm_sm_deadtime_logic_mode_t {
  kPWM_Independent = 0U,
  kPWM_IndependentWithDoubleSwitchPwm,
  kPWM_IndependentWithSplitDoubleSwitchPwm,
  kPWM_ComplementaryWithPwmA,
  kPWM_ComplementaryWithPwmB,
  kPWM_ComplementaryWithDoubleSwitchPwm
}
 The enumeration for PWM submodule deadtime logic mode, which decide how the deadtime logic process the force logic output signal. More...
 
enum  pwm_sm_fracval_register_t {
  kPWM_FRACVAL1 = 1U,
  kPWM_FRACVAL2,
  kPWM_FRACVAL3,
  kPWM_FRACVAL4,
  kPWM_FRACVAL5
}
 The enumeration for PWM submodule FRACVAL registers. More...
 
enum  pwm_sm_mux_trigger_source_t {
  kPWM_ActualCompareEvent = 0U,
  kPWM_PwmOutput
}
 The enumeration for PWM submodule output logic final trigger output port signal. More...
 
enum  pwm_sm_pwm_output_on_fault_t {
  kPWM_OutputLowOnFault = 0U,
  kPWM_OutputHighOnFault,
  kPWM_OutputTristatedOnFault
}
 The enumeration for PWM submodule output logic PWM output fault status. More...
 
enum  pwm_sm_pwmx_signal_select_t {
  kPWM_RawPwmX = 0U,
  kPWM_DoubleSwitch
}
 The enumeration for PWM submodule output logic PwmX signal input source (before output polarity/mask/enable control). More...
 
enum  pwm_sm_pwm_out_t {
  kPWM_PwmX = 0U,
  kPWM_PwmA,
  kPWM_PwmB
}
 The enumeration for PWM submodule PWM output. More...
 
enum  pwm_sm_input_capture_pin_t {
  kPWM_InputCapturePwmX = 0U,
  kPWM_InputCapturePwmA,
  kPWM_InputCapturePwmB
}
 The enumeration for PWM submodule input capture pins. More...
 
enum  pwm_sm_input_capture_source_t {
  kPWM_RawInput = 0U,
  kPWM_InputEdgeCounter
}
 The enumeration for PWM submodule input capture source. More...
 
enum  pwm_sm_input_capture_edge_t {
  kPWM_Noedge = 0U,
  kPWM_FallingEdge,
  kPWM_RisingEdge,
  kPWM_RiseAndFallEdge
}
 The enumeration for PWM submodule input capture edge when choose raw input as capture source. More...
 
enum  pwm_sm_input_capture_register_t {
  kPWM_InpCaptureVal0 = 0U,
  kPWM_InpCaptureVal1 = 2U,
  kPWM_InpCaptureVal2 = 4U,
  kPWM_InpCaptureVal3 = 6U,
  kPWM_InpCaptureVal4 = 8U,
  kPWM_InpCaptureVal5 = 10U
}
 The enumeration for PWM submodule input capture value register. More...
 
enum  pwm_sm_capture_dma_source_t {
  kPWM_FIFOWatermarksORDma = 0x1U,
  kPWM_FIFOWatermarksANDDma = 0x5U,
  kPWM_LocalSyncDma = 0x2u,
  kPWM_LocalReloadDma = 0x3U
}
 The enumeration for the source which can trigger the DMA read requests for the capture FIFOs. More...
 
enum  _pwm_sm_interrupt_enable {
  kPWM_CompareVal0InterruptEnable = (1U << 0),
  kPWM_CompareVal1InterruptEnable = (1U << 1),
  kPWM_CompareVal2InterruptEnable = (1U << 2),
  kPWM_CompareVal3InterruptEnable = (1U << 3),
  kPWM_CompareVal4InterruptEnable = (1U << 4),
  kPWM_CompareVal5InterruptEnable = (1U << 5),
  kPWM_CaptureX0InterruptEnable = (1U << 6),
  kPWM_CaptureX1InterruptEnable = (1U << 7),
  kPWM_CaptureB0InterruptEnable = (1U << 8),
  kPWM_CaptureB1InterruptEnable = (1U << 9),
  kPWM_CaptureA0InterruptEnable = (1U << 10),
  kPWM_CaptureA1InterruptEnable = (1U << 11),
  kPWM_ReloadInterruptEnable = (1U << 12),
  kPWM_ReloadErrorInterruptEnable = (1U << 13)
}
 The enumeration for PWM submodule interrupt enable. More...
 
enum  pwm_sm_status_flags_t {
  kPWM_CompareVal0Flag = (1U << 0),
  kPWM_CompareVal1Flag = (1U << 1),
  kPWM_CompareVal2Flag = (1U << 2),
  kPWM_CompareVal3Flag = (1U << 3),
  kPWM_CompareVal4Flag = (1U << 4),
  kPWM_CompareVal5Flag = (1U << 5),
  kPWM_CaptureX0Flag = (1U << 6),
  kPWM_CaptureX1Flag = (1U << 7),
  kPWM_CaptureB0Flag = (1U << 8),
  kPWM_CaptureB1Flag = (1U << 9),
  kPWM_CaptureA0Flag = (1U << 10),
  kPWM_CaptureA1Flag = (1U << 11),
  kPWM_ReloadFlag = (1U << 12),
  kPWM_ReloadErrorFlag = (1U << 13),
  kPWM_RegUpdatedFlag = (1U << 14)
}
 The enumeration for PWM submodule status flags. More...
 
enum  pwm_sm_typical_output_mode_t {
  kPWM_SignedCenterAligned = 0U,
  kPWM_CenterAligned,
  kPWM_SignedEdgeAligned,
  kPWM_EdgeAligned
}
 The enumeration for some PWM submodule PWM_A/B typical output mode. More...
 
enum  pwm_fault_protection_channel_t {
  kPWM_FaultProtection0 = 0U,
  kPWM_FaultProtection1
}
 The enumeration for PWM fault protection channel number. More...
 
enum  _pwm_fault_protection_interrupt_enable {
  kPWM_Fault0InterruptEnable = (1U << 0U),
  kPWM_Fault1InterruptEnable = (1U << 1U),
  kPWM_Fault2InterruptEnable = (1U << 2U),
  kPWM_Fault3InterruptEnable = (1U << 3U)
}
 The enumeration for PWM module fault protection channel interrupt enable. More...
 
enum  _pwm_fault_protection_status_flags {
  kPWM_Fault0Flag = (1U << 0U),
  kPWM_Fault1Flag = (1U << 1U),
  kPWM_Fault2Flag = (1U << 2U),
  kPWM_Fault3Flag = (1U << 3U),
  kPWM_FaultPin0ActiveFlag = (1U << 8U),
  kPWM_FaultPin1ActiveFlag = (1U << 9U),
  kPWM_FaultPin2ActiveFlag = (1U << 10U),
  kPWM_FaultPin3ActiveFlag = (1U << 11U)
}
 The enumeration for PWM module fault protection status flags. More...
 
enum  pwm_fault_input_active_level_t {
  kPWM_Logic0 = 0U,
  kPWM_Logic1
}
 The enumeration for PWM fault protection channel number. More...
 

Driver version

#define FSL_PWM_DRIVER_VERSION   (MAKE_VERSION(2, 0, 0))
 Version 2.0.0.
 

Initialization And De-initialization Interfaces

void PWM_Init (PWM_Type *base, const pwm_config_t *psConfig)
 Initialization PWM module with provided structure pwm_config_t. More...
 
void PWM_Deinit (PWM_Type *base)
 De-initialization a PWM module. More...
 
void PWM_GetSMDefaultConfig (pwm_sm_config_t *psConfig)
 Gets an default PWM submodule's configuration. More...
 
void PWM_GetFaultProtectionDefaultConfig (pwm_fault_protection_config_t *psConfig)
 Gets an default fault protection channel's configuration. More...
 

Submodule PWM Generation Related Interfaces

void PWM_SetupSMConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_config_t *psConfig)
 Sets up the PWM submodule configure. More...
 
static void PWM_SetupCounterConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_counter_config_t *psConfig)
 Sets up the PWM submodule counter configure. More...
 
static void PWM_SetCounterInitialValue (PWM_Type *base, pwm_sm_number_t eSubModule, uint16_t u16InitialValue)
 Sets the PWM submodule counter initial register value. More...
 
static void PWM_SetupReloadLogicConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_reload_logic_config_t *psConfig)
 Sets up the PWM submodule reload logic configure. More...
 
void PWM_GetValueConfig (pwm_sm_value_register_config_t *psConfig, pwm_sm_typical_output_mode_t eTypicalOutputMode, uint16_t u16PwmPeriod, uint16_t u16PwmAPulseWidth, uint16_t u16PwmBPulseWidth)
 Update PWM submodule compare value configuration according to the typical output mode. More...
 
static void PWM_SetupValRegisterConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_value_register_config_t *psConfig)
 Sets up the PWM submodule VALn registers logic configure. More...
 
static void PWM_SetValueRegister (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_val_register_t eRegister, uint16_t u16Value)
 Sets the PWM submodule VALn register value. More...
 
static uint16_t PWM_GetValueRegister (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_val_register_t eRegister)
 Gets the PWM submodule VALn register value. More...
 
static void PWM_SetFracvalRegister (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_fracval_register_t eRegister, uint16_t u16Value)
 Sets the PWM submodule fractional value register value. More...
 
static uint16_t PWM_GetFracvalRegister (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_fracval_register_t eRegister)
 Sets the PWM submodule fractional value register value. More...
 
static void PWM_SetValueAndFracRegister (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_fracval_register_t eRegister, uint32_t u32Value)
 Set submodule register VALx and its FRAC value with 32bit access. More...
 
static uint32_t PWM_GetValueAndFracRegister (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_fracval_register_t eRegister)
 Get submodule register VALx and its FRAC value with 32bit access. More...
 
static void PWM_SetPwmLdok (PWM_Type *base, uint16_t u16Mask)
 Set the PWM LDOK bit on a single or multiple submodules. More...
 
static void PWM_ClearPwmLdok (PWM_Type *base, uint16_t u16Mask)
 Clear the PWM LDOK bit on a single or multiple submodules. More...
 
static void PWM_SetupForceLogicConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_force_logic_config_t *psConfig)
 brief Sets up the PWM submodule force logic configure. More...
 
static void PWM_SetSoftwareForce (PWM_Type *base, pwm_sm_number_t eSubModule)
 Sets up the PWM Sub-Module to trigger a software FORCE_OUT event. More...
 
void PWM_SetupDeadtimeConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_deadtime_logic_config_t *psConfig)
 Sets up the PWM submodule deadtime logic configure. More...
 
static uint16_t PWM_GetDeadtimeSampleValue (PWM_Type *base, pwm_sm_number_t eSubModule)
 Get the sampled values of the PWM_X input at the end of each deadtime. More...
 
void PWM_SetupFractionalDelayConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_fractional_delay_logic_config_t *psConfig)
 Sets up the PWM submodule fractional delay logic configure. More...
 
void PWM_SetupOutputConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_output_logic_config_t *psConfig)
 Sets up the PWM submodule output logic configure. More...
 
static void PWM_EnableOutput (PWM_Type *base, uint16_t u16SubModules, pwm_sm_pwm_out_t eOutput)
 Enables the PWM submodule pin output. More...
 
static void PWM_DisableOutput (PWM_Type *base, uint16_t u16SubModules, pwm_sm_pwm_out_t eOutput)
 Disables the PWM submodule pin output. More...
 
static void PWM_EnableCombinedOutput (PWM_Type *base, uint16_t u16XSubModules, uint16_t u16ASubModules, uint16_t u16BSubModules)
 Enables the PWM pin combination output. More...
 
static void PWM_DisableCombinedOutput (PWM_Type *base, uint16_t u16XSubModules, uint16_t u16ASubModules, uint16_t u16BSubModules)
 Disables the PWM pin combination output. More...
 
static void PWM_MaskOutput (PWM_Type *base, uint16_t u16SubModules, pwm_sm_pwm_out_t eOutput)
 Mask the PWM pin output. More...
 
static void PWM_UnmaskOutput (PWM_Type *base, uint16_t u16SubModules, pwm_sm_pwm_out_t eOutput)
 Unmask the PWM pin output. More...
 
static void PWM_MaskCombinedOutput (PWM_Type *base, uint16_t u16XSubModules, uint16_t u16ASubModules, uint16_t u16BSubModules)
 Mask the PWM pin combination output. More...
 
static void PWM_UnmaskCombinedOutput (PWM_Type *base, uint16_t u16XSubModules, uint16_t u16ASubModules, uint16_t u16BSubModules)
 Unmask the PWM pin combination output. More...
 
static void PWM_UpdateMask (PWM_Type *base, pwm_sm_number_t eSubModule)
 Update PWM output mask bits immediately with a software command. More...
 
static void PWM_EnablePwmRunInDebug (PWM_Type *base, pwm_sm_number_t eSubModule, bool bEnable)
 Enables/Disables the PWM submodule continue to run while the chip is in DEBUG mode. More...
 
static void PWM_EnablePwmRunInWait (PWM_Type *base, pwm_sm_number_t eSubModule, bool bEnable)
 Enables/Disables the PWM submodule continue to run while the chip is in WAIT mode. More...
 
static void PWM_EnableCounters (PWM_Type *base, uint16_t u16Mask)
 Starts the PWM submodule counter for a single or multiple submodules. More...
 
static void PWM_DisableCounters (PWM_Type *base, uint16_t u16Mask)
 Stops the PWM counter for a single or multiple submodules. More...
 

Submodule Input Capture Related Interfaces

static uint16_t PWM_GetCaptureValue (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_register_t eRegister)
 Reads PWM submodule input capture value register. More...
 
static uint16_t PWM_GetCaptureValueCycle (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_register_t eRegister)
 Reads PWM submodule input capture value cycle register. More...
 
static uint16_t PWM_GetCaptureEdgeCounterVaule (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_pin_t eInputPin)
 Reads the PWM submodule input capture logic edge counter value. More...
 
void PWM_SetupInputCaptureConfig (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_pin_t eInputPin, const pwm_sm_input_capture_config_t *psConfig)
 Sets up the PWM submodule input capture configure. More...
 
static void PWM_EnableInputCapture (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_pin_t eInputPin)
 Enables the PWM submodule input capture operation. More...
 
static void PWM_DisableInputCapture (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_pin_t eInputPin)
 Disables the PWM submodule input capture operation. More...
 
static uint16_t PWM_GetInputValue (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_input_capture_pin_t eInputPin)
 Get the logic value currently being driven into the PWM inputs. More...
 

Fault Protection Channel Related Interfaces

void PWM_SetupFaultProtectionConfig (PWM_Type *base, pwm_fault_protection_channel_t eFaultProtection, const pwm_fault_protection_config_t *psConfig)
 Sets up the PWM fault protection channel configure. More...
 
static void PWM_SetupSMFaultInputMapping (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_pwm_out_t ePwmOutput, const pwm_sm_fault_input_mapping_t *psMapping)
 Mapping fault protection channel fault input status to PWM submodule output,. More...
 

DMA Control Interfaces

void PWM_SetupDmaConfig (PWM_Type *base, pwm_sm_number_t eSubModule, const pwm_sm_dma_config_t *psConfig)
 Sets up the PWM submodule DMA configure. More...
 
static void PWM_SetEnabledCaptureDmaSource (PWM_Type *base, pwm_sm_number_t eSubModule, pwm_sm_capture_dma_source_t eCaptureDmaSource)
 Select the trigger source for enabled capture FIFOs DMA read request. More...
 

Interrupts Interface

static void PWM_EnableSMInterrupts (PWM_Type *base, pwm_sm_number_t eSubModule, uint16_t u16Mask)
 Enables the PWM submodule interrupts according to a provided mask. More...
 
static void PWM_DisbaleSMInterrupts (PWM_Type *base, pwm_sm_number_t eSubModule, uint16_t u16Mask)
 Disables the PWM submodule interrupts according to a provided mask. More...
 
static void PWM_EnableFaultInterrupts (PWM_Type *base, pwm_fault_protection_channel_t eFaultProtection, uint16_t u16Mask)
 Enables the PWM fault protection channel interrupt according to a provided mask. More...
 
static void PWM_DisableFaultInterrupts (PWM_Type *base, pwm_fault_protection_channel_t eFaultProtection, uint16_t u16Mask)
 Disables the PWM fault protection channel interrupt according to a provided mask. More...
 

Status Flag Interfaces

static uint16_t PWM_GetSMStatusFlags (PWM_Type *base, pwm_sm_number_t eSubModule)
 Gets the PWM submodule status flags. More...
 
static void PWM_ClearSMStatusFlags (PWM_Type *base, pwm_sm_number_t eSubModule, uint16_t u16Mask)
 Clears the PWM submodule status flags. More...
 
static uint16_t PWM_GetFaultStatusFlags (PWM_Type *base, pwm_fault_protection_channel_t eFaultProtection)
 Enables the PWM fault protection channel interrupt according to a provided mask. More...
 
static void PWM_ClearFaultStatusFlags (PWM_Type *base, pwm_fault_protection_channel_t eFaultProtection, uint16_t u16Mask)
 Disables the PWM fault protection channel interrupt according to a provided mask. More...
 

Data Structure Documentation

struct pwm_sm_counter_config_t

Data Fields

pwm_sm_count_clock_source_t eCountClockSource: 2U
 Configures PWM submodule counter clock source. More...
 
pwm_sm_count_clock_prescaler_t eCountClockPrescaler: 3U
 Configures PWM submodule counter clock source prescaler. More...
 
pwm_sm_count_init_source_t eCountInitSource: 2U
 Configures PWM submodule counter initial source. More...
 
bool bEnableForceInitial: 1U
 Enable force-controlled initialization. More...
 
uint16_t u16PhaseDelayValue
 Defines the delay from the master sync signal of submodule 0 to this submodule counter (the unit of delay is the PWM clock cycle), only works when chose kPWM_InitOnMasterSync as initial source. More...
 

Field Documentation

pwm_sm_count_clock_source_t pwm_sm_counter_config_t::eCountClockSource
pwm_sm_count_clock_prescaler_t pwm_sm_counter_config_t::eCountClockPrescaler
pwm_sm_count_init_source_t pwm_sm_counter_config_t::eCountInitSource
bool pwm_sm_counter_config_t::bEnableForceInitial

The assert FORCE_OUT signal can to initialize the counter without regard to the selected initial source.

uint16_t pwm_sm_counter_config_t::u16PhaseDelayValue
struct pwm_sm_reload_logic_config_t

Data Fields

pwm_sm_reload_signal_select_t eReloadSignalSelect: 1U
 
Configures PWM submodule RELOAD signal source to be

local reload signal or master reload signal. More...

 
pwm_sm_local_reload_effect_timing_t eLoclReloadEffectTime: 1U
 
         Configures PWM submodule local reload signal

effective timing when choose it as RELOAD signal source. More...

 
bool bEnableFullCycleReloadOportunity: 1U
 Enable generate a reload opportunity on PWM half cycle (count from INIT value to VAL0). More...
 
bool bEnableHalfCycleReloadOportunity: 1U
 Enable generate a reload opportunity on PWM full cycle (count from INIT value to VAL1). More...
 
pwm_sm_local_reload_oportunity_t eLocalReloadOportunity: 4U
 Configures PWM submodule reload frequency when using local reload opportunities mode . More...
 

Field Documentation

pwm_sm_reload_signal_select_t pwm_sm_reload_logic_config_t::eReloadSignalSelect
pwm_sm_local_reload_effect_timing_t pwm_sm_reload_logic_config_t::eLoclReloadEffectTime
bool pwm_sm_reload_logic_config_t::bEnableFullCycleReloadOportunity
bool pwm_sm_reload_logic_config_t::bEnableHalfCycleReloadOportunity
pwm_sm_local_reload_oportunity_t pwm_sm_reload_logic_config_t::eLocalReloadOportunity
struct pwm_sm_value_register_config_t

Data Fields

uint16_t u16CounterInitialValue
 Configures PWM submodule counter initial value. More...
 
uint16_t u16ValRegister0
 Configures PWM submodule value register 0 (VAL0) value. More...
 
uint16_t u16ValRegister1
 Configures PWM submodule value register 1 (VAL1) value. More...
 
uint16_t u16ValRegister2
 Configures PWM submodule value register 2 (VAL2) value. More...
 
uint16_t u16ValRegister3
 Configures PWM submodule value register 3 (VAL3) value. More...
 
uint16_t u16ValRegister4
 Configures PWM submodule value register 4 (VAL4) value. More...
 
uint16_t u16ValRegister5
 Configures PWM submodule value register 5 (VAL5) value. More...
 

Field Documentation

uint16_t pwm_sm_value_register_config_t::u16CounterInitialValue
uint16_t pwm_sm_value_register_config_t::u16ValRegister0
uint16_t pwm_sm_value_register_config_t::u16ValRegister1
uint16_t pwm_sm_value_register_config_t::u16ValRegister2
uint16_t pwm_sm_value_register_config_t::u16ValRegister3
uint16_t pwm_sm_value_register_config_t::u16ValRegister4
uint16_t pwm_sm_value_register_config_t::u16ValRegister5
struct pwm_sm_force_logic_config_t

Data Fields

uint8_t bitPWM23OutputInitialVaule: 1U
 Configures PWM submodule compare output x (PwmX) initial value. More...
 
uint8_t bitPWM45OutputInitialVaule: 1U
 Configures PWM submodule compare output A (PwmA) initial value. More...
 
uint8_t bitPWMXOutputInitialVaule: 1U
 Configures PWM submodule compare output B (PwmB) initial value. More...
 
pwm_sm_force_signal_select_t eForceSignalSelect: 3U
 Configures PWM submodule force out select update trigger source. More...
 
pwm_sm_force_software_output_value_t eSoftOutputFor23: 1U
 Configures PWM submodule force out PwmA value when select software as output source. More...
 
pwm_sm_force_software_output_value_t eSoftOutputFor45: 1U
 Configures PWM submodule force out PwmB value when select software as output source. More...
 
pwm_sm_force_deadtime_source_t eForceOutput23: 2U
 Configures the source of Pwm23, which will be force to deadtime logic. More...
 
pwm_sm_force_deadtime_source_t eForceOutput45: 2U
 Configures the source of Pwm45, which will be force to deadtime logic. More...
 

Field Documentation

uint8_t pwm_sm_force_logic_config_t::bitPWM23OutputInitialVaule
uint8_t pwm_sm_force_logic_config_t::bitPWM45OutputInitialVaule
uint8_t pwm_sm_force_logic_config_t::bitPWMXOutputInitialVaule
pwm_sm_force_signal_select_t pwm_sm_force_logic_config_t::eForceSignalSelect
pwm_sm_force_software_output_value_t pwm_sm_force_logic_config_t::eSoftOutputFor23
pwm_sm_force_software_output_value_t pwm_sm_force_logic_config_t::eSoftOutputFor45
pwm_sm_force_deadtime_source_t pwm_sm_force_logic_config_t::eForceOutput23
pwm_sm_force_deadtime_source_t pwm_sm_force_logic_config_t::eForceOutput45
struct pwm_sm_deadtime_value_t

Data Fields

uint16_t bitsFractionalCycles: 5U
 Specify the fractional cycle added to the number of integer deadtime cycles. More...
 
uint16_t bitsIntegerCycles: 11U
 Specify the number of integer deadtime cycles. More...
 

Field Documentation

uint16_t pwm_sm_deadtime_value_t::bitsFractionalCycles

In terms of 1/32 IPBus clock cycles, range is 0x0 ~ 0x1F. Only valid when the fractional delays feature is enabled (FRCNTRL[FRAC23_EN] is set when PWM23 is used to generate complementary PWM, or FRCNTRL[FRAC45_EN]) is set when PWM45 is used to generate complementary PWM.

uint16_t pwm_sm_deadtime_value_t::bitsIntegerCycles

In terms of IPBus clock cycles, range is 0x0 ~ 0x7FF.

struct pwm_sm_deadtime_logic_config_t

Data Fields

pwm_sm_deadtime_logic_mode_t eMode
 The mode in which Deadtime logic process the force logic output signal. More...
 
pwm_sm_deadtime_value_t sDeadTimeValue0
 
                  Control the deadtime during 0 to 1 transitions of the PWM_23 output

(assuming normal polarity). More...

 
pwm_sm_deadtime_value_t sDeadTimeValue1
 
                 Control the deadtime during 0 to 1 transitions of the PWM_45 output

(assuming normal polarity). More...

 

Field Documentation

pwm_sm_deadtime_logic_mode_t pwm_sm_deadtime_logic_config_t::eMode
pwm_sm_deadtime_value_t pwm_sm_deadtime_logic_config_t::sDeadTimeValue0

When disable fractional delays, the maximum value is 0x7FF which represents 2047 cycles of IP bus cycles. When enable fractional delays, the maximum value is 0xFFFF which represents 2047 31/32 cycles cycles of IP bus cycles.

pwm_sm_deadtime_value_t pwm_sm_deadtime_logic_config_t::sDeadTimeValue1

When disable fractional delays, the maximum value is 0x7FF which represents 2047 cycles of IP bus cycles. When enable fractional delays, the maximum value is 0xFFFF which represents 2047 31/32 cycles cycles of IP bus cycles.

struct pwm_sm_fractional_delay_logic_config_t

Data Fields

uint8_t bitsFracValue1: 5U
 Configures PWM submodule compare register VAL1 fractional delay value, the unit is 1/32 IP bus clock. More...
 
bool bEnableVal1FractionalDelay
 Enable the fractional delay feature of bitsFracValue1. More...
 
uint8_t bitsFracValue2: 5U
 Configures PWM submodule compare register VAL2 fractional delay value, the unit is 1/32 IP bus clock. More...
 
uint8_t bitsFracValue3: 5U
 Configures PWM submodule compare register VAL3 fractional delay value, the unit is 1/32 IP bus clock. More...
 
bool bEnableVal23FractionalDelay
 Enable the fractional delay feature of bitsFracValue2 and bitsFracValue3. More...
 
uint8_t bitsFracValue4: 5U
 Configures PWM submodule compare register VAL4 fractional delay value, the unit is 1/32 IP bus clock. More...
 
uint8_t bitsFracValue5: 5U
 Configures PWM submodule compare register VAL5 fractional delay value, the unit is 1/32 IP bus clock. More...
 
bool bEnableVal45FractionalDelay
 Enable the fractional delay feature of bitsFracValue4 and bitsFracValue5. More...
 

Field Documentation

uint8_t pwm_sm_fractional_delay_logic_config_t::bitsFracValue1
bool pwm_sm_fractional_delay_logic_config_t::bEnableVal1FractionalDelay
uint8_t pwm_sm_fractional_delay_logic_config_t::bitsFracValue2
uint8_t pwm_sm_fractional_delay_logic_config_t::bitsFracValue3
bool pwm_sm_fractional_delay_logic_config_t::bEnableVal23FractionalDelay
uint8_t pwm_sm_fractional_delay_logic_config_t::bitsFracValue4
uint8_t pwm_sm_fractional_delay_logic_config_t::bitsFracValue5
bool pwm_sm_fractional_delay_logic_config_t::bEnableVal45FractionalDelay
struct pwm_sm_output_logic_config_t

Data Fields

bool bVal0TriggerEnable: 1U
 Enable VAL0 register compare event trigger. More...
 
bool bVal1TriggerEnable: 1U
 Enable VAL1 register compare event trigger. More...
 
bool bVal2TriggerEnable: 1U
 Enable VAL2 register compare event trigger. More...
 
bool bVal3TriggerEnable: 1U
 Enable VAL3 register compare event trigger. More...
 
bool bVal4TriggerEnable: 1U
 Enable VAL4 register compare event trigger. More...
 
bool bVal5TriggerEnable: 1U
 Enable VAL5 register compare event trigger. More...
 
bool bEnableTriggerPostScaler: 1U
 True : Trigger outputs are generated only during the final PWM period prior to a reload opportunity, false : Trigger outputs are generated during every PWM period. More...
 
pwm_sm_mux_trigger_source_t eMuxTrigger0: 1U
 Configures PWM submodule mux trigger output signal 1 source. More...
 
pwm_sm_mux_trigger_source_t eMuxTrigger1: 1U
 Configures PWM submodule PWM_X output source (before polarity/mask/enable control). More...
 
bool bInvertPwmxOutput: 1U
 True : invert PWM_X output, false : no invert PWM_X output. More...
 
bool bInvertPwmaOutput: 1U
 True : invert PWM_A output, false : no invert PWM_A output. More...
 
bool bInvertPwmbOutput: 1U
 True : invert PWM_B output, false : no invert PWM_B output. More...
 
bool bMaskPwmxOutput: 1U
 True : PWM_X output masked, false : PWM_X output normal. More...
 
bool bMaskPwmaOutput: 1U
 True : PWM_A output masked, false : PWM_A output normal. More...
 
bool bMaskPwmbOutput: 1U
 True : PWM_B output masked, false : PWM_B output normal. More...
 
bool bEnablePwmxOutput: 1U
 True : Enable PWM_X output. More...
 
bool bEnablePwmaOutput: 1U
 True : Enable PWM_A output. More...
 
bool bEnablePwmbOutput: 1U
 True : Enable PWM_B output. More...
 
pwm_sm_pwm_output_on_fault_t ePwmxFaultState: 2U
 Configures PWM submodule PWM_A output during fault status (only works when fault status enable). More...
 
pwm_sm_pwm_output_on_fault_t ePwmaFaultState: 2U
 Configures PWM submodule PWM_B output during fault status (only works when fault status enable). More...
 

Field Documentation

bool pwm_sm_output_logic_config_t::bVal0TriggerEnable
bool pwm_sm_output_logic_config_t::bVal1TriggerEnable
bool pwm_sm_output_logic_config_t::bVal2TriggerEnable
bool pwm_sm_output_logic_config_t::bVal3TriggerEnable
bool pwm_sm_output_logic_config_t::bVal4TriggerEnable
bool pwm_sm_output_logic_config_t::bVal5TriggerEnable
bool pwm_sm_output_logic_config_t::bEnableTriggerPostScaler

Configures PWM submodule mux trigger output signal 0 source.

pwm_sm_mux_trigger_source_t pwm_sm_output_logic_config_t::eMuxTrigger0
pwm_sm_mux_trigger_source_t pwm_sm_output_logic_config_t::eMuxTrigger1
bool pwm_sm_output_logic_config_t::bInvertPwmxOutput
bool pwm_sm_output_logic_config_t::bInvertPwmaOutput
bool pwm_sm_output_logic_config_t::bInvertPwmbOutput
bool pwm_sm_output_logic_config_t::bMaskPwmxOutput

Mask bit is buffered, and take effect until FORCE_OUT event or software update command.

bool pwm_sm_output_logic_config_t::bMaskPwmaOutput

Mask bit is buffered, and take effect until FORCE_OUT event or software update command.

bool pwm_sm_output_logic_config_t::bMaskPwmbOutput

Mask bit is buffered, and take effect until FORCE_OUT event or software update command.

bool pwm_sm_output_logic_config_t::bEnablePwmxOutput

false : PWM_X is disabled and output is tristated.

bool pwm_sm_output_logic_config_t::bEnablePwmaOutput

false : PWM_A is disabled and output is tristated.

bool pwm_sm_output_logic_config_t::bEnablePwmbOutput

false : PWM_B is disabled and output is tristated. Configures PWM submodule PWM_X output during fault status (only works when fault status enable).

pwm_sm_pwm_output_on_fault_t pwm_sm_output_logic_config_t::ePwmxFaultState
pwm_sm_pwm_output_on_fault_t pwm_sm_output_logic_config_t::ePwmaFaultState
struct pwm_sm_input_capture_config_t
Note
When choosing kPWM_InputEdgeCounter as circuit 0/1 capture source, the eCircuit0CaptureEdge and eCircuit1CaptureEdge selected trigger edge will be ignored, but still need place a value other than kPWM_Noedge in either or both of the eCaptureCircuit0 and/or CaptureCircuit1 fields in order to enable one or both of the capture registers.

Data Fields

bool bEnableInputCapture: 1U
 True: enable the input capture process, false : disable the input capture process. More...
 
pwm_sm_input_capture_source_t eInCaptureSource: 1U
 Configures capture circuit 0/1 input source.
 
pwm_sm_input_capture_edge_t eCircuit0CaptureEdge: 2U
 
                      Configures which edge causes a capture for capture

circuit 0 , will be ignore when use edge counter as capture source. More...

 
pwm_sm_input_capture_edge_t eCircuit1CaptureEdge: 2U
 
                      Configures which edge causes a capture for capture

circuit 1 , will be ignore when use edge counter as capture source. More...

 
bool bEnableOneShotCapture: 1U
 True: Enable one-shot capture mode, the bEnableInputCapture will self-cleared when one or more of the enabled capture circuits has had a capture event; false: Capture circuit 0/1 will perform capture continue;.
 
uint8_t bitsCaptureFifoWatermark: 2U
 Watermark level for circuit 0/1 capture FIFO. More...
 
uint8_t u8EdgeCounterCompareValue
 Edge counter compare value, used only if edge counter is used as capture circuit 0/1 input source.
 

Field Documentation

bool pwm_sm_input_capture_config_t::bEnableInputCapture
pwm_sm_input_capture_edge_t pwm_sm_input_capture_config_t::eCircuit0CaptureEdge
pwm_sm_input_capture_edge_t pwm_sm_input_capture_config_t::eCircuit1CaptureEdge
uint8_t pwm_sm_input_capture_config_t::bitsCaptureFifoWatermark

The capture flags in the status register will set if the word count in the circuit 0/1 capture FIFO is greater than this watermark level

struct pwm_sm_capture_dma_config_t

Data Fields

bool bEnableCaptureDMA: 1U
 Enables DMA read requests for the Capture FIFOs. More...
 
pwm_sm_capture_dma_source_t eCaptureDMASource: 3U
 
 Select the source to enables DMA read requests for the

Capture FIFOs. More...

 

Field Documentation

bool pwm_sm_capture_dma_config_t::bEnableCaptureDMA
pwm_sm_capture_dma_source_t pwm_sm_capture_dma_config_t::eCaptureDMASource

Will be ignored when bEnableCaptureDMA be false.

struct pwm_sm_dma_config_t

Data Fields

bool bEnableWriteValDMA: 1U
 STS[RF] set enables DMA write requests for VALx and FRACVALx registers. More...
 
bool bEnableReadCaptureX0DMA: 1U
 STS[CFX0] set enables DMA read requests for Capture X0 FIFO. More...
 
bool bEnableReadCaptureX1DMA: 1U
 STS[CFX1] set enables DMA read requests for Capture X1 FIFO. More...
 
bool bEnableReadCaptureA0DMA: 1U
 STS[CFA0] set enables DMA read requests for Capture A0 FIFO. More...
 
bool bEnableReadCaptureA1DMA: 1U
 STS[CFA1] set enables DMA read requests for Capture A1 FIFO. More...
 
bool bEnableReadCaptureB0DMA: 1U
 STS[CFB0] set enables DMA read requests for Capture B0 FIFO. More...
 
bool bEnableReadCaptureB1DMA: 1U
 STS[CFB1] set enables DMA read requests for Capture B1 FIFO. More...
 
pwm_sm_capture_dma_config_t sCaptureDma
 DMA read requests for the capture FIFOs configure. More...
 

Field Documentation

bool pwm_sm_dma_config_t::bEnableWriteValDMA
bool pwm_sm_dma_config_t::bEnableReadCaptureX0DMA

And X0 FIFO watermark is selected for sCaptureDma pwm_sm_capture_dma_config_t.

bool pwm_sm_dma_config_t::bEnableReadCaptureX1DMA

And X1 FIFO watermark is selected for sCaptureDma pwm_sm_capture_dma_config_t.

bool pwm_sm_dma_config_t::bEnableReadCaptureA0DMA

And A0 FIFO watermark is selected for sCaptureDma pwm_sm_capture_dma_config_t.

bool pwm_sm_dma_config_t::bEnableReadCaptureA1DMA

And A1 FIFO watermark is selected for sCaptureDma pwm_sm_capture_dma_config_t.

bool pwm_sm_dma_config_t::bEnableReadCaptureB0DMA

And B0 FIFO watermark is selected for sCaptureDma pwm_sm_capture_dma_config_t.

bool pwm_sm_dma_config_t::bEnableReadCaptureB1DMA

And B1 FIFO watermark is selected for sCaptureDma pwm_sm_capture_dma_config_t.

pwm_sm_capture_dma_config_t pwm_sm_dma_config_t::sCaptureDma
struct pwm_sm_fault_input_mapping_t
Note
The channel 0 input 0 and channel 1 input 0 are different pins.

The structure for configuring PWM submodule fault input disable mapping.

Note
Each PWM output can be mapping anyone or more fault inputs. The mapped fault protection channel inputs can disable PWM output.

Data Fields

bool bFaultInput0Mapping: 1U
 Mapping fault input 0 (from fault protection channel 0) to PWM output. More...
 
bool bFaultInput1Mapping: 1U
 Mapping fault input 1 (from fault protection channel 0) to PWM output. More...
 
bool bFaultInput2Mapping: 1U
 Mapping fault input 2 (from fault protection channel 0) to PWM output. More...
 
bool bFaultInput3Mapping: 1U
 Mapping fault input 3 (from fault protection channel 0) to PWM output. More...
 
bool bFaultInput4Mapping: 1U
 Mapping fault input 4 (from fault protection channel 1) to PWM output. More...
 
bool bFaultInput5Mapping: 1U
 Mapping fault input 5 (from fault protection channel 1) to PWM output. More...
 
bool bFaultInput6Mapping: 1U
 Mapping fault input 6 (from fault protection channel 1) to PWM output. More...
 
bool bFaultInput7Mapping: 1U
 Mapping fault input 7 (from fault protection channel 1) to PWM output. More...
 

Field Documentation

bool pwm_sm_fault_input_mapping_t::bFaultInput0Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput1Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput2Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput3Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput4Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput5Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput6Mapping
bool pwm_sm_fault_input_mapping_t::bFaultInput7Mapping
struct pwm_sm_config_t

This structure holds the configuration settings for the PWM peripheral. To initialize this structure to reasonable defaults, call the PWM_GetDefaultConfig() function and pass a pointer to your config structure instance.

Data Fields

bool enableDebugMode: 1U
 true: PWM continues to run in debug mode; false: PWM is paused in debug mode. More...
 
bool enableWaitMode: 1U
 true: PWM continues to run in WAIT mode; false: PWM is paused in WAIT mode. More...
 
bool enableRun: 1U
 true: PWM submodule is enabled; false: PWM submodule is disabled. More...
 
pwm_sm_counter_config_t sCounterConfig
 Submodule counter logic config. More...
 
pwm_sm_reload_logic_config_t sReloadConfig
 Submodule reload control logic config. More...
 
pwm_sm_value_register_config_t sValRegisterConfig
 Submodule value registers config. More...
 
pwm_sm_force_logic_config_t sForceConfig
 Submodule force out logic config. More...
 
pwm_sm_deadtime_logic_config_t sDeadTimeConfig
 Submodule deadtime logic config. More...
 
pwm_sm_fractional_delay_logic_config_t sFracDelayConfig
 Submodule fractional logic config. More...
 
pwm_sm_output_logic_config_t sOutputConfig
 Submodule output logic config. More...
 
pwm_sm_input_capture_config_t sInCaptureConfig [3]
 Submodule input capture config for PWM_X/A/B pins. More...
 
pwm_sm_dma_config_t sDMAConfig
 Submodule DMA config. More...
 
pwm_sm_fault_input_mapping_t sPwmXFaultInputMapping
 PWM_A output fault input mapping, determines which fault inputs can disable PWM_A output. More...
 
pwm_sm_fault_input_mapping_t sPwmAFaultInputMapping
 PWM_B output fault input mapping, determines which fault inputs can disable PWM_B output. More...
 
pwm_sm_fault_input_mapping_t sPwmBFaultInputMapping
 Submodule interrupt enable mask, logic OR of _pwm_sm_interrupt_enable. More...
 

Field Documentation

bool pwm_sm_config_t::enableDebugMode
bool pwm_sm_config_t::enableWaitMode
bool pwm_sm_config_t::enableRun

Configures submodule value registers compare mode, only can be written one time.

pwm_sm_counter_config_t pwm_sm_config_t::sCounterConfig
pwm_sm_reload_logic_config_t pwm_sm_config_t::sReloadConfig
pwm_sm_value_register_config_t pwm_sm_config_t::sValRegisterConfig
pwm_sm_force_logic_config_t pwm_sm_config_t::sForceConfig
pwm_sm_deadtime_logic_config_t pwm_sm_config_t::sDeadTimeConfig
pwm_sm_fractional_delay_logic_config_t pwm_sm_config_t::sFracDelayConfig
pwm_sm_output_logic_config_t pwm_sm_config_t::sOutputConfig
pwm_sm_input_capture_config_t pwm_sm_config_t::sInCaptureConfig[3]
pwm_sm_dma_config_t pwm_sm_config_t::sDMAConfig

PWM_X output fault input mapping, determines which fault inputs can disable PWM_X output.

pwm_sm_fault_input_mapping_t pwm_sm_config_t::sPwmXFaultInputMapping
pwm_sm_fault_input_mapping_t pwm_sm_config_t::sPwmAFaultInputMapping
pwm_sm_fault_input_mapping_t pwm_sm_config_t::sPwmBFaultInputMapping
struct pwm_fault_protection_config_t

Data Fields

bool bEnableFaultGlitchStretch: 1U
 Fault Glitch Stretch Enable: A logic 1 means that input fault signals will be stretched to at least 2 IPBus clock cycles. More...
 
uint8_t bitsFaultFilterCount: 3U
 Configures PWM fault protection channel fault filter count. More...
 
uint8_t u8FaultFilterPeriod
 Configures PWM fault protection channel fault filter period, value of 0 will bypass the filter. More...
 

Field Documentation

bool pwm_fault_protection_config_t::bEnableFaultGlitchStretch
uint8_t pwm_fault_protection_config_t::bitsFaultFilterCount
uint8_t pwm_fault_protection_config_t::u8FaultFilterPeriod
struct pwm_config_t
Note
Need use submodule structure address to init the structure pointers, when the submodule or fault protection structure pointers is NULL, it will be ignored by PWM_Init API. This can save stack space when only one or two submodules are used.

Data Fields

pwm_sm_config_tpsPwmSubmoduleConfig [FSL_FEATURE_PWM_SUBMODULE_COUNT]
 < PWM submodule config. More...
 

Field Documentation

pwm_sm_config_t* pwm_config_t::psPwmSubmoduleConfig[FSL_FEATURE_PWM_SUBMODULE_COUNT]

PWM fault protection channel config, will take effect for all submodules.

Enumeration Type Documentation

Enumerator
kPWM_SubModule0 

PWM Submodule 0.

kPWM_SubModule1 

PWM Submodule 1.

kPWM_SubModule2 

PWM Submodule 2.

kPWM_SubModule3 

PWM Submodule 3.

Enumerator
kPWM_SubModule0Enable 

PWM Submodule 0 enable.

kPWM_SubModule1Enable 

PWM Submodule 1 enable.

kPWM_SubModule2Enable 

PWM Submodule 2 enable.

kPWM_SubModule3Enable 

PWM Submodule 3 enable.

Enumerator
kPWM_ClockSrcBusClock 

The IPBus clock is used as the source clock.

kPWM_ClockSrcExternalClock 

EXT_CLK is used as the source clock.

kPWM_ClockSrcSubmodule0Clock 

Clock of the submodule 0 (AUX_CLK) is used as the source clock.

Enumerator
kPWM_ClockPrescaleDivide1 

PWM submodule clock frequency = fclk/1.

kPWM_ClockPrescaleDivide2 

PWM submodule clock frequency = fclk/2.

kPWM_ClockPrescaleDivide4 

PWM submodule clock frequency = fclk/4.

kPWM_ClockPrescaleDivide8 

PWM submodule clock frequency = fclk/8.

kPWM_ClockPrescaleDivide16 

PWM submodule clock frequency = fclk/16.

kPWM_ClockPrescaleDivide32 

PWM submodule clock frequency = fclk/32.

kPWM_ClockPrescaleDivide64 

PWM submodule clock frequency = fclk/64.

kPWM_ClockPrescaleDivide128 

PWM submodule clock frequency = fclk/128.

Enumerator
kPWM_InitOnLocalSync 

Local sync causes initialization.

kPWM_InitOnMasterReload 

Master reload from submodule 0 causes initialization.

kPWM_InitOnMasterSync 

Master sync from submodule 0 causes initialization.

kPWM_InitOnExtSync 

EXT_SYNC causes initialization.

Enumerator
kPWM_LocalReloadSignal 

The local RELOAD signal is used to reload buffered-registers.

kPWM_MasterReloadSignal 

The master RELOAD signal (from submodule 0) is used to reload buffered-registers (should not be used in submodule 0).

Enumerator
kPWM_TakeEffectAtReloadOportunity 

Buffered-registers reload after one/more reload opportunities, and a load opportunity can generate on a PWM half or/and full cycle.

kPWM_TakeEffectImmediately 

Buffered-registers reload with new values as soon as MCTRL[LDOK] bit is set when choose local reload.

Enumerator
kPWM_LoadEveryOportunity 

Every PWM submodule reload opportunity.

kPWM_LoadEvery2Oportunity 

Every 2 PWM submodule reload opportunities.

kPWM_LoadEvery3Oportunity 

Every 3 PWM submodule reload opportunities.

kPWM_LoadEvery4Oportunity 

Every 4 PWM submodule reload opportunities.

kPWM_LoadEvery5Oportunity 

Every 5 PWM submodule reload opportunities.

kPWM_LoadEvery6Oportunity 

Every 6 PWM submodule reload opportunities.

kPWM_LoadEvery7Oportunity 

Every 7 PWM submodule reload opportunities.

kPWM_LoadEvery8Oportunity 

Every 8 PWM submodule reload opportunities.

kPWM_LoadEvery9Oportunity 

Every 9 PWM submodule reload opportunities.

kPWM_LoadEvery10Oportunity 

Every 10 PWM submodule reload opportunities.

kPWM_LoadEvery11Oportunity 

Every 11 PWM submodule reload opportunities.

kPWM_LoadEvery12Oportunity 

Every 12 PWM submodule reload opportunities.

kPWM_LoadEvery13Oportunity 

Every 13 PWM submodule reload opportunities.

kPWM_LoadEvery14Oportunity 

Every 14 PWM submodule reload opportunities.

kPWM_LoadEvery15Oportunity 

Every 15 PWM submodule reload opportunities.

kPWM_LoadEvery16Oportunity 

Every 16 PWM submodule reload opportunities.

Enumerator
kPWM_CompareOnEqual 

The VALn registers and the PWM counter are compared using an "equal to" method.

kPWM_CompareOnEqualOrGreater 

The VALn registers and the PWM counter are compared using an "equal to or greater than" method.

Enumerator
kPWM_VAL0 

PWM submodule value register 0.

kPWM_VAL1 

PWM submodule value register 1.

kPWM_VAL2 

PWM submodule value register 2.

kPWM_VAL3 

PWM submodule value register 3.

kPWM_VAL4 

PWM submodule value register 4.

kPWM_VAL5 

PWM submodule value register 5.

Enumerator
kPWM_LocalSoftwareForce 

The local software force signal CTRL2[FORCE] is used to force updates.

kPWM_MasterSoftwareForce 

The master software force signal from submodule 0 is used to force updates.

kPWM_LocalReloadForce 

The local reload signal from this submodule is used to force updates without regard to the state of LDOK.

kPWM_MasterReloadForce 

The master reload signal from submodule 0 is used to force updates if LDOK is set, should not be used in submodule 0.

kPWM_LocalSyncForce 

The local sync (VAL1 match event) signal from this submodule is used to force updates.

kPWM_MasterSyncForce 

The master sync signal from submodule0 is used to force updates.

kPWM_ExternalForceForce 

The external force signal EXT_FORCE, from outside the PWM module causes updates.

kPWM_ExternalSyncForce 

The external sync signal EXT_SYNC, from outside the PWM module causes updates.

Enumerator
kPWM_GeneratedPwm 

Generated PWM signal is used as the deadtime logic output.

kPWM_InvertedGeneratedPwm 

Inverted PWM signal is used as the deadtime logic output.

kPWM_SoftwareControlValue 

Software controlled value is used as the deadtime logic output.

kPWM_UseExternal 

PWM_EXTA signal is used as the deadtime logic output.

Enumerator
kPWM_SoftwareOutputLow 

A logic 0 is supplied to the deadtime generator when chose Software controlled value as output source.

kPWM_SoftwareOutputHigh 

A logic 1 is supplied to the deadtime generator when chose Software controlled value as output source.

Enumerator
kPWM_Independent 

The PWMA (PWM23) and PWMB (PWM45) signal from force logic transfer to output logic independent.

kPWM_IndependentWithDoubleSwitchPwm 

The PWMA (PWM23) and PWMB (PWM45) signals from force logic will XOR first, then the XOR signal transfer to output logic independent.

kPWM_IndependentWithSplitDoubleSwitchPwm 

The PWMA (PWM23) and PWMB (PWM45) signals from force_out logic will XOR first, then the XOR signal transfer to output logic independent.

kPWM_ComplementaryWithPwmA 

The PWMA (PWM23) signal from force logic will transfer to output logic with complementary mode.

kPWM_ComplementaryWithPwmB 

The PWMB (PWM45) signal from force logic will transfer to output logic with complementary mode.

kPWM_ComplementaryWithDoubleSwitchPwm 

The PWMA (PWM23) and PWMB (PWM45) signals from force logic will XOR first, then the XOR signal transfer to output logic with complementary mode.

Enumerator
kPWM_FRACVAL1 

PWM submodule fractional value register 1.

kPWM_FRACVAL2 

PWM submodule fractional value register 2.

kPWM_FRACVAL3 

PWM submodule fractional value register 3.

kPWM_FRACVAL4 

PWM submodule fractional value register 4.

kPWM_FRACVAL5 

PWM submodule fractional value register 5.

Enumerator
kPWM_ActualCompareEvent 

Route the PWM_OUT_TRIG signal (OR of VALx compare signal) to the mux trigger output port.

kPWM_PwmOutput 

Route the PWM output (after polarity/mask/enable control) to the mux trigger output port.

Enumerator
kPWM_OutputLowOnFault 

The output is forced to logic 0 state prior to consideration of output polarity/mask/enable control during fault conditions and STOP mode.

kPWM_OutputHighOnFault 

The output is forced to logic 1 state prior to consideration of output polarity/mask/enable control during fault conditions and STOP mode.

kPWM_OutputTristatedOnFault 

The output status be tristated during fault conditions and STOP mode.

Enumerator
kPWM_RawPwmX 

The PWM_X source is raw Pwm01_fractional_delay signal.

kPWM_DoubleSwitch 

The PWM_X source is Pwm23_fractional_delay XOR Pwm23_fractional_delay signal.

Enumerator
kPWM_PwmX 

The PWM output PWM_X.

kPWM_PwmA 

The PWM output PWM_A.

kPWM_PwmB 

The PWM output PWM_B.

Enumerator
kPWM_InputCapturePwmX 

The input capture pin PwmX, need disable PwmX output when enable input capture.

kPWM_InputCapturePwmA 

The input capture pin PwmA, need disable PwmA output when enable input capture.

kPWM_InputCapturePwmB 

The input capture pin PwmB, need disable PwmB output when enable input capture.

Enumerator
kPWM_RawInput 

The capture source is the raw input signal.

kPWM_InputEdgeCounter 

The capture source is edge counter which counts rising and falling edges on the raw input signal.

Enumerator
kPWM_Noedge 

Disabled capture on source falling/falling edge.

kPWM_FallingEdge 

Enable input capture, and capture on source falling edge when chose the raw input signal as capture source.

kPWM_RisingEdge 

Enable input capture, and capture on source rising edge when chose the raw input signal as capture source.

kPWM_RiseAndFallEdge 

Enable input capture, and capture on source rising or falling edge when chose the raw input signal as capture source.

Enumerator
kPWM_InpCaptureVal0 

Stores the value captured from the submodule counter when the PWM_X circuitry 0 logic capture occurs.

kPWM_InpCaptureVal1 

Stores the value captured from the submodule counter when the PWM_X circuitry 1 logic capture occurs.

kPWM_InpCaptureVal2 

Stores the value captured from the submodule counter when the PWM_A circuitry 0 logic capture occurs.

kPWM_InpCaptureVal3 

Stores the value captured from the submodule counter when the PWM_A circuitry 1 logic capture occurs.

kPWM_InpCaptureVal4 

Stores the value captured from the submodule counter when the PWM_B circuitry 0 logic capture occurs.

kPWM_InpCaptureVal5 

Stores the value captured from the submodule counter when the PWM_B circuitry 1 logic capture occurs.

Enumerator
kPWM_FIFOWatermarksORDma 

Selected FIFO watermarks are OR'ed together to sets the read DMA request.

kPWM_FIFOWatermarksANDDma 

Selected FIFO watermarks are AND'ed together to sets the read DMA request.

kPWM_LocalSyncDma 

A local sync (VAL1 match event) sets the read DMA request.

kPWM_LocalReloadDma 

A local reload (STS[RF] being set) sets the read DMA request.

Enumerator
kPWM_CompareVal0InterruptEnable 

PWM submodule VAL0 compare interrupt.

kPWM_CompareVal1InterruptEnable 

PWM submodule VAL1 compare interrupt.

kPWM_CompareVal2InterruptEnable 

PWM submodule VAL2 compare interrupt.

kPWM_CompareVal3InterruptEnable 

PWM submodule VAL3 compare interrupt.

kPWM_CompareVal4InterruptEnable 

PWM submodule VAL4 compare interrupt.

kPWM_CompareVal5InterruptEnable 

PWM submodule VAL5 compare interrupt.

kPWM_CaptureX0InterruptEnable 

PWM submodule capture X0 interrupt.

kPWM_CaptureX1InterruptEnable 

PWM submodule capture X1 interrupt.

kPWM_CaptureB0InterruptEnable 

PWM submodule capture B0 interrupt.

kPWM_CaptureB1InterruptEnable 

PWM submodule capture B1 interrupt.

kPWM_CaptureA0InterruptEnable 

PWM submodule capture A0 interrupt.

kPWM_CaptureA1InterruptEnable 

PWM submodule capture A1 interrupt.

kPWM_ReloadInterruptEnable 

PWM submodule reload interrupt.

kPWM_ReloadErrorInterruptEnable 

PWM submodule reload error interrupt.

Enumerator
kPWM_CompareVal0Flag 

PWM submodule VAL0 compare flag.

kPWM_CompareVal1Flag 

PWM submodule VAL1 compare flag.

kPWM_CompareVal2Flag 

PWM submodule VAL2 compare flag.

kPWM_CompareVal3Flag 

PWM submodule VAL3 compare flag.

kPWM_CompareVal4Flag 

PWM submodule VAL4 compare flag.

kPWM_CompareVal5Flag 

PWM submodule VAL5 compare flag.

kPWM_CaptureX0Flag 

PWM submodule capture X0 flag.

kPWM_CaptureX1Flag 

PWM submodule capture X1 flag.

kPWM_CaptureB0Flag 

PWM submodule capture B0 flag.

kPWM_CaptureB1Flag 

PWM submodule capture B1 flag.

kPWM_CaptureA0Flag 

PWM submodule capture A0 flag.

kPWM_CaptureA1Flag 

PWM submodule capture A1 flag.

kPWM_ReloadFlag 

PWM submodule reload flag.

kPWM_ReloadErrorFlag 

PWM submodule reload error flag.

kPWM_RegUpdatedFlag 

PWM submodule registers updated flag.

Enumerator
kPWM_SignedCenterAligned 

Center-aligned PWM with signed compare value.

kPWM_CenterAligned 

Center-aligned PWM with unsigned compare value.

kPWM_SignedEdgeAligned 

Edge-aligned PWM with signed compare value.

kPWM_EdgeAligned 

Edge-aligned PWM with signed compare value.

Enumerator
kPWM_FaultProtection0 

PWM fault protection channel 0.

kPWM_FaultProtection1 

PWM fault protection channel 1.

Enumerator
kPWM_Fault0InterruptEnable 

Fault protection channel fault 0 interrupt.

kPWM_Fault1InterruptEnable 

Fault protection channel fault 1 interrupt.

kPWM_Fault2InterruptEnable 

Fault protection channel fault 2 interrupt.

kPWM_Fault3InterruptEnable 

Fault protection channel fault 3 interrupt.

Enumerator
kPWM_Fault0Flag 

Fault protection channel fault 0 flag, set within two CPU cycles after a transition to active on the fault input pin 0.

kPWM_Fault1Flag 

Fault protection channel fault 1 flag, set within two CPU cycles after a transition to active on the fault input pin 1.

kPWM_Fault2Flag 

Fault protection channel fault 2 flag, set within two CPU cycles after a transition to active on the fault input pin 2.

kPWM_Fault3Flag 

Fault protection channel fault 3 flag, set within two CPU cycles after a transition to active on the fault input pin 3.

kPWM_FaultPin0ActiveFlag 

Fault protection channel fault input pin 0 active flag.

kPWM_FaultPin1ActiveFlag 

Fault protection channel fault input pin 1 active flag.

kPWM_FaultPin2ActiveFlag 

Fault protection channel fault input pin 2 active flag.

kPWM_FaultPin3ActiveFlag 

Fault protection channel fault input pin 3 active flag.

Enumerator
kPWM_Logic0 

A logic 0 on the fault input indicates a fault condition.

kPWM_Logic1 

A logic 0 on the fault input indicates a fault condition.

Function Documentation

void PWM_Init ( PWM_Type *  base,
const pwm_config_t psConfig 
)

This function can initial one or more submodules of the PWM module.

This examples shows how only initial submodule 0 without fault protection channel.

* pwm_config_t sPwmConfig = {0};
* pwm_sm_config_t sPwmSm0Config;
* sPwmConfig.psPwmSubmoduleConfig[0] = &sPwmSm0Config;
* PWM_GetSmDefaultConfig(&sPwmSm0Config);
* PWM_Init(PWM, sPwmConfig);
*
Note
This API should be called at the beginning of the application using the PWM driver.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number. See pwm_sm_number_t.
psConfigPointer to PWM module configure structure. See pwm_config_t.
void PWM_Deinit ( PWM_Type *  base)
Parameters
basePWM peripheral base address
void PWM_GetSMDefaultConfig ( pwm_sm_config_t psConfig)

This function fills in the initialization structure member, which can make submodule generate 50% duty cycle center aligned PWM_A/B output.

The default effective values are:

* psConfig->enableDebugMode = false;
* psConfig->enableWaitMode = false;
* psConfig->enableRun = false;
* psConfig->sCounterConfig.eCountClockSource = kPWM_ClockSrcBusClock;
* psConfig->sCounterConfig.eCountClockPrescale = kPWM_ClockPrescaleDivide1;
* psConfig->sCounterConfig.eCountInitSource = kPWM_InitOnLocalSync;
* psConfig->sReloadConfig.eReloadSignalSelect = kPWM_LocalReloadSignal;
* psConfig->sReloadConfig.eLoclReloadEffectTime = kPWM_TakeEffectAtReloadOportunity;
* psConfig->sReloadConfig.eLocalReloadOportunity = kPWM_LoadEveryOportunity;
* psConfig->sReloadConfig.bEnableFullCycleReloadOportunity = true;
* psConfig->sReloadConfig.bEnableHalfCycleReloadOportunity = false;
* psConfig->sValRegisterConfig.u16CounterInitialValue = 0xFF00U;
* psConfig->sValRegisterConfig.u16ValRegister0 = 0x0U;
* psConfig->sValRegisterConfig.u16ValRegister1 = 0x00FFU;
* psConfig->sValRegisterConfig.u16ValRegister2 = 0xFF80U;
* psConfig->sValRegisterConfig.u16ValRegister3 = 0x80U;
* psConfig->sValRegisterConfig.u16ValRegister4 = 0xFF80U;
* psConfig->sValRegisterConfig.u16ValRegister5 = 0x80U;
* psConfig->sForceConfig.eForceSignalSelect = kPWM_LocalSoftwareForce;
* psConfig->sForceConfig.eSoftOutputFor23 = kPWM_SoftwareOutputLow;
* psConfig->sForceConfig.eSoftOutputFor45 = kPWM_SoftwareOutputLow;
* psConfig->sForceConfig.eForceOutput23 = kPWM_GeneratedPwm;
* psConfig->sForceConfig.eForceOutput45 = kPWM_GeneratedPwm;
* psConfig->sDeadTimeConfig.eMode = kPWM_Independent;
* psConfig->sOutputConfig.ePwmXSignalSelect = kPWM_RawPwmX;
* psConfig->sOutputConfig.bEnablePwmxOutput = true;
* psConfig->sOutputConfig.bEnablePwmaOutput = true;
* psConfig->sOutputConfig.bEnablePwmbOutput = true;
* psConfig->sOutputConfig.ePwmxFaultState = kPWM_OutputLowOnFault;
* psConfig->sOutputConfig.ePwmaFaultState = kPWM_OutputLowOnFault;
* psConfig->sOutputConfig.ePwmbFaultState = kPWM_OutputLowOnFault;
*
Parameters
psConfigPointer to user's PWM submodule config structure. See pwm_sm_config_t.
void PWM_GetFaultProtectionDefaultConfig ( pwm_fault_protection_config_t psConfig)

The default effective values are:

* psConfig->sFaultInput[i].eFaultActiveLevel = kPWM_Logic0;
* psConfig->sFaultInput[i].bEnableAutoFaultClear = true;
* psConfig->sFaultInput[i].bEnableFaultFullCycleRecovery = true;
*
Parameters
psConfigPointer to user's PWM fault protection config structure. See pwm_fault_protection_config_t.
void PWM_SetupSMConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_config_t psConfig 
)
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to submodule configure structure, see pwm_sm_config_t.
static void PWM_SetupCounterConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_counter_config_t psConfig 
)
inlinestatic
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to submodule counter configure structure, see pwm_sm_counter_config_t.
static void PWM_SetCounterInitialValue ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
uint16_t  u16InitialValue 
)
inlinestatic

This function set the INIT register value, the counter will start counting from INIT register value when initial signal assert or software force set. This write value will be loaded into inner set of buffered registers according to reload logic configure.

Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
u16InitialValueThe submodule number counter initialize value.
static void PWM_SetupReloadLogicConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_reload_logic_config_t psConfig 
)
inlinestatic
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to submodule reload logic configure structure, see pwm_sm_reload_control_config_t.
void PWM_GetValueConfig ( pwm_sm_value_register_config_t psConfig,
pwm_sm_typical_output_mode_t  eTypicalOutputMode,
uint16_t  u16PwmPeriod,
uint16_t  u16PwmAPulseWidth,
uint16_t  u16PwmBPulseWidth 
)
Parameters
psConfigSee pwm_sm_config_t.
eTypicalOutputModeTypical PWM_A/B output mode. See wm_sm_typical_output_mode_t.
u16PwmPeriodPWM output period value in counter ticks. This value can be got by (main counter clock in Hz) / (wanted PWM signal frequency in Hz).
u16PwmAPulseWidthPWM_A pulse width value in counter ticks. Can got by (wanted PWM duty Cycle) * u16PwmPeriod.
u16PwmBPulseWidthPWM_B pulse width value in counter ticks. Can got by (wanted PWM duty Cycle) * u16PwmPeriod.
static void PWM_SetupValRegisterConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_value_register_config_t psConfig 
)
inlinestatic
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to VALn registers configure structure, see pwm_sm_output_compare_config_t.
static void PWM_SetValueRegister ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_val_register_t  eRegister,
uint16_t  u16Value 
)
inlinestatic
Note
These write value will be loaded into inner set of buffered registers according to reload logic configure.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eRegisterValue register index (range in 0~5), see pwm_sm_val_register_t.
u16ValueThe value for VALn register.
static uint16_t PWM_GetValueRegister ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_val_register_t  eRegister 
)
inlinestatic
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eRegisterValue register index (range in 0~5), see pwm_sm_val_register_t.
Returns
The VALn register value.
static void PWM_SetFracvalRegister ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_fracval_register_t  eRegister,
uint16_t  u16Value 
)
inlinestatic
Note
These write value will be loaded into inner set of buffered registers according to reload logic configure.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eRegisterFractional value register index (range in 1~5), see pwm_sm_val_register_t.
u16ValueThe value for FRACVALn register.
static uint16_t PWM_GetFracvalRegister ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_fracval_register_t  eRegister 
)
inlinestatic
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eRegisterFractional value register index (range in 1~5), see pwm_sm_fracval_register_t.
Returns
The VALn FRACVALn value.
static void PWM_SetValueAndFracRegister ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_fracval_register_t  eRegister,
uint32_t  u32Value 
)
inlinestatic
Parameters
basePWM peripheral base address.
eSubModuleSubmodule ID.
eRegisterFractional value register index (range in 1~5), see pwm_sm_fracval_register_t.
u32Value32bit value for VALx and its FRAC. VALx: BIT16~BIT31. FRACVALx: BIT11~BIT15. RESERVED: BIT10~BIT0.
static uint32_t PWM_GetValueAndFracRegister ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_fracval_register_t  eRegister 
)
inlinestatic
Parameters
basePWM peripheral base address.
eSubModuleSubmodule ID.
eRegisterFractional value register index (range in 1~5), see pwm_sm_fracval_register_t.
Returns
The value of submodule register VALx and its FRAC, combined into 32bit. VALx: BIT16~BIT31. FRACVALx: BIT11~BIT15. RESERVED: BIT10~BIT0.
static void PWM_SetPwmLdok ( PWM_Type *  base,
uint16_t  u16Mask 
)
inlinestatic

Enable this feature can make buffered CTRL[PRSC] and the INIT, FRACVAL and VAL registers values take effect after next local load signal assert. The timing of take effect can be the next PWM reload or immediately. After loading, MCTRL[LDOK] is automatically cleared and need to enable again before the next register updated.

Note
The VALx, FRACVALx,INIT, and CTRL[PRSC] registers of the corresponding submodule cannot be written while the the corresponding MCTRL[LDOK] bit is set.
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
u16MaskPWM submodules to set the LDOK bit, Logical OR of _pwm_sm_enable.
static void PWM_ClearPwmLdok ( PWM_Type *  base,
uint16_t  u16Mask 
)
inlinestatic
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
u16MaskPWM submodules to clear the LDOK bit, Logical OR of _pwm_sm_enable.
static void PWM_SetupForceLogicConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_force_logic_config_t psConfig 
)
inlinestatic

param base PWM peripheral base address. param eSubModule PWM submodule number, see pwm_sm_number_t. param psConfig Poniter to submodule force logic configure structure, see pwm_sm_force_logic_config_t.

static void PWM_SetSoftwareForce ( PWM_Type *  base,
pwm_sm_number_t  eSubModule 
)
inlinestatic
Note
Only works when the CTRL2[FORCE_SEL] select kPWM_ForceOutOnLocalSoftware.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
void PWM_SetupDeadtimeConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_deadtime_logic_config_t psConfig 
)
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to deadtime logic configure structure, see pwm_sm_deadtime_logic_config_t.
static uint16_t PWM_GetDeadtimeSampleValue ( PWM_Type *  base,
pwm_sm_number_t  eSubModule 
)
inlinestatic

When use PWM_A/B in complementary mode and connect to transistor to controls the output voltage. Need insert deadtime to avoid overlap of conducting interval between the top and bottom transistor. And both transistors in complementary mode are off during deadtime. Then connect the PWM_X input to complementary transistors output, then it sampling input at the end of deadtime 0 for DT[0] and the end of deadtime 1 for DT[1]. Which DT value is not 0 indicates that there is a problem with the corresponding deadtime value. This can help to decide if there need do a deadtime correction for current complementary PWM output.

Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
Returns
The PWM_X input sampled values.
void PWM_SetupFractionalDelayConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_fractional_delay_logic_config_t psConfig 
)
Note
The fractional delay logic can only be used when the IPBus clock is running at 100 MHz.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to fractional delay logic configure structure, see pwm_sm_fractional_delay_logic_config_t.
void PWM_SetupOutputConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_output_logic_config_t psConfig 
)
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to output logic configure structure, see pwm_sm_output_logic_config_t.
static void PWM_EnableOutput ( PWM_Type *  base,
uint16_t  u16SubModules,
pwm_sm_pwm_out_t  eOutput 
)
inlinestatic

This function handles PWMX_EN/PWMA_EN/PWMB_EN bit filed of OUTEN register, whcih can enable one or more submodule pin in PWMX/A/B.

Parameters
basePWM peripheral base address
u16SubModulesThe submodules that enable eOutput output, logical OR of _pwm_sm_enable.
eOutputPWM output pin ID, see pwm_sm_pwm_out_t.
static void PWM_DisableOutput ( PWM_Type *  base,
uint16_t  u16SubModules,
pwm_sm_pwm_out_t  eOutput 
)
inlinestatic

This function handles PWMX_EN/PWMA_EN/PWMB_EN bit filed of OUTEN register, whcih can disable one or more submodule pin in PWMX/A/B.

Parameters
basePWM peripheral base address
u16SubModulesThe submodules that disable eOutput output, logical OR of _pwm_sm_enable.
eOutputPWM output pin ID, see pwm_sm_pwm_out_t.
static void PWM_EnableCombinedOutput ( PWM_Type *  base,
uint16_t  u16XSubModules,
uint16_t  u16ASubModules,
uint16_t  u16BSubModules 
)
inlinestatic

This function handles PWMX_EN/PWMA_EN/PWMB_EN bit filed of OUTEN register at the same time.

Parameters
basePWM peripheral base address
u16XSubModulesThe submodules that enable PWMX output, should be logical OR of _pwm_sm_enable.
u16ASubModulesThe submodules that enable PWMA output, should be logical OR of _pwm_sm_enable.
u16BSubModulesThe submodules that enable PWMB output, should be logical OR of _pwm_sm_enable.
static void PWM_DisableCombinedOutput ( PWM_Type *  base,
uint16_t  u16XSubModules,
uint16_t  u16ASubModules,
uint16_t  u16BSubModules 
)
inlinestatic

This function handles PWMX_EN/PWMA_EN/PWMB_EN bit filed of OUTEN register at the same time.

Parameters
basePWM peripheral base address
u16XSubModulesThe submodules that disable PWMX output, should be logical OR of _pwm_sm_enable.
u16ASubModulesThe submodules that disable PWMA output, should be logical OR of _pwm_sm_enable.
u16BSubModulesThe submodules that disable PWMB output, should be logical OR of _pwm_sm_enable.
static void PWM_MaskOutput ( PWM_Type *  base,
uint16_t  u16SubModules,
pwm_sm_pwm_out_t  eOutput 
)
inlinestatic

This function handles MASKA/MASKB/MASKX bit filed of MASK register, which can mask one or more submodule pin in PWMX/A/B.

Note
The mask bits is buffered and can be updated until a FORCE_OUT event occurs or a software update command.
Parameters
basePWM peripheral base address.
u16SubModulesThe submodules that mask eOutput output, logical OR of _pwm_sm_enable.
eOutputPWM output pin ID, see pwm_sm_pwm_out_t.
static void PWM_UnmaskOutput ( PWM_Type *  base,
uint16_t  u16SubModules,
pwm_sm_pwm_out_t  eOutput 
)
inlinestatic

This function handles MASKA/MASKB/MASKX bit filed of MASK register, which can mask one or more submodule pin in PWMX/A/B.

Note
The mask bits is buffered and can be updated until a FORCE_OUT event occurs or a software update command.
Parameters
basePWM peripheral base address
u16SubModulesThe submodules that unmask eOutput output, logical OR of _pwm_sm_enable.
eOutputPWM output pin ID, see pwm_sm_pwm_out_t.
static void PWM_MaskCombinedOutput ( PWM_Type *  base,
uint16_t  u16XSubModules,
uint16_t  u16ASubModules,
uint16_t  u16BSubModules 
)
inlinestatic

This function handles MASKA/MASKB/MASKX bit filed of MASK register at the same time.

Note
The mask bits is buffered and can be updated until a FORCE_OUT event occurs or a software update command.
Parameters
basePWM peripheral base address
u16XSubModulesThe submodules that mask PWMX output, should be logical OR of _pwm_sm_enable.
u16ASubModulesThe submodules that mask PWMA output, should be logical OR of _pwm_sm_enable.
u16BSubModulesThe submodules that mask PWMB output, should be logical OR of _pwm_sm_enable.
static void PWM_UnmaskCombinedOutput ( PWM_Type *  base,
uint16_t  u16XSubModules,
uint16_t  u16ASubModules,
uint16_t  u16BSubModules 
)
inlinestatic

This function handles MASKA/MASKB/MASKX bit filed of MASK register at the same time.

Note
The mask bits is buffered and can be updated until a FORCE_OUT event occurs or a software update command.
Parameters
basePWM peripheral base address
u16XSubModulesThe submodules that unmask PWMX output, should be logical OR of _pwm_sm_enable.
u16ASubModulesThe submodules that unmask PWMA output, should be logical OR of _pwm_sm_enable.
u16BSubModulesThe submodules that unmask PWMB output, should be logical OR of _pwm_sm_enable.
static void PWM_UpdateMask ( PWM_Type *  base,
pwm_sm_number_t  eSubModule 
)
inlinestatic
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
static void PWM_EnablePwmRunInDebug ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
bool  bEnable 
)
inlinestatic
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
bEnableEnable the feature or not.
  • true Enable load feature.
  • false Disable load feature.
static void PWM_EnablePwmRunInWait ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
bool  bEnable 
)
inlinestatic
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
bEnableEnable the feature or not.
  • true Enable load feature.
  • false Disable load feature.
static void PWM_EnableCounters ( PWM_Type *  base,
uint16_t  u16Mask 
)
inlinestatic

Sets the Run bit which enables the clocks to the PWM submodule. This function can start multiple submodules at the same time.

Parameters
basePWM peripheral base address
u16MaskPWM submodules to start run, Logical OR of _pwm_sm_enable.
static void PWM_DisableCounters ( PWM_Type *  base,
uint16_t  u16Mask 
)
inlinestatic

Clears the Run bit which resets the submodule's counter. This function can stop multiple submodules at the same time.

Parameters
basePWM peripheral base address
u16MaskPWM submodules to start run, Logical OR of _pwm_sm_enable.
static uint16_t PWM_GetCaptureValue ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_register_t  eRegister 
)
inlinestatic

This function read the CVALn register value, stores the value captured from the submodule counter.

Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eRegisterPWM submodule input capture value register, see pwm_sm_input_capture_register_t.
Returns
The input capture value.
static uint16_t PWM_GetCaptureValueCycle ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_register_t  eRegister 
)
inlinestatic

This function read the CVALnCYC register value, stores the cycle number corresponding to the value captured in CVALn. This register is incremented each time the counter is loaded with the INIT value at the end of a PWM modulo cycle.

Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eRegisterPWM submodule input capture value register, see pwm_sm_input_capture_register_t.
Returns
The input capture register cycle value.
static uint16_t PWM_GetCaptureEdgeCounterVaule ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_pin_t  eInputPin 
)
inlinestatic

Each input capture logic has a edge counter, which counts both the rising and falling edges of the input capture signal and it compare signal can select as input capture trigger source.

Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eInputPinPWM submodule input capture pin number, see pwm_sm_input_capture_pin_t.
void PWM_SetupInputCaptureConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_pin_t  eInputPin,
const pwm_sm_input_capture_config_t psConfig 
)

Each PWM submodule has 3 pins that can be configured for use as input capture pins. This function sets up the capture parameters for each pin and enables the input capture operation.

Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eInputPinPWM submodule input capture pin number, see pwm_sm_input_capture_pin_t.
psConfigPointer to input capture configure structure, see pwm_sm_input_capture_config_t.
static void PWM_EnableInputCapture ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_pin_t  eInputPin 
)
inlinestatic

Enables input capture operation will start the input capture process. The enable bit is self-cleared when in one shot mode and one or more of the enabled capture circuits has had a capture event.

Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eInputPinPWM submodule input capture pin number, see pwm_sm_input_capture_pin_t.
static void PWM_DisableInputCapture ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_pin_t  eInputPin 
)
inlinestatic

The enable bit can be cleared at any time to disable input capture operation.

Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
eInputPinPWM submodule input capture pin number, see pwm_sm_input_capture_pin_t.
static uint16_t PWM_GetInputValue ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_input_capture_pin_t  eInputPin 
)
inlinestatic
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
eInputPinPWM submodule input capture pin number, see pwm_sm_input_capture_pin_t.
Returns
The PWM submodule input capture pin logic value.
void PWM_SetupFaultProtectionConfig ( PWM_Type *  base,
pwm_fault_protection_channel_t  eFaultProtection,
const pwm_fault_protection_config_t psConfig 
)
Parameters
basePWM peripheral base address.
eFaultProtectionPWM fault protection channel number, see pwm_fault_protection_channel_t.
psConfigPointer to fault protection channel configure structure, see pwm_fault_protection_config_t.
static void PWM_SetupSMFaultInputMapping ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_pwm_out_t  ePwmOutput,
const pwm_sm_fault_input_mapping_t psMapping 
)
inlinestatic
Note
Each PWM output can be mapping anyone or more fault inputs. The mapped fault protection channel inputs can disable PWM output.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
ePwmOutputPWM submodule output, see pwm_sm_pwm_out_t.
psMappingThe fault input disable mapping structure, see pwm_sm_fault_input_mapping_t.
void PWM_SetupDmaConfig ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
const pwm_sm_dma_config_t psConfig 
)
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
psConfigPointer to PWM submodule DMA configure, see pwm_sm_dma_config_t.
static void PWM_SetEnabledCaptureDmaSource ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
pwm_sm_capture_dma_source_t  eCaptureDmaSource 
)
inlinestatic
Note
This function only can be used when the bEnableCaptureDMA be true.
Parameters
basePWM peripheral base address.
eSubModulePWM submodule number, see pwm_sm_number_t.
u16MaskThe PWM submodule DMA requests to enable. Logical OR of _pwm_sm_dma_enable.
static void PWM_EnableSMInterrupts ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
uint16_t  u16Mask 
)
inlinestatic

This examples shows how to enable VAL 0 compare interrupt and VAL 1 compare interrupt.

Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
u16MaskThe PWM submodule interrupts to enable. Logical OR of _qtmr_channel_interrupt_enable.
static void PWM_DisbaleSMInterrupts ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
uint16_t  u16Mask 
)
inlinestatic

This examples shows how to disable VAL 0 compare interrupt and VAL 1 compare interrupt.

Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
u16MaskThe PWM submodule interrupts to enable. Logical OR of _qtmr_channel_interrupt_enable.
static void PWM_EnableFaultInterrupts ( PWM_Type *  base,
pwm_fault_protection_channel_t  eFaultProtection,
uint16_t  u16Mask 
)
inlinestatic

This examples shows how to enable fault pin 0 interrupt and fault pin 1 interrupt.

Parameters
basePWM peripheral base address
eFaultProtectionPWM fault protection channel number, see pwm_fault_protection_channel_t.
u16MaskThe PWM fault protection channel interrupts to enable. Logical OR of _pwm_fault_protection_interrupt_enable.
static void PWM_DisableFaultInterrupts ( PWM_Type *  base,
pwm_fault_protection_channel_t  eFaultProtection,
uint16_t  u16Mask 
)
inlinestatic

This examples shows how to disable fault pin 0 interrupt and fault pin 1 interrupt.

Parameters
basePWM peripheral base address
eFaultProtectionPWM fault protection channel number, see pwm_fault_protection_channel_t.
u16MaskThe PWM fault protection channel interrupts to disable. Logical OR of _pwm_fault_protection_interrupt_enable.
static uint16_t PWM_GetSMStatusFlags ( PWM_Type *  base,
pwm_sm_number_t  eSubModule 
)
inlinestatic

This examples shows how to check whether the submodule VAL0 compare flag set.

* {
* ...
* }
*
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
Returns
The PWM submodule status flags. This is the logical OR of _pwm_sm_status_flags.
static void PWM_ClearSMStatusFlags ( PWM_Type *  base,
pwm_sm_number_t  eSubModule,
uint16_t  u16Mask 
)
inlinestatic
Note
The kPWM_RegUpdatedFlag can't be cleared by software.

This examples shows how to clear the submodule VAL0 compare flag.

* PWM_ClearSMStatusFlags(PWM, kPWM_SubModule0, kPWM_CompareVal0Flag);
*
Parameters
basePWM peripheral base address
eSubModulePWM submodule number, see pwm_sm_number_t.
u8MaskThe status flags to clear. This is the logical OR of _pwm_sm_status_flags.
static uint16_t PWM_GetFaultStatusFlags ( PWM_Type *  base,
pwm_fault_protection_channel_t  eFaultProtection 
)
inlinestatic

This examples shows how to check whether the fault protection channel fault input pin 0 set.

* if((PWM_GetFaultStatusFlags(PWM, kPWM_FaultProtection0) & kPWM_FaultPin0Flag) != 0U)
* {
* ...
* }
*
Parameters
basePWM peripheral base address
eFaultProtectionPWM fault protection channel number, see pwm_fault_protection_channel_t.
Returns
The PWM fault protection channel status flags. This is the logical OR of _pwm_fault_protection_status_flags.
static void PWM_ClearFaultStatusFlags ( PWM_Type *  base,
pwm_fault_protection_channel_t  eFaultProtection,
uint16_t  u16Mask 
)
inlinestatic
Note
The kPWM_FaultPin0Flag ~ kPWM_FaultPin3Flag can't be cleared by software.

This examples shows how to clear the fault protection channel fault 0 flag.

Parameters
basePWM peripheral base address
eFaultProtectionPWM fault protection channel number, see pwm_fault_protection_channel_t.
u16MaskThe PWM fault protection channel interrupts to disable. Logical OR of _pwm_fault_protection_interrupt_enable.