AM263Px MCU+ SDK  10.01.00

Introduction

This module contains APIs to program and use the CMPSS module.

Functions

static void CMPSS_enableModule (uint32_t base)
 
static void CMPSS_disableModule (uint32_t base)
 
static void CMPSS_configHighComparator (uint32_t base, uint16_t config)
 
static void CMPSS_configLowComparator (uint32_t base, uint16_t config)
 
static void CMPSS_configOutputsHigh (uint32_t base, uint16_t config)
 
static void CMPSS_configOutputsLow (uint32_t base, uint16_t config)
 
static uint16_t CMPSS_getStatus (uint32_t base)
 
static void CMPSS_configDAC (uint32_t base, uint16_t config)
 
static void CMPSS_setDACValueHigh (uint32_t base, uint16_t value)
 
static void CMPSS_setDACValueLow (uint32_t base, uint16_t value)
 
static void CMPSS_initFilterHigh (uint32_t base)
 
static void CMPSS_initFilterLow (uint32_t base)
 
static uint16_t CMPSS_getDACValueHigh (uint32_t base)
 
static uint16_t CMPSS_getDACValueLow (uint32_t base)
 
static void CMPSS_clearFilterLatchHigh (uint32_t base)
 
static void CMPSS_clearFilterLatchLow (uint32_t base)
 
static void CMPSS_setMaxRampValue (uint32_t base, uint16_t value)
 
static uint16_t CMPSS_getMaxRampValue (uint32_t base)
 
static void CMPSS_setRampDecValue (uint32_t base, uint16_t value)
 
static uint16_t CMPSS_getRampDecValue (uint32_t base)
 
static void CMPSS_setRampDelayValue (uint32_t base, uint16_t value)
 
static uint16_t CMPSS_getRampDelayValue (uint32_t base)
 
static void CMPSS_configBlanking (uint32_t base, uint16_t pwmBlankSrc)
 
static void CMPSS_enableBlanking (uint32_t base)
 
static void CMPSS_disableBlanking (uint32_t base)
 
static void CMPSS_enableDEmode (uint32_t base)
 
static void CMPSS_disableDEmode (uint32_t base)
 
static void CMPSS_selectDEACTIVESource (uint32_t base, uint8_t deactivesel)
 
static void CMPSS_configHighDACShadowValue2 (uint32_t base, uint16_t dacval)
 
static void CMPSS_configLowDACShadowValue2 (uint32_t base, uint16_t dacval)
 
static void CMPSS_setComparatorHighHysteresis (uint32_t base, uint16_t value)
 
static void CMPSS_setComparatorLowHysteresis (uint32_t base, uint16_t value)
 
void CMPSS_configFilterHigh (uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)
 
void CMPSS_configFilterLow (uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)
 
void CMPSS_configLatchOnPWMSYNC (uint32_t base, bool highEnable, bool lowEnable)
 
void CMPSS_configRamp (uint32_t base, uint16_t maxRampVal, uint16_t decrementVal, uint16_t delayVal, uint16_t pwmSyncSrc, bool useRampValShdw)
 

Macros

#define CMPSS_HICMP_CTL_M
 Header Files. More...
 
#define CMPSS_LOCMP_CTL_M
 
#define CMPSS_INSRC_DAC   (0x0000U)
 Input driven by internal DAC. More...
 
#define CMPSS_INSRC_PIN   (0x0001U)
 Input driven by external 'INL' pin. More...
 
#define CMPSS_INSRC_PIN_INL   (0x0000U)
 Input driven by external 'INL' pin. More...
 
#define CMPSS_INSRC_PIN_INH   (0x0001U)
 Input driven by external 'INH' pin. More...
 
#define CMPSS_INV_INVERTED   (0x0002U)
 Comparator output is inverted. More...
 
#define CMPSS_OR_ASYNC_OUT_W_FILT   (0x0040U)
 Asynch comparator output feeds into OR with latched digital filter output. More...
 
#define CMPSS_TRIPOUT_ASYNC_COMP   (0x0000U)
 Asynchronous comparator output drives CTRIPOUT. More...
 
#define CMPSS_TRIPOUT_SYNC_COMP   (0x0010U)
 Synchronous comparator output drives CTRIPOUT. More...
 
#define CMPSS_TRIPOUT_FILTER   (0x0020U)
 Filter output drives CTRIPOUT. More...
 
#define CMPSS_TRIPOUT_LATCH   (0x0030U)
 Latched filter output drives CTRIPOUT. More...
 
#define CMPSS_TRIP_ASYNC_COMP   (0x0000U)
 Asynchronous comparator output drives CTRIP. More...
 
#define CMPSS_TRIP_SYNC_COMP   (0x0004U)
 Synchronous comparator output drives CTRIP. More...
 
#define CMPSS_TRIP_FILTER   (0x0008U)
 Filter output drives CTRIP. More...
 
#define CMPSS_TRIP_LATCH   (0x000CU)
 Latched filter output drives CTRIP. More...
 
#define CMPSS_STS_HI_FILTOUT   (0x0001U)
 High digital filter output. More...
 
#define CMPSS_STS_HI_LATCHFILTOUT   (0x0002U)
 Latched value of high digital filter output. More...
 
#define CMPSS_STS_LO_FILTOUT   (0x0100U)
 Low digital filter output. More...
 
#define CMPSS_STS_LO_LATCHFILTOUT   (0x0200U)
 Latched value of low digital filter output. More...
 
#define CMPSS_DACVAL_SYSCLK   (0x0000U)
 DAC value updated from SYSCLK. More...
 
#define CMPSS_DACVAL_PWMSYNC   (0x0080U)
 DAC value updated from PWMSYNC. More...
 
#define CMPSS_DACREF_VDDA   (0x0000U)
 VDDA is the voltage reference. More...
 
#define CMPSS_DACREF_VDAC   (0x0020U)
 VDAC is the voltage reference. More...
 
#define CMPSS_DACSRC_SHDW   (0x0000U)
 DAC value updated from shadow register. More...
 
#define CMPSS_DACSRC_RAMP   (0x0001U)
 DAC value is updated from the ramp register. More...
 

Macro Definition Documentation

◆ CMPSS_HICMP_CTL_M

#define CMPSS_HICMP_CTL_M
Value:
(CSL_CMPSSA_COMPCTL_COMPHSOURCE_MASK | \
CSL_CMPSSA_COMPCTL_COMPHINV_MASK | \
CSL_CMPSSA_COMPCTL_ASYNCHEN_MASK)

Header Files.

◆ CMPSS_LOCMP_CTL_M

#define CMPSS_LOCMP_CTL_M
Value:
(CSL_CMPSSA_COMPCTL_COMPLSOURCE_MASK | \
CSL_CMPSSA_COMPCTL_COMPLINV_MASK | \
CSL_CMPSSA_COMPCTL_ASYNCLEN_MASK)

◆ CMPSS_INSRC_DAC

#define CMPSS_INSRC_DAC   (0x0000U)

Input driven by internal DAC.

◆ CMPSS_INSRC_PIN

#define CMPSS_INSRC_PIN   (0x0001U)

Input driven by external 'INL' pin.

◆ CMPSS_INSRC_PIN_INL

#define CMPSS_INSRC_PIN_INL   (0x0000U)

Input driven by external 'INL' pin.

◆ CMPSS_INSRC_PIN_INH

#define CMPSS_INSRC_PIN_INH   (0x0001U)

Input driven by external 'INH' pin.

◆ CMPSS_INV_INVERTED

#define CMPSS_INV_INVERTED   (0x0002U)

Comparator output is inverted.

◆ CMPSS_OR_ASYNC_OUT_W_FILT

#define CMPSS_OR_ASYNC_OUT_W_FILT   (0x0040U)

Asynch comparator output feeds into OR with latched digital filter output.

◆ CMPSS_TRIPOUT_ASYNC_COMP

#define CMPSS_TRIPOUT_ASYNC_COMP   (0x0000U)

Asynchronous comparator output drives CTRIPOUT.

◆ CMPSS_TRIPOUT_SYNC_COMP

#define CMPSS_TRIPOUT_SYNC_COMP   (0x0010U)

Synchronous comparator output drives CTRIPOUT.

◆ CMPSS_TRIPOUT_FILTER

#define CMPSS_TRIPOUT_FILTER   (0x0020U)

Filter output drives CTRIPOUT.

◆ CMPSS_TRIPOUT_LATCH

#define CMPSS_TRIPOUT_LATCH   (0x0030U)

Latched filter output drives CTRIPOUT.

◆ CMPSS_TRIP_ASYNC_COMP

#define CMPSS_TRIP_ASYNC_COMP   (0x0000U)

Asynchronous comparator output drives CTRIP.

◆ CMPSS_TRIP_SYNC_COMP

#define CMPSS_TRIP_SYNC_COMP   (0x0004U)

Synchronous comparator output drives CTRIP.

◆ CMPSS_TRIP_FILTER

#define CMPSS_TRIP_FILTER   (0x0008U)

Filter output drives CTRIP.

◆ CMPSS_TRIP_LATCH

#define CMPSS_TRIP_LATCH   (0x000CU)

Latched filter output drives CTRIP.

◆ CMPSS_STS_HI_FILTOUT

#define CMPSS_STS_HI_FILTOUT   (0x0001U)

High digital filter output.

◆ CMPSS_STS_HI_LATCHFILTOUT

#define CMPSS_STS_HI_LATCHFILTOUT   (0x0002U)

Latched value of high digital filter output.

◆ CMPSS_STS_LO_FILTOUT

#define CMPSS_STS_LO_FILTOUT   (0x0100U)

Low digital filter output.

◆ CMPSS_STS_LO_LATCHFILTOUT

#define CMPSS_STS_LO_LATCHFILTOUT   (0x0200U)

Latched value of low digital filter output.

◆ CMPSS_DACVAL_SYSCLK

#define CMPSS_DACVAL_SYSCLK   (0x0000U)

DAC value updated from SYSCLK.

◆ CMPSS_DACVAL_PWMSYNC

#define CMPSS_DACVAL_PWMSYNC   (0x0080U)

DAC value updated from PWMSYNC.

◆ CMPSS_DACREF_VDDA

#define CMPSS_DACREF_VDDA   (0x0000U)

VDDA is the voltage reference.

◆ CMPSS_DACREF_VDAC

#define CMPSS_DACREF_VDAC   (0x0020U)

VDAC is the voltage reference.

◆ CMPSS_DACSRC_SHDW

#define CMPSS_DACSRC_SHDW   (0x0000U)

DAC value updated from shadow register.

◆ CMPSS_DACSRC_RAMP

#define CMPSS_DACSRC_RAMP   (0x0001U)

DAC value is updated from the ramp register.

Function Documentation

◆ CMPSS_enableModule()

static void CMPSS_enableModule ( uint32_t  base)
inlinestatic

Enables the CMPSS module.

Parameters
baseis the base address of the CMPSS module.

This function enables the CMPSS module passed into the base parameter.

Returns
None.

◆ CMPSS_disableModule()

static void CMPSS_disableModule ( uint32_t  base)
inlinestatic

Disables the CMPSS module.

Parameters
baseis the base address of the CMPSS module.

This function disables the CMPSS module passed into the base parameter.

Returns
None.

◆ CMPSS_configHighComparator()

static void CMPSS_configHighComparator ( uint32_t  base,
uint16_t  config 
)
inlinestatic

Sets the configuration for the high comparator.

Parameters
baseis the base address of the CMPSS module.
configis the configuration of 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.

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 - External 'INL' pin. This is not applicable for CMPSSBx

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.

Returns
None.

◆ CMPSS_configLowComparator()

static void CMPSS_configLowComparator ( uint32_t  base,
uint16_t  config 
)
inlinestatic

Sets the configuration for the low comparator.

Parameters
baseis the base address of the CMPSS module.
configis the configuration of 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.

The CMPSS_INSRC_xxx term can take on the following values to specify the low comparator negative input source:

  • CMPSS_INSRC_PIN_INL - External 'INL' pin.
  • CMPSS_INSRC_PIN_INH - External 'INH' pin. This is not applicable for CMPSSBx

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.

Returns
None.

◆ CMPSS_configOutputsHigh()

static void CMPSS_configOutputsHigh ( uint32_t  base,
uint16_t  config 
)
inlinestatic

Sets the output signal configuration for the high comparator.

Parameters
baseis the base address of the CMPSS module.
configis the configuration of the high comparator output signals.

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.

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.
Returns
None.

◆ CMPSS_configOutputsLow()

static void CMPSS_configOutputsLow ( uint32_t  base,
uint16_t  config 
)
inlinestatic

Sets the output signal configuration for the low comparator.

Parameters
baseis the base address of the CMPSS module.
configis the configuration of the low comparator output signals.

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.

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.
Returns
None.

◆ CMPSS_getStatus()

static uint16_t CMPSS_getStatus ( uint32_t  base)
inlinestatic

Gets the current comparator status.

Parameters
baseis the base address of the comparator module.

This function returns the current status for the comparator, specifically the digital filter output and latched digital filter output.

Returns
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

◆ CMPSS_configDAC()

static void CMPSS_configDAC ( uint32_t  base,
uint16_t  config 
)
inlinestatic

Sets the configuration for the internal comparator DACs.

Parameters
baseis the base address of the CMPSS module.
configis the configuration of the internal DAC.

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.

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
The CMPSS_DACVAL_xxx and CMPSS_DACREF_xxx terms apply to both the high and low comparators. CMPSS_DACSRC_xxx will only affect the high comparator's internal DAC.
Returns
None.

◆ CMPSS_setDACValueHigh()

static void CMPSS_setDACValueHigh ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the value of the internal DAC of the high comparator.

Parameters
baseis the base address of the comparator module.
valueis the value actively driven by the DAC.

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().

Returns
None.

◆ CMPSS_setDACValueLow()

static void CMPSS_setDACValueLow ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the value of the internal DAC of the low comparator.

Parameters
baseis the base address of the comparator module.
valueis the value actively driven by the DAC.

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().

Returns
None.

◆ CMPSS_initFilterHigh()

static void CMPSS_initFilterHigh ( uint32_t  base)
inlinestatic

Initializes the digital filter of the high comparator.

Parameters
baseis the base address of the comparator module.

This function initializes all the samples in the high comparator digital filter to the filter input value.

Note
See CMPSS_configFilterHigh() for the proper initialization sequence to avoid glitches.
Returns
None.

◆ CMPSS_initFilterLow()

static void CMPSS_initFilterLow ( uint32_t  base)
inlinestatic

Initializes the digital filter of the low comparator.

Parameters
baseis the base address of the comparator module.

This function initializes all the samples in the low comparator digital filter to the filter input value.

Note
See CMPSS_configFilterLow() for the proper initialization sequence to avoid glitches.
Returns
None.

◆ CMPSS_getDACValueHigh()

static uint16_t CMPSS_getDACValueHigh ( uint32_t  base)
inlinestatic

Gets the value of the internal DAC of the high comparator.

Parameters
baseis the base address of the comparator module.

This function gets the value of the internal DAC of the high comparator. The value is read from the active register–not the shadow register to which CMPSS_setDACValueHigh() writes.

Returns
Returns the value driven by the internal DAC of the high comparator.

◆ CMPSS_getDACValueLow()

static uint16_t CMPSS_getDACValueLow ( uint32_t  base)
inlinestatic

Gets the value of the internal DAC of the low comparator.

Parameters
baseis the base address of the comparator module.

This function gets the value of the internal DAC of the low comparator. The value is read from the active register–not the shadow register to which CMPSS_setDACValueLow() writes.

Returns
Returns the value driven by the internal DAC of the low comparator.

◆ CMPSS_clearFilterLatchHigh()

static void CMPSS_clearFilterLatchHigh ( uint32_t  base)
inlinestatic

Causes a software reset of the high comparator digital filter output latch.

Parameters
baseis the base address of the comparator module.

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.

Returns
None.

◆ CMPSS_clearFilterLatchLow()

static void CMPSS_clearFilterLatchLow ( uint32_t  base)
inlinestatic

Causes a software reset of the low comparator digital filter output latch.

Parameters
baseis the base address of the comparator module.

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.

Returns
None.

◆ CMPSS_setMaxRampValue()

static void CMPSS_setMaxRampValue ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the ramp generator maximum reference value.

Parameters
baseis the base address of the comparator module.
valuethe ramp maximum reference value.

This function sets the ramp maximum reference value that will be loaded into the ramp generator.

Returns
None.

◆ CMPSS_getMaxRampValue()

static uint16_t CMPSS_getMaxRampValue ( uint32_t  base)
inlinestatic

Gets the ramp generator maximum reference value.

Parameters
baseis the base address of the comparator module.
Returns
Returns the latched ramp maximum reference value that will be loaded into the ramp generator.

◆ CMPSS_setRampDecValue()

static void CMPSS_setRampDecValue ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the ramp generator decrement value.

Parameters
baseis the base address of the comparator module.
valueis the ramp decrement value.

This function sets the value that is subtracted from the ramp value on every system clock cycle.

Returns
None.

◆ CMPSS_getRampDecValue()

static uint16_t CMPSS_getRampDecValue ( uint32_t  base)
inlinestatic

Gets the ramp generator decrement value.

Parameters
baseis the base address of the comparator module.
Returns
Returns the latched ramp decrement value that is subtracted from the ramp value on every system clock cycle.

◆ CMPSS_setRampDelayValue()

static void CMPSS_setRampDelayValue ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the ramp generator delay value.

Parameters
baseis the base address of the comparator module.
valueis the 13-bit ramp 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.

Returns
None.

◆ CMPSS_getRampDelayValue()

static uint16_t CMPSS_getRampDelayValue ( uint32_t  base)
inlinestatic

Gets the ramp generator delay value.

Parameters
baseis the base address of the comparator module.
Returns
Returns the latched ramp delay value that is subtracted from the ramp value on every system clock cycle.

◆ CMPSS_configBlanking()

static void CMPSS_configBlanking ( uint32_t  base,
uint16_t  pwmBlankSrc 
)
inlinestatic

Sets the ePWM module blanking signal that holds trip in reset.

Parameters
baseis the base address of the comparator module.
pwmBlankSrcis the number of the PWMBLANK source.

This function configures which PWMBLANK signal from the ePWM module will hold trip in reset when blanking is enabled.

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.

Returns
None.

◆ CMPSS_enableBlanking()

static void CMPSS_enableBlanking ( uint32_t  base)
inlinestatic

Enables an ePWM blanking signal to hold trip in reset.

Parameters
baseis the base address of the comparator module.

This function enables a selected ePWM blanking signal to hold trip in reset.

Returns
None.

◆ CMPSS_disableBlanking()

static void CMPSS_disableBlanking ( uint32_t  base)
inlinestatic

Disables an ePWM blanking signal from holding trip in reset.

Parameters
baseis the base address of the comparator module.

This function disables a selected ePWM blanking signal from holding trip in reset.

Returns
None.

◆ CMPSS_enableDEmode()

static void CMPSS_enableDEmode ( uint32_t  base)
inlinestatic

Enables the CMPSS diode emulation mode

Parameters
baseis the base address of the comparator module.

This function enables the CMPSS diode emulation mode

Returns
None.

◆ CMPSS_disableDEmode()

static void CMPSS_disableDEmode ( uint32_t  base)
inlinestatic

Disables the CMPSS diode emulation mode

Parameters
baseis the base address of the comparator module.

This function disables the CMPSS diode emulation mode

Returns
None.

◆ CMPSS_selectDEACTIVESource()

static void CMPSS_selectDEACTIVESource ( uint32_t  base,
uint8_t  deactivesel 
)
inlinestatic

Select the CMPSS diode emulation mode DEACTIVE source

Parameters
baseis the base address of the comparator module.
deactiveselis the DEACTIVE source select

This function selects the CMPSS diode emulation mode DEACTIVE source

Returns
None.

◆ CMPSS_configHighDACShadowValue2()

static void CMPSS_configHighDACShadowValue2 ( uint32_t  base,
uint16_t  dacval 
)
inlinestatic

Sets the shadow value 2 (used in DE mode) of the internal DAC of the high comparator.

Parameters
baseis the base address of the comparator module.
dacvalis the value actively driven by the DAC.

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.

Returns
None.

◆ CMPSS_configLowDACShadowValue2()

static void CMPSS_configLowDACShadowValue2 ( uint32_t  base,
uint16_t  dacval 
)
inlinestatic

Sets the shadow value 2 (used in DE mode) of the internal DAC of the low comparator.

Parameters
baseis the base address of the comparator module.
dacvalis the value actively driven by the DAC.

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.

Returns
None.

◆ CMPSS_setComparatorHighHysteresis()

static void CMPSS_setComparatorHighHysteresis ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the hysteresis value of the high comparator.

Parameters
baseis the base address of the comparator module.
valueis the hysteresis value. bit[15:4]: unused. bit[3] : reserved. bit[2] : control which comparator output value the hysteresis is applied to 0 comparator hysteresis is applied when the comparator output is 1'b1 1 comparator hysteresis is applied when the comparator output is 1'b0 bit[1:0] :
00 ==> 0 LSB ==> 0mV, 01 ==> 17.5 LSB ==> 14mV, 10 ==> 35 LSB ==> 28mV, 11 ==> 52.5 LSB ==> 42mV.

This function sets the hysteresis value of the high comparator.

Returns
None.

◆ CMPSS_setComparatorLowHysteresis()

static void CMPSS_setComparatorLowHysteresis ( uint32_t  base,
uint16_t  value 
)
inlinestatic

Sets the hysteresis value of the low comparator.

Parameters
baseis the base address of the comparator module.
valueis the hysteresis value. bit[15:4]: unused. bit[3] : reserved. bit[2] : control which comparator output value the hysteresis is applied to 0 comparator hysteresis is applied when the comparator output is 1'b1 1 comparator hysteresis is applied when the comparator output is 1'b0 bit[1:0] :
00 ==> 0 LSB ==> 0mV, 01 ==> 17.5 LSB ==> 14mV, 10 ==> 35 LSB ==> 28mV, 11 ==> 52.5 LSB ==> 42mV.

This function sets the hysteresis value of the low comparator.

Returns
None.

◆ CMPSS_configFilterHigh()

void CMPSS_configFilterHigh ( uint32_t  base,
uint16_t  samplePrescale,
uint16_t  sampleWindow,
uint16_t  threshold 
)

Configures the digital filter of the high comparator.

Parameters
baseis the base address of the comparator module.
samplePrescaleis the number of system clock cycles between samples.
sampleWindowis the number of FIFO samples to monitor.
thresholdis the majority threshold of samples to change state.

This function configures the operation of the digital filter of the high comparator.

The samplePrescale parameter specifies the number of system clock cycles between samples. It is a 10-bit value so a number higher than 1023 should not be passed as this parameter. The prescale used by digital filter is 1 more than samplePrescale value. So, the input provided should be 1 less than the expected prescale.

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 32 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:

  1. Configure and enable the comparator using CMPSS_configHighComparator() and CMPSS_enableModule()
  2. Configure the digital filter using CMPSS_configFilterHigh()
  3. Initialize the sample values using CMPSS_initFilterHigh()
  4. Configure the module output signals CTRIP and CTRIPOUT using CMPSS_configOutputsHigh()
Returns
None.

◆ CMPSS_configFilterLow()

void CMPSS_configFilterLow ( uint32_t  base,
uint16_t  samplePrescale,
uint16_t  sampleWindow,
uint16_t  threshold 
)

Configures the digital filter of the low comparator.

Parameters
baseis the base address of the comparator module.
samplePrescaleis the number of system clock cycles between samples.
sampleWindowis the number of FIFO samples to monitor.
thresholdis the majority threshold of samples to change state.

This function configures the operation of the digital filter of the low comparator.

The samplePrescale parameter specifies the number of system clock cycles between samples. It is a 10-bit value so a number higher than 1023 should not be passed as this parameter. The prescale used by digital filter is 1 more than samplePrescale value. So, the input provided should be 1 less than the expected prescale.

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 32 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:

  1. Configure and enable the comparator using CMPSS_configLowComparator() and CMPSS_enableModule()
  2. Configure the digital filter using CMPSS_configFilterLow()
  3. Initialize the sample values using CMPSS_initFilterLow()
  4. Configure the module output signals CTRIP and CTRIPOUT using CMPSS_configOutputsLow()
Returns
None.

◆ CMPSS_configLatchOnPWMSYNC()

void CMPSS_configLatchOnPWMSYNC ( uint32_t  base,
bool  highEnable,
bool  lowEnable 
)

Configures whether or not the digital filter latches are reset by PWMSYNC

Parameters
baseis the base address of the comparator module.
highEnableindicates filter latch settings in the high comparator.
lowEnableindicates filter latch settings in the low comparator.

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.

Returns
None.

◆ CMPSS_configRamp()

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.

Parameters
baseis the base address of the comparator module.
maxRampValis the ramp maximum reference value.
decrementValvalue is the ramp decrement value.
delayValis the ramp delay value.
pwmSyncSrcis the number of the PWMSYNC source.
useRampValShdwindicates if the max ramp shadow should be used.

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.

These three values may be be set individually using the CMPSS_setMaxRampValue(), CMPSS_setRampDecValue(), and CMPSS_setRampDelayValue() APIs.

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 2 into pwmSyncSrc will select PWMSYNC2.

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.

Returns
None.