CMPSS Module¶
The comparator subsystem (CMPSS) API provides a set of functions for programming the digital circuits of a pair of analog comparators. Functions are provided to configure each comparator and its corresponding 12-bit DAC and digital filter and to get both the latched and unlatched status of their output. There are also functions to configure the optional ramp generator circuit and to route incoming sync signals from the ePWM module.
The output signals of the CMPSS (referred to as CTRIPH, CTRIPOUTH, CTRIPL, and CTRIPOUTL) may be routed to GPIOs or other internal destinations using the X-BARs. See the X-BAR driver for details.
-
group
cmpss_api Defines
-
CMPSS_HICMP_CTL_M(CMPSS_COMPCTL_COMPHSOURCE| \
CMPSS_COMPCTL_COMPHINV| \
CMPSS_COMPCTL_ASYNCHEN)¶
-
CMPSS_LOCMP_CTL_M(CMPSS_COMPCTL_COMPLSOURCE| \
CMPSS_COMPCTL_COMPLINV| \
CMPSS_COMPCTL_ASYNCLEN)¶
-
CMPSS_BLANKSOURCEUSEL_S8U¶
-
CMPSS_RAMPSOURCEUSEL_S10U¶
-
CMPSS_INSRC_DAC0x0000U¶ Input driven by internal DAC.
-
CMPSS_INSRC_PIN0x0001U¶ Input driven by external pin.
-
CMPSS_INV_INVERTED0x0002U¶ Comparator output is inverted.
-
CMPSS_OR_ASYNC_OUT_W_FILT0x0040U¶ Asynch comparator output feeds into OR with latched digital filter output.
-
CMPSS_TRIPOUT_ASYNC_COMP0x0000U¶ Asynchronous comparator output drives CTRIPOUT.
-
CMPSS_TRIPOUT_SYNC_COMP0x0010U¶ Synchronous comparator output drives CTRIPOUT.
-
CMPSS_TRIPOUT_FILTER0x0020U¶ Filter output drives CTRIPOUT.
-
CMPSS_TRIPOUT_LATCH0x0030U¶ Latched filter output drives CTRIPOUT.
-
CMPSS_TRIP_ASYNC_COMP0x0000U¶ Asynchronous comparator output drives CTRIP.
-
CMPSS_TRIP_SYNC_COMP0x0004U¶ Synchronous comparator output drives CTRIP.
-
CMPSS_TRIP_FILTER0x0008U¶ Filter output drives CTRIP.
-
CMPSS_TRIP_LATCH0x000CU¶ Latched filter output drives CTRIP.
-
CMPSS_STS_HI_FILTOUT0x0001U¶ High digital filter output.
-
CMPSS_STS_HI_LATCHFILTOUT0x0002U¶ Latched value of high digital filter output.
-
CMPSS_STS_LO_FILTOUT0x0100U¶ Low digital filter output.
-
CMPSS_STS_LO_LATCHFILTOUT0x0200U¶ Latched value of low digital filter output.
-
CMPSS_DACVAL_SYSCLK0x0000U¶ DAC value updated from SYSCLK.
-
CMPSS_DACVAL_PWMSYNC0x0080U¶ DAC value updated from PWMSYNC.
-
CMPSS_DACREF_VDDA0x0000U¶ VDDA is the voltage reference.
-
CMPSS_DACREF_VDAC0x0020U¶ VDAC is the voltage reference.
-
CMPSS_DACSRC_SHDW0x0000U¶ DAC value updated from shadow register.
-
CMPSS_DACSRC_RAMP0x0001U¶ DAC value is updated from the ramp register.
-
CMPSS_PWMSYNC1717U¶ PWMSYNC17.
-
CMPSS_PWMSYNC1818U¶ PWMSYNC18.
-
CMPSS_PWMSYNC11U¶ PWMSYNC1.
-
CMPSS_PWMSYNC22U¶ PWMSYNC2.
-
CMPSS_PWMSYNC33U¶ PWMSYNC3.
-
CMPSS_PWMSYNC44U¶ PWMSYNC4.
-
CMPSS_PWMSYNC55U¶ PWMSYNC5.
-
CMPSS_PWMSYNC66U¶ PWMSYNC6.
-
CMPSS_PWMSYNC77U¶ PWMSYNC7.
-
CMPSS_PWMSYNC88U¶ PWMSYNC8.
-
CMPSS_PWMSYNC99U¶ PWMSYNC9.
-
CMPSS_PWMSYNC1010U¶ PWMSYNC10.
-
CMPSS_PWMSYNC1111U¶ PWMSYNC11.
-
CMPSS_PWMSYNC1212U¶ PWMSYNC12.
-
CMPSS_PWMSYNC1313U¶ PWMSYNC13.
-
CMPSS_PWMSYNC1414U¶ PWMSYNC14.
-
CMPSS_PWMSYNC1515U¶ PWMSYNC15.
-
CMPSS_PWMSYNC1616U¶ PWMSYNC16.
Enums
-
enum
CMPSS_FilterInput¶ Values:
-
enumerator
CMPSS_FILTIN_COMPOUT= 0x0000¶ Filter input driven by comp output.
-
enumerator
CMPSS_FILTIN_EXT_H1= 0x0001¶ Filter input driven by EXT_FILTIN_H[1].
-
enumerator
CMPSS_FILTIN_EXT_H2= 0x0002¶ Filter input driven by EXT_FILTIN_H[2].
-
enumerator
CMPSS_FILTIN_EXT_H3= 0x0003¶ Filter input driven by EXT_FILTIN_H[3].
-
enumerator
CMPSS_FILTIN_EXT_H4= 0x0004¶ Filter input driven by EXT_FILTIN_H[4].
-
enumerator
CMPSS_FILTIN_EXT_H5= 0x0005¶ Filter input driven by EXT_FILTIN_H[5].
-
enumerator
CMPSS_FILTIN_EXT_H6= 0x0006¶ Filter input driven by EXT_FILTIN_H[6].
-
enumerator
CMPSS_FILTIN_EXT_H7= 0x0007¶ Filter input driven by EXT_FILTIN_H[7].
-
enumerator
-
enum
CMPSS_RampDirection¶ Values:
-
enumerator
CMPSS_RAMP_DIR_DOWN= 0x0000¶ Decrementing Ramp.
-
enumerator
CMPSS_RAMP_DIR_UP= 0x2000U¶ Incrementing Ramp.
-
enumerator
-
enum
CMPSS_RampXTrigger¶ Values that can be passed to CMPSS_configureRampXTriggerHigh() as the trigger parameter.
Values:
-
enumerator
CMPSS_RAMP_XTRIGGER_DISABLE= 0x0000¶ RAMPH & RAMPL SOR trigger is the independently configured PWMSYNCx signal
-
enumerator
CMPSS_RAMP_XTRIGGER_RAMPH_EOR= 0x0001¶ RAMPH SOR trigger is the configured PWMSYNCx signal & RAMPL SOR trigger is RAMPH EOR
-
enumerator
CMPSS_RAMP_XTRIGGER_RAMPL_EOR= 0x0002¶ RAMPL SOR trigger is the configured PWMSYNCx signal and RAMPH SOR trigger is RAMPL EOR
-
enumerator
-
enum
CMPSS_DEActiveSelect¶ Values that can be passed to CMPSS_selectDEACTIVESource() API as the deactivesel parameter.
Values:
-
enumerator
CMPSS_DEACTIVE_EPWM1= 0x00U¶ EPWM1 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM2= 0x01U¶ EPWM2 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM3= 0x02U¶ EPWM3 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM4= 0x03U¶ EPWM4 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM5= 0x04U¶ EPWM5 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM6= 0x05U¶ EPWM6 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM7= 0x06U¶ EPWM7 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM8= 0x07U¶ EPWM8 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM9= 0x08U¶ EPWM9 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM10= 0x09U¶ EPWM10 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM11= 0x0AU¶ EPWM11 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM12= 0x0BU¶ EPWM12 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM13= 0x0CU¶ EPWM13 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM14= 0x0DU¶ EPWM14 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM15= 0x0EU¶ EPWM15 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM16= 0x0FU¶ EPWM16 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM17= 0x10U¶ EPWM17 DEACTIVE.
-
enumerator
CMPSS_DEACTIVE_EPWM18= 0x11U¶ EPWM18 DEACTIVE.
-
enumerator
-
enum
CMPSS_RampClockDiv¶ Values:
-
enumerator
CMPSS_RAMP_CLOCK_DIV1= 0x0U¶ RAMPCLK = SYSCLK/1.
-
enumerator
CMPSS_RAMP_CLOCK_DIV2= 0x1U¶ RAMPCLK = SYSCLK/2.
-
enumerator
CMPSS_RAMP_CLOCK_DIV3= 0x2U¶ RAMPCLK = SYSCLK/3.
-
enumerator
CMPSS_RAMP_CLOCK_DIV4= 0x3U¶ RAMPCLK = SYSCLK/4.
-
enumerator
CMPSS_RAMP_CLOCK_DIV5= 0x4U¶ RAMPCLK = SYSCLK/5.
-
enumerator
CMPSS_RAMP_CLOCK_DIV6= 0x5U¶ RAMPCLK = SYSCLK/6.
-
enumerator
CMPSS_RAMP_CLOCK_DIV7= 0x6U¶ RAMPCLK = SYSCLK/7.
-
enumerator
CMPSS_RAMP_CLOCK_DIV8= 0x7U¶ RAMPCLK = SYSCLK/8.
-
enumerator
CMPSS_RAMP_CLOCK_DIV9= 0x8U¶ RAMPCLK = SYSCLK/9.
-
enumerator
CMPSS_RAMP_CLOCK_DIV10= 0x9U¶ RAMPCLK = SYSCLK/10.
-
enumerator
CMPSS_RAMP_CLOCK_DIV11= 0xAU¶ RAMPCLK = SYSCLK/11.
-
enumerator
CMPSS_RAMP_CLOCK_DIV12= 0xBU¶ RAMPCLK = SYSCLK/12.
-
enumerator
CMPSS_RAMP_CLOCK_DIV13= 0xCU¶ RAMPCLK = SYSCLK/13.
-
enumerator
CMPSS_RAMP_CLOCK_DIV14= 0xDU¶ RAMPCLK = SYSCLK/14.
-
enumerator
CMPSS_RAMP_CLOCK_DIV15= 0xEU¶ RAMPCLK = SYSCLK/15.
-
enumerator
CMPSS_RAMP_CLOCK_DIV16= 0xFU¶ RAMPCLK = SYSCLK/16.
-
enumerator
Functions
-
void
CMPSS_enableModule(uint32_t base)¶ Enables the CMPSS module.
This function enables the CMPSS module passed into the
base parameter.- Parameters
base: is the base address of the CMPSS module.
- Return
None.
-
void
CMPSS_disableModule(uint32_t base)¶ Disables the CMPSS module.
This function disables the CMPSS module passed into the
base parameter.- Parameters
base: is the base address of the CMPSS module.
- Return
None.
-
void
CMPSS_configHighComparator(uint32_t base, uint16_t config)¶ Sets the configuration for the high comparator.
This function configures a comparator. The
config parameter is the result of a logical OR operation between a CMPSS_INSRC_xxx value and if desired, CMPSS_INV_INVERTED and CMPSS_OR_ASYNC_OUT_W_FILT values.- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the high comparator.
The CMPSS_INSRC_xxx term can take on the following values to specify the high comparator negative input source:
CMPSS_INSRC_DAC - The internal DAC.
CMPSS_INSRC_PIN - An external pin.
CMPSS_INV_INVERTED may be ORed into config if the comparator output should be inverted.
CMPSS_OR_ASYNC_OUT_W_FILT may be ORed into config if the asynchronous comparator output should be fed into an OR gate with the latched digital filter output before it is made available for CTRIPH or CTRIPOUTH.
- Return
None.
-
void
CMPSS_configLowComparator(uint32_t base, uint16_t config)¶ Sets the configuration for the low comparator.
This function configures a comparator. The
config parameter is the result of a logical OR operation between a CMPSS_INSRC_xxx value and if desired, CMPSS_INV_INVERTED and CMPSS_OR_ASYNC_OUT_W_FILT values.- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the low comparator.
The CMPSS_INSRC_xxx term can take on the following values to specify the low comparator negative input source:
CMPSS_INSRC_DAC - The internal DAC.
CMPSS_INSRC_PIN - An external pin.
CMPSS_INV_INVERTED may be ORed into config if the comparator output should be inverted.
CMPSS_OR_ASYNC_OUT_W_FILT may be ORed into config if the asynchronous comparator output should be fed into an OR gate with the latched digital filter output before it is made available for CTRIPL or CTRIPOUTL.
- Return
None.
-
void
CMPSS_configOutputsHigh(uint32_t base, uint16_t config)¶ Sets the output signal configuration for the high comparator.
This function configures a comparator’s output signals CTRIP and CTRIPOUT. The
config parameter is the result of a logical OR operation between the CMPSS_TRIPOUT_xxx and CMPSS_TRIP_xxx values.- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the high comparator output signals.
The CMPSS_TRIPOUT_xxx term can take on the following values to specify which signal drives CTRIPOUTH:
CMPSS_TRIPOUT_ASYNC_COMP - The asynchronous comparator output.
CMPSS_TRIPOUT_SYNC_COMP - The synchronous comparator output.
CMPSS_TRIPOUT_FILTER - The output of the digital filter.
CMPSS_TRIPOUT_LATCH - The latched output of the digital filter.
The CMPSS_TRIP_xxx term can take on the following values to specify which signal drives CTRIPH:
CMPSS_TRIP_ASYNC_COMP - The asynchronous comparator output.
CMPSS_TRIP_SYNC_COMP - The synchronous comparator output.
CMPSS_TRIP_FILTER - The output of the digital filter.
CMPSS_TRIP_LATCH - The latched output of the digital filter.
- Return
None.
-
void
CMPSS_configOutputsLow(uint32_t base, uint16_t config)¶ Sets the output signal configuration for the low comparator.
This function configures a comparator’s output signals CTRIP and CTRIPOUT. The
config parameter is the result of a logical OR operation between the CMPSS_TRIPOUT_xxx and CMPSS_TRIP_xxx values.- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the low comparator output signals.
The CMPSS_TRIPOUT_xxx term can take on the following values to specify which signal drives CTRIPOUTL:
CMPSS_TRIPOUT_ASYNC_COMP - The asynchronous comparator output.
CMPSS_TRIPOUT_SYNC_COMP - The synchronous comparator output.
CMPSS_TRIPOUT_FILTER - The output of the digital filter.
CMPSS_TRIPOUT_LATCH - The latched output of the digital filter.
The CMPSS_TRIP_xxx term can take on the following values to specify which signal drives CTRIPL:
CMPSS_TRIP_ASYNC_COMP - The asynchronous comparator output.
CMPSS_TRIP_SYNC_COMP - The synchronous comparator output.
CMPSS_TRIP_FILTER - The output of the digital filter.
CMPSS_TRIP_LATCH - The latched output of the digital filter.
- Return
None.
-
uint16_t
CMPSS_getStatus(uint32_t base)¶ Gets the current comparator status.
This function returns the current status for the comparator, specifically the digital filter output and latched digital filter output.
- Parameters
base: is the base address of the comparator module.
- Return
Returns the current interrupt status, enumerated as a bit field of the following values:
CMPSS_STS_HI_FILTOUT - High digital filter output
CMPSS_STS_HI_LATCHFILTOUT - Latched value of high digital filter output
CMPSS_STS_LO_FILTOUT - Low digital filter output
CMPSS_STS_LO_LATCHFILTOUT - Latched value of low digital filter output
-
void
CMPSS_configDAC(uint32_t base, uint16_t config)¶ Sets the configuration for the internal comparator DACs.
This function configures the comparator’s internal DAC. The
config parameter is the result of a logical OR operation between the CMPSS_DACVAL_xxx, CMPSS_DACREF_xxx, and CMPSS_DACSRC_xxx.- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the internal DAC.
The CMPSS_DACVAL_xxx term can take on the following values to specify when the DAC value is loaded from its shadow register:
CMPSS_DACVAL_SYSCLK - Value register updated on system clock.
CMPSS_DACVAL_PWMSYNC - Value register updated on PWM sync.
The CMPSS_DACREF_xxx term can take on the following values to specify which voltage supply is used as reference for the DACs:
CMPSS_DACREF_VDDA - VDDA is the voltage reference for the DAC.
CMPSS_DACREF_VDAC - VDAC is the voltage reference for the DAC.
The CMPSS_DACSRC_xxx term can take on the following values to specify the DAC value source for the high comparator’s internal DAC:
CMPSS_DACSRC_SHDW - The user-programmed DACVALS register.
CMPSS_DACSRC_RAMP - The ramp generator RAMPSTS register
- Note
This API configures only the high comparator DAC and is to be deprecated in future. Use APIs CMPSS_configDACHigh() and CMPSS_configDACLow() to configure the high and low comparator DACs respectively.
- Return
None.
-
void
CMPSS_configDACHigh(uint32_t base, uint16_t config)¶ Sets the configuration for the internal DAC of high comparator.
This function configures the high comparator’s internal DAC. The
config parameter is the result of a logical OR operation between the CMPSS_DACVAL_xxx, CMPSS_DACREF_xxx, and CMPSS_DACSRC_xxx.- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the internal DAC.
The CMPSS_DACVAL_xxx term can take on the following values to specify when the DAC value is loaded from its shadow register:
CMPSS_DACVAL_SYSCLK - Value register updated on system clock.
CMPSS_DACVAL_PWMSYNC - Value register updated on PWM sync.
The CMPSS_DACREF_xxx term can take on the following values to specify which voltage supply is used as reference for the DACs:
CMPSS_DACREF_VDDA - VDDA is the voltage reference for the DAC.
CMPSS_DACREF_VDAC - VDAC is the voltage reference for the DAC.
The CMPSS_DACSRC_xxx term can take on the following values to specify the DAC value source for the high comparator’s internal DAC:
CMPSS_DACSRC_SHDW - The user-programmed DACHVALS register.
CMPSS_DACSRC_RAMP - The ramp generator RAMPHSTS register
- Return
None.
-
void
CMPSS_configDACLow(uint32_t base, uint16_t config)¶ Sets the configuration for the internal DAC of low comparator
This function configures the low comparator’s internal DAC. The
config parameter can take on the following values to specify the DAC value source for the low comparator’s internal DAC:CMPSS_DACSRC_SHDW - The user-programmed DACLVALS register.
CMPSS_DACSRC_RAMP - The ramp generator RAMPLSTS register
- Parameters
base: is the base address of the CMPSS module.config: is the configuration of the internal DAC.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
void
CMPSS_setDACValueHigh(uint32_t base, uint16_t value)¶ Sets the value of the internal DAC of the high comparator.
This function sets the 12-bit value driven by the internal DAC of the high comparator. This function will load the value into the shadow register from which the actual DAC value register will be loaded. To configure which event causes this shadow load to take place, use
CMPSS_configDAC().- Parameters
base: is the base address of the comparator module.value: is the value actively driven by the DAC.
- Return
None.
-
void
CMPSS_setDACValueLow(uint32_t base, uint16_t value)¶ Sets the value of the internal DAC of the low comparator.
This function sets the 12-bit value driven by the internal DAC of the low comparator. This function will load the value into the shadow register from which the actual DAC value register will be loaded. To configure which event causes this shadow load to take place, use
CMPSS_configDAC().- Parameters
base: is the base address of the comparator module.value: is the value actively driven by the DAC.
- Return
None.
-
void
CMPSS_initFilterHigh(uint32_t base)¶ Initializes the digital filter of the high comparator.
This function initializes all the samples in the high comparator digital filter to the filter input value.
- Parameters
base: is the base address of the comparator module.
- Note
See CMPSS_configFilterHigh() for the proper initialization sequence to avoid glitches.
- Return
None.
-
void
CMPSS_initFilterLow(uint32_t base)¶ Initializes the digital filter of the low comparator.
This function initializes all the samples in the low comparator digital filter to the filter input value.
- Parameters
base: is the base address of the comparator module.
- Note
See CMPSS_configFilterLow() for the proper initialization sequence to avoid glitches.
- Return
None.
-
void
CMPSS_configureFilterInputHigh(uint32_t base, CMPSS_FilterInput filtInput)¶ Configures input for the digital filter of the high comparator.
This function configures input for the digital filter of the high comparator. The filter input can either be high comparator output or an external signal configured through XBAR.
- Parameters
base: is the base address of the comparator module.filtInput: is the desired filter input
- Return
None.
-
void
CMPSS_configureFilterInputLow(uint32_t base, CMPSS_FilterInput filtInput)¶ Initializes the digital filter of the low comparator.
This function configures input for the digital filter of the low comparator. The filter input can either be low comparator output or an external signal configured through XBAR.
- Parameters
base: is the base address of the comparator module.filtInput: is the desired filter input
- Return
None.
-
uint16_t
CMPSS_getDACValueHigh(uint32_t base)¶ Gets the value of the internal DAC of the high comparator.
This function gets the value of the internal DAC of the high comparator. The value is read from the
active registernot the shadow register to which CMPSS_setDACValueHigh() writes.- Parameters
base: is the base address of the comparator module.
- Return
Returns the value driven by the internal DAC of the high comparator.
-
uint16_t
CMPSS_getDACValueLow(uint32_t base)¶ Gets the value of the internal DAC of the low comparator.
This function gets the value of the internal DAC of the low comparator. The value is read from the
active registernot the shadow register to which CMPSS_setDACValueLow() writes.- Parameters
base: is the base address of the comparator module.
- Return
Returns the value driven by the internal DAC of the low comparator.
-
void
CMPSS_clearFilterLatchHigh(uint32_t base)¶ Causes a software reset of the high comparator digital filter output latch.
This function causes a software reset of the high comparator digital filter output latch. It will generate a single pulse of the latch reset signal.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_clearFilterLatchLow(uint32_t base)¶ Causes a software reset of the low comparator digital filter output latch.
This function causes a software reset of the low comparator digital filter output latch. It will generate a single pulse of the latch reset signal.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_setMaxRampValue(uint32_t base, uint16_t value)¶ Sets the ramp generator maximum reference value.
This function sets the ramp maximum reference value that will be loaded into the ramp generator.
- Parameters
base: is the base address of the comparator module.value: the ramp maximum reference value.
- Note
This API returns the reference value for only the high ramp generator and is to be deprecated in future. Use APIs CMPSS_getRampReferenceHigh() and CMPSS_getRampReferenceLow() to get reference value for high and low ramp generators respectively.
- Return
None.
-
uint16_t
CMPSS_getMaxRampValue(uint32_t base)¶ Gets the ramp generator maximum reference value.
- Note
This API returns the reference value for only the high ramp generator and is to be deprecated in future. Use APIs CMPSS_getRampReferenceHigh() and CMPSS_getRampReferenceLow() to get reference value for high and low ramp generators respectively.
- Return
Returns the latched ramp maximum reference value that will be loaded into the ramp generator.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampDecValue(uint32_t base, uint16_t value)¶ Sets the ramp generator decrement value.
This function sets the value that is subtracted from the ramp value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.value: is the ramp decrement value.
- Note
This API configures the step value only for the high ramp generator in down count mode and is to be deprecated in future. Use APIs CMPSS_setRampStepHigh() and CMPSS_setRampStepLow() to configure the step value for high and low ramp ramp generators respectively for up/down count mode.
- Return
None.
-
uint16_t
CMPSS_getRampDecValue(uint32_t base)¶ Gets the ramp generator decrement value.
- Note
This API returns the high ramp generator step value only and is to be deprecated in future. Use APIs CMPSS_getRampStepHigh() and CMPSS_getRampStepLow() to configure the step value for high and low ramp ramp generators respectively for up/down count mode.
- Return
Returns the latched ramp decrement value that is subtracted from the ramp value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampDelayValue(uint32_t base, uint16_t value)¶ Sets the ramp generator delay value.
This function sets the value that configures the number of system clock cycles to delay the start of the ramp generator decrementer after a PWMSYNC event is received. Delay value can be no greater than 8191.
- Parameters
base: is the base address of the comparator module.value: is the 13-bit ramp delay value.
- Note
This API configures the delay value for only the high ramp generator configured in down count mode and is to be deprecated in future. Use APIs CMPSS_setRampDelayHigh() and CMPSS_setRampDelayLow() to configure the delay value for high and low ramp generators respectively for up/down count mode.
- Return
None.
-
uint16_t
CMPSS_getRampDelayValue(uint32_t base)¶ Gets the ramp generator delay value.
- Note
This API returns delay value for only the high ramp generator and is to be deprecated in future. Use APIs CMPSS_getRampDelayHigh() and CMPSS_getRampDelayLow() to configure the delay value for high and low ramp ramp generators respectively for up/down count mode.
- Return
Returns the latched ramp delay value that is subtracted from the ramp value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampDirectionHigh(uint32_t base, CMPSS_RampDirection dir)¶ Sets the ramp direction for the high ramp generator
This function sets the ramp direction for the high ramp generator.
- Parameters
base: is the base address of the comparator module.dir: is the ramp direction for high ramp generator.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
void
CMPSS_setRampReferenceHigh(uint32_t base, uint16_t value)¶ Sets the high ramp generator reference value.
This function sets the reference value that will be loaded into the high ramp generator.
- Parameters
base: is the base address of the comparator module.value: the high ramp generator reference value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
uint16_t
CMPSS_getRampReferenceHigh(uint32_t base)¶ Gets the ramp generator reference value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
Returns the latched ramp reference value that will be loaded into the high ramp generator.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampStepHigh(uint32_t base, uint16_t value)¶ Sets the ramp generator decrement value.
This function sets the value that is subtracted from the ramp value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.value: is the ramp decrement value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
uint16_t
CMPSS_getRampStepHigh(uint32_t base)¶ Gets the ramp step value for high ramp generator.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
Returns the latched ramp step value that is added/subtracted from the ramp reference value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampDelayHigh(uint32_t base, uint16_t value)¶ Sets the high ramp generator delay value.
This function sets the value that configures the number of system clock cycles to delay the start of the ramp generator incrementor/decrementor after a PWMSYNC event is received. Delay value can be no greater than 8191.
- Parameters
base: is the base address of the comparator module.value: is the 13-bit ramp delay value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
uint16_t
CMPSS_getRampDelayHigh(uint32_t base)¶ Gets the high ramp generator delay value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
Returns the latched ramp delay value that configures the number of system clock cycles to delay the start of the ramp generator incrementor/ decrementor after a PWMSYNC event is received.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampDirectionLow(uint32_t base, CMPSS_RampDirection dir)¶ Sets the ramp direction for the low ramp generator
This function sets the ramp direction for the low ramp generator.
- Parameters
base: is the base address of the comparator module.dir: is the ramp direction for low ramp generator.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
void
CMPSS_setRampReferenceLow(uint32_t base, uint16_t value)¶ Sets the low ramp generator reference value.
This function sets the reference value that will be loaded into the low ramp generator.
- Parameters
base: is the base address of the comparator module.value: the low ramp generator reference value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
uint16_t
CMPSS_getRampReferenceLow(uint32_t base)¶ Gets the low ramp generator reference value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
Returns the latched ramp reference value that will be loaded into the low ramp generator.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampStepLow(uint32_t base, uint16_t value)¶ Sets the ramp generator decrement value.
This function sets the value that is added/subtracted from the ramp value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.value: is the ramp decrement value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
uint16_t
CMPSS_getRampStepLow(uint32_t base)¶ Gets the ramp step value for low ramp generator.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
Returns the latched ramp step value that is added/subtracted from the ramp reference value on every system clock cycle.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampDelayLow(uint32_t base, uint16_t value)¶ Sets the low ramp generator delay value.
This function sets the value that configures the number of system clock cycles to delay the start of the ramp generator incrementor/decrementor after a PWMSYNC event is received. Delay value can be no greater than 8191.
- Parameters
base: is the base address of the comparator module.value: is the 13-bit ramp delay value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
uint16_t
CMPSS_getRampDelayLow(uint32_t base)¶ Gets the low ramp generator delay value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
Returns the latched ramp delay value that configures the number of system clock cycles to delay the start of the ramp generator incrementor/ decrementor after a PWMSYNC event is received.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_configureRampXTriggerHigh(uint32_t base, CMPSS_RampXTrigger trigger)¶ Configures high ramp generator cross trigger feature
This function configures the cross trigger feature for the high ramp generators. Cross triggering allows usage of both high and low ramp generators in the CMPSS with the involvement of single PWM trigger. When enabled, cross triggering allows selected PWMSYNCx signal to trigger start of ramp(SOR) of primary ramp while secondary ramp can be triggered by the end of ramp (EOR) of primary ramp generator.
- Parameters
base: is the base address of the comparator module.trigger: is the desired cross trigger for ramp generation
- Note
The primary ramp generator trigger can be configured through CMPSS_configureSyncSourceHigh() API.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
void
CMPSS_configureSyncSourceHigh(uint32_t base, uint16_t syncSource)¶ Configures sync source for high comparator
This function configures desired EPWMxSYNCPER source for high comparator blocks. Configured EPWMxSYNCPER signal can be used to synchronize loading of DAC input value from shadow to active register. It can also be used to synchronize Ramp generator, if applicable. Refer to device manual to check if Ramp generator is available in the desired CMPSS instance.
- Parameters
base: is the base address of the comparator module.syncSource: is the desired EPWMxSYNCPER source
Valid values for syncSource parameter can be 1 to n, where n represents the maximum number of EPWMSYNCPER signals available on the device. For instance, passing 2 into syncSource will select EPWM2SYNCPER.
- Return
None.
-
void
CMPSS_configureSyncSourceLow(uint32_t base, uint16_t syncSource)¶ Configures sync source for low comparator
This function configures desired EPWMxSYNCPER source for low comparator blocks. Configured EPWMxSYNCPER signal can be used to synchronize loading of DAC input value from shadow to active register. It can also be used to synchronize Ramp generator, if applicable. Refer to device manual to check if Ramp generator is available in the desired CMPSS instance.
- Parameters
base: is the base address of the comparator module.syncSource: is the desired EPWMxSYNCPER source
Valid values for syncSource parameter can be 1 to n, where n represents the maximum number of EPWMSYNCPER signals available on the device. For instance, passing 2 into syncSource will select EPWM2SYNCPER.
- Return
None.
-
void
CMPSS_setRampClockDividerHigh(uint32_t base, CMPSS_RampClockDiv divider)¶ Sets the high ramp generator clock divider value.
This function sets the ramp clock divider value for high comparator(COMPH) to be divided from SYSCLK to configure the ramp generator clock. Valid values for param
divider can be refered from enum CMPSS_RampClockDiv.- Parameters
base: is the base address of the comparator module.value: is the ramp clock divider value.
- Return
None.
-
uint16_t
CMPSS_getRampClockDividerHigh(uint32_t base)¶ Gets the high ramp generator clock divider value.
- Return
Returns the latched ramp clock divider value that is divided from the SYSCLK to configure the ramp generator clock.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setRampClockDividerLow(uint32_t base, CMPSS_RampClockDiv divider)¶ Sets the low ramp generator clock divider value.
This function sets the ramp clock divider value for low comparator(COMPL) to be divided from SYSCLK to configure the ramp generator clock. Valid values for param
divider can be refered from enum CMPSS_RampClockDiv.- Parameters
base: is the base address of the comparator module.divider: is the ramp clock divider value.
- Return
None.
-
uint16_t
CMPSS_getRampClockDividerLow(uint32_t base)¶ Gets the low ramp generator clock divider value.
- Return
Returns the latched ramp clock divider value that is divided from the SYSCLK to configure the low ramp generator clock.
- Parameters
base: is the base address of the comparator module.
-
void
CMPSS_setHysteresis(uint32_t base, uint16_t value)¶ Sets the comparator hysteresis settings.
This function sets the amount of hysteresis on the comparator inputs. The
value parameter indicates the amount of hysteresis desired. Passing in 0 results in none, passing in 1 results in typical hysteresis, passing in 2 results in 2x of typical hysteresis, and so on where value x of typical hysteresis is the amount configured.- Parameters
base: is the base address of the comparator module.value: is the amount of hysteresis on the comparator inputs.
- Return
None.
-
void
CMPSS_enableLatchResetOnPWMSYNCHigh(uint32_t base)¶ Enables reset of HIGH comparator digital filter output latch on PWMSYNC
This function enables EPWMSYNCPER reset of High comparator digital filter output latch
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_disableLatchResetOnPWMSYNCHigh(uint32_t base)¶ Disables reset of HIGH comparator digital filter output latch on PWMSYNC
This function disables EPWMSYNCPER reset of High comparator digital filter output latch
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_enableLatchResetOnPWMSYNCLow(uint32_t base)¶ Enables reset of LOW comparator digital filter output latch on PWMSYNC
This function enables EPWMSYNCPER reset of Low comparator digital filter output latch
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_disableLatchResetOnPWMSYNCLow(uint32_t base)¶ Disables reset of LOW comparator digital filter output latch on PWMSYNC
This function disables EPWMSYNCPER reset of Low comparator digital filter output latch
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_configBlanking(uint32_t base, uint16_t pwmBlankSrc)¶ Sets the ePWM module blanking signal that holds trip in reset.
This function configures which PWMBLANK signal from the ePWM module will hold trip in reset when blanking is enabled.
- Parameters
base: is the base address of the comparator module.pwmBlankSrc: is the number of the PWMBLANK source.
The number of the PWMBLANK signal to be used to reset the ramp generator should be specified by passing it into the pwmBlankSrc parameter. For instance, passing a 2 into pwmBlankSrc will select PWMBLANK2.
- Note
This API configures blanking source for only the high comparator and is to be deprecated in future. Use APIs CMPSS_configBlankingSourceHigh() and CMPSS_configBlankingSourceLow() to configure the blanking source for high and low comparators respectively.
- Return
None.
-
void
CMPSS_enableBlanking(uint32_t base)¶ Enables an ePWM blanking signal to hold trip in reset.
This function enables a selected ePWM blanking signal to hold trip in reset.
- Parameters
base: is the base address of the comparator module.
- Note
This API enables blanking for only the high comparator subsystem and is to be deprecated in future. Use APIs CMPSS_enableBlankingHigh() and CMPSS_enableBlankingLow() to enable the blanking for high and low comparators respectively.
- Return
None.
-
void
CMPSS_disableBlanking(uint32_t base)¶ Disables an ePWM blanking signal from holding trip in reset.
This function disables a selected ePWM blanking signal from holding trip in reset.
- Parameters
base: is the base address of the comparator module.
- Note
This API disables blanking for only the high comparator subsystem and is to be deprecated in future. Use APIs CMPSS_disableBlankingHigh() and CMPSS_disableBlankingLow() to disable the blanking for high and low comparators respectively.
- Return
None.
-
void
CMPSS_configBlankingSourceHigh(uint32_t base, uint16_t pwmBlankSrc)¶ Sets the high comparator ePWM module blanking signal source that holds trip in reset.
This function configures which PWMBLANK signal from the ePWM module will hold trip in reset when blanking is enabled in high comparator digital filter.
- Parameters
base: is the base address of the comparator module.pwmBlankSrc: is the number of the PWMBLANK source.
The number of the PWMBLANK signal to be used should be specified by passing it into the pwmBlankSrc parameter. For instance, passing a 2 into pwmBlankSrc will select PWMBLANK2.
- Return
None.
-
void
CMPSS_enableBlankingHigh(uint32_t base)¶ Enables high comparator’s ePWM blanking signal to hold trip in reset.
This function enables high comparator’s selected ePWM blanking signal to hold trip in reset.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_disableBlankingHigh(uint32_t base)¶ Disables high comparator’s ePWM blanking signal from holding trip in reset.
This function disables high comparator’s selected ePWM blanking signal from holding trip in reset.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_configBlankingSourceLow(uint32_t base, uint16_t pwmBlankSrc)¶ Sets the low comparator’s ePWM module blanking signal source that holds trip in reset.
This function configures which PWMBLANK signal from the ePWM module will hold trip in reset when blanking is enabled for low comparator.
- Parameters
base: is the base address of the comparator module.pwmBlankSrc: is the number of the PWMBLANK source.
The number of the PWMBLANK signal to be used should be specified by passing it into the pwmBlankSrc parameter. For instance, passing a 2 into pwmBlankSrc will select PWMBLANK2.
- Return
None.
-
void
CMPSS_enableBlankingLow(uint32_t base)¶ Enables low comparator’s ePWM blanking signal to hold trip in reset.
This function enables low comparator’s selected ePWM blanking signal to hold trip in reset.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_disableBlankingLow(uint32_t base)¶ Disables low comparator’s ePWM blanking signal from holding trip in reset.
This function disables low comparator’s selected ePWM blanking signal from holding trip in reset.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_enableDEmode(uint32_t base)¶ Enables the CMPSS diode emulation mode.
This function enables the CMPSS diode emulation mode.
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_disableDEmode(uint32_t base)¶ Disables the CMPSS diode emulation mode
This function disables the CMPSS diode emulation mode
- Parameters
base: is the base address of the comparator module.
- Return
None.
-
void
CMPSS_selectDEACTIVESource(uint32_t base, uint16_t deactivesel)¶ Select the CMPSS diode emulation mode DEACTIVE source
This function selects the CMPSS diode emulation mode DEACTIVE source Valid values for param
deactivesel are to be referred from CMPSS_DEActiveSelect enum.- Parameters
base: is the base address of the comparator module.deactivesel: is the DEACTIVE source select
- Return
None.
-
void
CMPSS_configHighDACShadowValueDE(uint32_t base, uint16_t dacval)¶ Sets the shadow value 2 (used in DE mode) of the internal DAC of the high comparator.
This function sets the 12-bit value driven by the internal DAC of the high comparator. This function will load the value into the shadow register 2 from which the actual DAC value register will be loaded in DE mode.
- Parameters
base: is the base address of the comparator module.dacval: is the value actively driven by the DAC.
- Return
None.
-
void
CMPSS_configLowDACShadowValueDE(uint32_t base, uint16_t dacval)¶ Sets the shadow value 2 (used in DE mode) of the internal DAC of the low comparator.
This function sets the 12-bit value driven by the internal DAC of the low comparator. This function will load the value into the shadow register 2 from which the actual DAC value register will be loaded in DE mode.
- Parameters
base: is the base address of the comparator module.dacval: is the value actively driven by the DAC.
- Return
None.
-
void
CMPSS_selectBlankSourceGroupHigh(uint32_t base, CMPSS_EPWMGroup group)¶ Select the Blank source group for high comparator.
This function selects the Blank source group for high comparator(COMPH). Valid values for param
group can be: CMPSS_EPWM_GROUP_0TO15 or CMPSS_EPWM_GROUP_16TO31.- Parameters
base: is the base address of the comparator module.group: is the blank source group
- Return
None.
-
void
CMPSS_selectBlankSourceGroupLow(uint32_t base, CMPSS_EPWMGroup group)¶ Select the Blank source group for low comparator.
This function selects the Blank source group for low comparator(COMPL). Valid values for param
group can be: CMPSS_EPWM_GROUP_0TO15 or CMPSS_EPWM_GROUP_16TO31.- Parameters
base: is the base address of the comparator module.group: is the blank source group.
- Return
None.
-
void
CMPSS_selectRampSourceGroupHigh(uint32_t base, CMPSS_EPWMGroup group)¶ Select the Ramp source group for high comparator.
This function selects the Ramp source group for high comparator(COMPH). Valid values for param
group can be: CMPSS_EPWM_GROUP_0TO15 or CMPSS_EPWM_GROUP_16TO31.- Parameters
base: is the base address of the comparator module.group: is the ramp source group.
- Return
None.
-
void
CMPSS_selectRampSourceGroupLow(uint32_t base, CMPSS_EPWMGroup group)¶ Select the Ramp source group for low comparator.
This function selects the Ramp source group for low comparator(COMPL). Valid values for param
group can be: CMPSS_EPWM_GROUP_0TO15 or CMPSS_EPWM_GROUP_16TO31.- Parameters
base: is the base address of the comparator module.group: is the ramp source group.
- Return
None.
-
void
CMPSS_configFilterHigh(uint32_t base, uint32_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)¶ Configures the digital filter of the high comparator.
This function configures the operation of the digital filter of the high comparator.
- Parameters
base: is the base address of the comparator module.samplePrescale: is the number of system clock cycles between samples.sampleWindow: is the number of FIFO samples to monitor.threshold: is the majority threshold of samples to change state.
The samplePrescale parameter specifies the number of system clock cycles between samples.It is a 24-bit value so a number higher than 16777215 should not be passed as this parameter. The prescaler used by digital filter is 1 more than samplePrescale value. So, the input provided should be 1 less than the expected prescaler.
The sampleWindow parameter configures the size of the window of FIFO samples taken from the input that will be monitored to determine when to change the filter output. This sample window may be no larger than 64 samples.
The threshold parameter configures the threshold value to be used by the digital filter.
The filter output resolves to the majority value of the sample window where majority is defined by the value passed into the threshold parameter. For proper operation, the value of threshold must be greater than sampleWindow / 2.
To ensure proper operation of the filter, the following is the recommended function call sequence for initialization:
Configure and enable the comparator using CMPSS_configHighComparator() and CMPSS_enableModule()
Configure the digital filter using CMPSS_configFilterHigh()
Initialize the sample values using CMPSS_initFilterHigh()
Configure the module output signals CTRIP and CTRIPOUT using CMPSS_configOutputsHigh()
- Return
None.
-
void
CMPSS_configFilterLow(uint32_t base, uint32_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)¶ Configures the digital filter of the low comparator.
This function configures the operation of the digital filter of the low comparator.
- Parameters
base: is the base address of the comparator module.samplePrescale: is the number of system clock cycles between samples.sampleWindow: is the number of FIFO samples to monitor.threshold: is the majority threshold of samples to change state.
The samplePrescale parameter specifies the number of system clock cycles between samples.It is a 24-bit value so a number higher than 16777215 should not be passed as this parameter. The prescaler used by digital filter is 1 more than samplePrescale value. So, the input provided should be 1 less than the expected prescaler.
The sampleWindow parameter configures the size of the window of FIFO samples taken from the input that will be monitored to determine when to change the filter output. This sample window may be no larger than 64 samples.
The threshold parameter configures the threshold value to be used by the digital filter.
The filter output resolves to the majority value of the sample window where majority is defined by the value passed into the threshold parameter. For proper operation, the value of threshold must be greater than sampleWindow / 2.
To ensure proper operation of the filter, the following is the recommended function call sequence for initialization:
Configure and enable the comparator using CMPSS_configLowComparator() and CMPSS_enableModule()
Configure the digital filter using CMPSS_configFilterLow()
Initialize the sample values using CMPSS_initFilterLow()
Configure the module output signals CTRIP and CTRIPOUT using CMPSS_configOutputsLow()
- Return
None.
-
void
CMPSS_configLatchOnPWMSYNC(uint32_t base, bool highEnable, bool lowEnable)¶ Configures whether or not the digital filter latches are reset by PWMSYNC
This function configures whether or not the digital filter latches in both the high and low comparators should be reset by PWMSYNC. If the
highEnable parameter is true, the PWMSYNC will be allowed to reset the high comparator’s digital filter latch. If it is false, the ability of the PWMSYNC to reset the latch will be disabled. The lowEnable parameter has the same effect on the low comparator’s digital filter latch.- Parameters
base: is the base address of the comparator module.highEnable: indicates filter latch settings in the high comparator.lowEnable: indicates filter latch settings in the low comparator.
- Return
None.
-
void
CMPSS_configRamp(uint32_t base, uint16_t maxRampVal, uint16_t decrementVal, uint16_t delayVal, uint16_t pwmSyncSrc, bool useRampValShdw)¶ Configures the comparator subsystem’s ramp generator.
This function configures many of the main settings of the comparator subsystem’s ramp generator. The
maxRampVal parameter should be passed the ramp maximum reference value that will be loaded into the ramp generator. The decrementVal parameter should be passed the decrement value that will be subtracted from the ramp generator on each system clock cycle. The delayVal parameter should be passed the 13-bit number of system clock cycles the ramp generator should delay before beginning to decrement the ramp generator after a PWMSYNC signal is received.- Parameters
base: is the base address of the comparator module.maxRampVal: is the ramp maximum reference value.decrementVal: value is the ramp decrement value.delayVal: is the ramp delay value.pwmSyncSrc: is the number of the PWMSYNC source.useRampValShdw: indicates if the max ramp shadow should be used.
The number of the PWMSYNC signal to be used to reset the ramp generator should be specified by passing it into the pwmSyncSrc parameter. For instance, passing a CMPSS_PWMSYNCx into pwmSyncSrc will select PWMSYNCx.
To indicate whether the ramp generator should reset with the value from the ramp max reference value shadow register or with the latched ramp max reference value, use the useRampValShdw parameter. Passing it true will result in the latched value being bypassed. The ramp generator will be loaded right from the shadow register. A value of false will load the ramp generator from the latched value.
- Note
This API configures the high ramp generator in down count mode only and is to be deprecated for this device. Use CMPSS_configRampHigh() and CMPSS_configRampLow() for configuring the hign and low ramp generators respectively in up/down count mode as per the requirement.
- Return
None.
-
void
CMPSS_configRampHigh(uint32_t base, CMPSS_RampDirection rampDir, uint16_t rampRef, uint16_t stepVal, uint16_t delayVal, uint16_t pwmSyncSrc, bool useRampValShdw)¶ Configures the comparator subsystem’s high ramp generator.
This function configures many of the main settings of the comparator subsystem’s high ramp generator. The
rampDir parameter should be passed the desired ramp direction. The rampRef parameter should be passed the ramp reference value based on the direction that will be loaded into the ramp generator. The stepVal parameter should be passed the ramp step value that will be added/subtracted based on the direction from the ramp generator on each system clock cycle. The delayVal parameter should be passed the 13-bit number of system clock cycles the ramp generator should delay before beginning to decrement the ramp generator after a PWMSYNC signal is received.- Parameters
base: is the base address of the comparator module.rampDir: is ramp direction of high ramp generator.rampRef: is the ramp reference value of high ramp generator.stepVal: value is ramp step value of high ramp generator.delayVal: is ramp delay value of high ramp generator.pwmSyncSrc: is the number of the PWMSYNC source.useRampValShdw: indicates if ramp reference shadow should be used.
Values for parameters rampDir, rampRef, stepVal, delayVal and pwmSyncSrc may be set individually using CMPSS_setRampDirectionHigh(), CMPSS_setRampReferenceHigh(), CMPSS_setRampStepHigh(), CMPSS_setRampDelayHigh() and CMPSS_configureSyncSourceHigh() APIs respectively.
The number of the PWMSYNC signal to be used to reset the ramp generator should be specified by passing it into the pwmSyncSrc parameter. For instance, passing a CMPSS_PWMSYNCx into pwmSyncSrc will select PWMSYNCx.
To indicate whether the ramp generator should reset with the value from the ramp reference value shadow register or with the latched ramp reference value, use the useRampValShdw parameter. Passing it true will result in the latched value being bypassed. The ramp generator will be loaded right from the shadow register. A value of false will load the ramp generator from the latched value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
void
CMPSS_configRampLow(uint32_t base, CMPSS_RampDirection rampDir, uint16_t rampRef, uint16_t stepVal, uint16_t delayVal, uint16_t pwmSyncSrc, bool useRampValShdw)¶ Configures the comparator subsystem’s low ramp generator.
This function configures many of the main settings of the comparator subsystem’s low ramp generator. The
rampDir parameter should be passed the desired ramp direction. The rampRef parameter should be passed the ramp reference value based on the direction that will be loaded into the ramp generator. The stepVal parameter should be passed the ramp step value that will be added/subtracted based on the direction from the ramp generator on each system clock cycle. The delayVal parameter should be passed the 13-bit number of system clock cycles the ramp generator should delay before beginning to decrement the ramp generator after a PWMSYNC signal is received.- Parameters
base: is the base address of the comparator module.rampDir: is ramp direction of low ramp generator.rampRef: is the ramp reference value of low ramp generator.stepVal: value is ramp step value of low ramp generator.delayVal: is ramp delay value of low ramp generator.pwmSyncSrc: is the number of the PWMSYNC source.useRampValShdw: indicates if ramp reference shadow should be used.
Values for parameters rampDir, rampRef, stepVal, delayVal and pwmSyncSrc may be set individually using CMPSS_setRampDirectionLow(), CMPSS_setRampReferenceLow(), CMPSS_setRampStepLow(), CMPSS_setRampDelayLow() and CMPSS_configureSyncSourceLow() APIs respectively.
The number of the PWMSYNC signal to be used to reset the ramp generator should be specified by passing it into the pwmSyncSrc parameter. For instance, passing a CMPSS_PWMSYNCx into pwmSyncSrc will select PWMSYNCx.
To indicate whether the ramp generator should reset with the value from the ramp reference value shadow register or with the latched ramp reference value, use the useRampValShdw parameter. Passing it true will result in the latched value being bypassed. The ramp generator will be loaded right from the shadow register. A value of false will load the ramp generator from the latched value.
- Note
This API is not valid for CMPSS-Lite IP.
- Return
None.
-
The two comparators are referred to as the high comparator and the low comparator. Accordingly, many API functions come in pairs with both a “High” and a “Low” version. See the device’s Technical Reference Manual for diagrams showing what resources the comparators share and what they contain separately.
The code for this module is contained in driverlib/cmpss.c, with driverlib/cmpss.h containing the API declarations for use by applications.