CMPSS外设
static inline void CMPSS_enableModule(uint32_t base)
- function function: Enable the CMPSS module according to the parameters passed in.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_disableModule(uint32_t base)
- function function: close the CMPSS module according to the input parameters.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_configHighComparator(uint32_t base, uint16_t config)
- function: Configure the high comparator in the CMPSS module.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- config: is a combination of three parameters, including the following:
(1) Parameter 1: input selection of negative terminal of comparator
CMPSS_INSRC_DAC
: select high comparator negative input source is internal DACCMPSS_INSRC_PIN
: select high comparator negative input source is external pin (2) Parameter 2: Whether the comparator output needs to be invertedCMPSS_INV_INVERTED
: Comparator output is inverted; (3) Parameter 3: theCMPSS_OR_ASYNC_OUT_W_FILT
asynchronous comparator outputs to the or gate along with the latched digital filter.
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_configLowComparator(uint32_t base, uint16_t config)
- function: configure the low comparator in the CMPSS module.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- config: is a combination of three parameters, including the following:
(1) Parameter 1: input selection of negative terminal of comparator
CMPSS_INSRC_DAC
: select low comparator negative input source is internal DACCMPSS_INSRC_PIN
: select low comparator negative input source is external pin (2) Parameter 2: Whether the comparator output needs to be invertedCMPSS_INV_INVERTED
: Comparator output is inverted; (3) Parameter 3: theCMPSS_OR_ASYNC_OUT_W_FILT
asynchronous comparator outputs to the or gate along with the latched digital filter.
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_configOutputsHigh(uint32_t base, uint16_t config)
- function: Set the output signal configuration of the high comparator, including
CTRIP
andCTRIPOUT
. -
parameter description:
- input parameters:
- base: base address of CMPSS module
- config: is a combination of two parameters, including the following:
(1) Parameter 1: High comparator
CTRIPOUT
source selectionCMPSS_TRIPOUT_ASYNC_COMP
: Asynchronous comparator output is driven toCTRIPOUTH
CMPSS_TRIPOUT_SYNC_COMP
: Synchronous comparator output is driven toCTRIPOUTH
CMPSS_TRIPOUT_FILTER
CTRIPOUTH
CMPSS_TRIPOUT_LATCH
CTRIPOUTH
: Digital filter output is drive to: Digital filter latch output is drive to (2) Parameter 2: High comparatorCTRIP
source selectionCMPSS_TRIP_ASYNC_COMP
: Asynchronous comparator output is driven toCTRIPH
CMPSS_TRIP_SYNC_COMP
: Synchronous comparator output is driven toCTRIPH
CMPSS_TRIP_FILTER
CTRIPH
CMPSS_TRIP_LATCH
CTRIPH
: Digital filter output is drive to: Digital filter latch output is drive to
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_configOutputsLow(uint32_t base, uint16_t config)
- function: Set the output signal configuration of the low comparator, including
CTRIP
andCTRIPOUT
. -
parameter description:
- input parameters:
- base: base address of CMPSS module
- config: is a combination of three parameters, including the following:
(1) Parameter 1: low comparator
CTRIPOUT
source selectionCMPSS_TRIPOUT_ASYNC_COMP
: Asynchronous comparator output driven toCTRIPOUTL
CMPSS _ TRIPOUT _ SYNC _ COMPCTRIPOUTL:同步比较器输出驱动到
CMPSS_TRIPOUT_FILTER
: Digital filter output driven toCTRIPOUTL
CMPSS _ TRIPOUT _ LA TCH:数字滤波器锁存输出驱动到
CTRIPOUTL (2) Parameter 2: low comparatorCTRIP
source selectionCMPSS_TRIP_ASYNC_COMP
: Asynchronous comparator output driven toCTRIPL
CMPSS _ TRIP _ SYNC _ COMPCTRIPL:同步比较器输出驱动到
CMPSS_TRIP_FILTER
: Digital filter output driven toCTRIPL
CMPSS _ TRIP _ LATCH0HTML0 UNK5CTRIPL
- return parameters:
- none
- input parameters:
-
static inline uint16_t CMPSS_getStatus(uint32_t base)
- function: Get the current state of the comparator including the digital filter output and the latched digital filter output.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- uint 16 _ t: Enumerated combination of the following field bits:
CMPSS_STS_HI_FILTOUT
: high digital filter outputCMPSS_STS_HI_LATCHFILTOUT
: high digital filter latch valueCMPSS_STS_LO_FILTOUT
: low digital filter outputCMPSS_STS_LO_LATCHFILTOUT
: low digital filter latch value
- uint 16 _ t: Enumerated combination of the following field bits:
- input parameters:
-
static inline void CMPSS_configDAC(uint32_t base, uint16_t config)
- function: Sets the internal DAC of the comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- config: is a combination of three parameters, including the following:
(1) Parameter one: When the value of the DAC is loaded from its shadow register
CMPSS_DACVAL_SYSCLK
: DAC value updatedCMPSS_DACVAL_PWMSYNC
on system clock: DAC value updated on PWM sync (2) Parameter 2: Voltage reference source selection of DAC = = (Note: opposite to TI here) = =CMPSS_DACREF_VDDA
: VDDA as voltage referenceCMPSS_DACREF_VDAC
for DAC: VDAC as voltage reference for DAC (3) Parameter 3: DAC source selectionCMPSS_DACSRC_SHDW
: DAC’s value is updatedCMPSS_DACSRC_RAMP
from its shadow register: DAC’s value is updated from the ramp generator
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_setDACValueHigh(uint32_t base, uint16_t value)
- function: Sets the DAC shadow value of the high comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: The 12-bit number is written to the shadow register of the high comparator DAC, and then the active value of the DAC is updated according to
CMPSS_configDAC()
the configuration in.
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_setDACValueLow(uint32_t base, uint16_t value)
- function: Sets the DAC shadow value of the low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: The 12-bit number is written to the shadow register of the low comparator DAC, and then the active value of the DAC is updated according to
CMPSS_configDAC()
the configuration in.
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_initFilterHigh(uint32_t base)
- function: Initialize the digital filter of the high comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_initFilterLow(uint32_t base)
- function: Initializes the digital filter of the low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline uint16_t CMPSS_getDACValueHigh(uint32_t base)
- function: Get the internal DAC value of the high comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- uint 16 _ t: Get the active value of the high comparator DAC (not the value of the shadow register)
- input parameters:
-
static inline uint16_t CMPSS_getDACValueLow(uint32_t base)
- function: Get the internal DAC value of the low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- uint 16 _ t: Get the active value of the low comparator DAC (not the value of the shadow register)
- input parameters:
-
static inline void CMPSS_clearFilterLatchHigh(uint32_t base)
- function function: Calling this function causes a software reset of the high comparator digital filter output latch.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_clearFilterLatchLow(uint32_t base)
- function function: Calling this function causes a software reset of the low comparator digital filter output latch.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_setMaxRampValue(uint32_t base, uint16_t value)
- function function: set the maximum reference value of ramp generator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: Set the maximum reference value of the ramp to be loaded into the ramp generator, 16 bits
- return parameters:
- none
- input parameters:
-
static inline uint16_t CMPSS_getMaxRampValue(uint32_t base)
- function function: get the maximum reference value of ramp generator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- uint16 _ t: Returns the latched ramp maximum reference value to be loaded into the ramp generator.
- input parameters:
-
static inline void CMPSS_setRampDecValue(uint32_t base, uint16_t value)
- function function: set the decrement value of the ramp generator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: the value subtracted from the ramp value every system clock cycle, 16 bits.
- return parameters:
- none
- input parameters:
-
static inline uint16_t CMPSS_getRampDecValue(uint32_t base)
- function function: get the decrement value of the ramp generator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- uint16 _ t: Returns the latch ramp decrement value subtracted from the ramp value every system clock cycle.
- input parameters:
-
static inline void CMPSS_setRampDelayValue(uint32_t base, uint16_t value)
- function function: Set the delay value of the ramp generator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: set delay value, 13 bits.
- return parameters:
- none
- input parameters:
-
static inline uint16_t CMPSS_getRampDelayValue(uint32_t base)
- function function: Obtain the delay value of ramp generator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- uint16 _ t: Returns the latched value of the number of cycles after starting the ramp generator delay decrementer.
- input parameters:
-
static inline void CMPSS_setHysteresis(uint32_t base, uint16_t value)
- function: set the hysteresis value of CMPSS.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: set hysteresis value, the maximum value is 7 = = (note: different from TI) = =
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_enableLatchResetOnPWMSYNCHigh(uint32_t base)
- function: Enable the EPWMSYNCPER signal to reset the latched output of the digital filter of the high comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_disableLatchResetOnPWMSYNCHigh(uint32_t base)
- function: Turns off the EPWMSYNCPER signal to reset the latched output of the digital filter of the high comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_enableLatchResetOnPWMSYNCLow(uint32_t base)
- function: Enable the EPWMSYNCPER signal to reset the latched output of the digital filter of the low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_disableLatchResetOnPWMSYNCLow(uint32_t base)
- function: Turns off the EPWMSYNCPER signal to reset the latched output of the digital filter of the low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_configBlanking(uint32_t base, uint16_t pwmBlankSrc)
- function: Configures which PWMBLANK signal from the ePWM module will remain in the trip reset state when epwmblank is enabled.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- pWM BlankSrc: input digital n will select PWM BLANKn signal, 1 < = n < = 16
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_enableBlanking(uint32_t base)
- function Function: This function enables the selected ePWMBLANK signal to hold the trip reset state.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
static inline void CMPSS_disableBlanking(uint32_t base)
- function Function: This function turns off the selected ePWMBLANK signal to maintain the trip reset state.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- return parameters:
- none
- input parameters:
-
void CMPSS_configFilterHigh(uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold);
- function: Configure the digital filter of the high comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- samplePrescale: Number of system clock cycles between high filter samples. The actual digital filter prescaler is samplePrescale + 1; 0 < = samplePrescale < = 1023.
- sample Window: configure the input FIFO sample window size of the high filter for monitoring; 5 bits
- threshold: configures the threshold for the majority pass of the high digital filter. 5 bits
- return parameters:
- none
- input parameters:
-
void CMPSS_configFilterLow(uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)
- function: Configure the digital filter of the low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- samplePrescale: Number of system clock cycles between low filter samples. The actual digital filter prescaler is samplePrescale + 1; 0 < = samplePrescale < = 1023.
- sample Window: Input FIFO sample window size configured with low digital filter for monitoring; 5 bits
- threshold: configure the threshold for the majority pass of the low digital filter. 5 bits
- return parameters:
- none
- input parameters:
-
void CMPSS_configLatchOnPWMSYNC(uint32_t base, bool highEnable, bool lowEnable)
- function: Configure whether the EPWMSYNCPER signal can reset the latched output of the digital filter of the high-low comparator.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- highEnable: When 1, the EPWMSYNCPER signal can reset the latch output of the high digital filter; when 0, it cannot.
- lowEnable: When 1, the EPWMSYNCPER signal can reset the latched output of the low digital filter; when 0, it cannot.
- return parameters:
- none
- input parameters:
-
void CMPSS_configRamp(uint32_t base, uint16_t maxRampVal, uint16_t decrementVal, uint16_t delayVal, uint16_t pwmSyncSrc, bool useRampValShdw)
- function function: configure ramp generator
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- max RampVal: Sets the maximum reference value of the ramp to be loaded into the ramp generator, 16 bits
- decrementVal: Sets the value subtracted from the ramp value every system clock cycle, 16 bits
- delayVal: Set the delay value of the ramp generator, 13 bits
- pWM SyncSrc: Ramp generator source selection. Determines which EPWMSYNCPER signal is used as the CMPSS module. Entering the number n selects the EPWMSYNCPERn signal, 1 < = n < = 16
- useR ampVal Shdw: ramp load selection. The ramp generator is loaded from the shadow register when 1 and from the latched value when 0.
- return parameters:
- none
- input parameters:
-
void CMPSS_setDACHPrescale(uint32_t base, uint16_t value);
- function to set the high comparator DAC sample clock prescale factor.
-
parameter description:
- input parameters:
- base: base address of CMPSS module
- value: high comparator DAC sampling clock prescaler, DAC sampling clock = system clock/prescaler, 10 bits
- return parameters:
- none
- input parameters:
-
void CMPSS_setDACLPrescale(uint32_t base, uint16_t value);
- function to set the low comparator DAC sample clock prescale factor.
- parameter description:
- input parameters:
- base: base address of CMPSS module
- value: low comparator DAC sampling clock prescaler, DAC sampling clock = system clock/prescaler, 10 bits
- return parameters:
- none
- input parameters: