CMPSS外设

  1. static inline void CMPSS_enableModule(uint32_t base)
  2. function function: Enable the CMPSS module according to the parameters passed in.
  3. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  4. static inline void CMPSS_disableModule(uint32_t base)

  5. function function: close the CMPSS module according to the input parameters.
  6. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  7. static inline void CMPSS_configHighComparator(uint32_t base, uint16_t config)

  8. function: Configure the high comparator in the CMPSS module.
  9. 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 DAC CMPSS_INSRC_PIN : select high comparator negative input source is external pin (2) Parameter 2: Whether the comparator output needs to be inverted CMPSS_INV_INVERTED : Comparator output is inverted; (3) Parameter 3: the CMPSS_OR_ASYNC_OUT_W_FILT asynchronous comparator outputs to the or gate along with the latched digital filter.
    • return parameters:
      • none
  10. static inline void CMPSS_configLowComparator(uint32_t base, uint16_t config)

  11. function: configure the low comparator in the CMPSS module.
  12. 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 DAC CMPSS_INSRC_PIN : select low comparator negative input source is external pin (2) Parameter 2: Whether the comparator output needs to be inverted CMPSS_INV_INVERTED : Comparator output is inverted; (3) Parameter 3: the CMPSS_OR_ASYNC_OUT_W_FILT asynchronous comparator outputs to the or gate along with the latched digital filter.
    • return parameters:
      • none
  13. static inline void CMPSS_configOutputsHigh(uint32_t base, uint16_t config)

  14. function: Set the output signal configuration of the high comparator, including CTRIP and CTRIPOUT.
  15. 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 selection CMPSS_TRIPOUT_ASYNC_COMP : Asynchronous comparator output is driven to CTRIPOUTH CMPSS_TRIPOUT_SYNC_COMP : Synchronous comparator output is driven to CTRIPOUTH 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 comparator CTRIP source selection CMPSS_TRIP_ASYNC_COMP : Asynchronous comparator output is driven to CTRIPH CMPSS_TRIP_SYNC_COMP : Synchronous comparator output is driven to CTRIPH CMPSS_TRIP_FILTER CTRIPH CMPSS_TRIP_LATCH CTRIPH : Digital filter output is drive to: Digital filter latch output is drive to
    • return parameters:
      • none
  16. static inline void CMPSS_configOutputsLow(uint32_t base, uint16_t config)

  17. function: Set the output signal configuration of the low comparator, including CTRIP and CTRIPOUT.
  18. 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 selection CMPSS_TRIPOUT_ASYNC_COMP : Asynchronous comparator output driven to CTRIPOUTL CMPSS _ TRIPOUT _ SYNC _ COMPCTRIPOUTL :同步比较器输出驱动到 CMPSS_TRIPOUT_FILTER : Digital filter output driven to CTRIPOUTL CMPSS _ TRIPOUT _ LA TCH :数字滤波器锁存输出驱动到 CTRIPOUTL (2) Parameter 2: low comparator CTRIP source selection CMPSS_TRIP_ASYNC_COMP : Asynchronous comparator output driven to CTRIPL CMPSS _ TRIP _ SYNC _ COMPCTRIPL :同步比较器输出驱动到 CMPSS_TRIP_FILTER : Digital filter output driven to CTRIPL CMPSS _ TRIP _ LATCH0HTML0 UNK5CTRIPL
    • return parameters:
      • none
  19. static inline uint16_t CMPSS_getStatus(uint32_t base)

  20. function: Get the current state of the comparator including the digital filter output and the latched digital filter output.
  21. 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 output CMPSS_STS_HI_LATCHFILTOUT : high digital filter latch value CMPSS_STS_LO_FILTOUT : low digital filter output CMPSS_STS_LO_LATCHFILTOUT : low digital filter latch value
  22. static inline void CMPSS_configDAC(uint32_t base, uint16_t config)

  23. function: Sets the internal DAC of the comparator.
  24. 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 updated CMPSS_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 reference CMPSS_DACREF_VDAC for DAC: VDAC as voltage reference for DAC (3) Parameter 3: DAC source selection CMPSS_DACSRC_SHDW : DAC’s value is updated CMPSS_DACSRC_RAMP from its shadow register: DAC’s value is updated from the ramp generator
    • return parameters:
      • none
  25. static inline void CMPSS_setDACValueHigh(uint32_t base, uint16_t value)

  26. function: Sets the DAC shadow value of the high comparator.
  27. 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
  28. static inline void CMPSS_setDACValueLow(uint32_t base, uint16_t value)

  29. function: Sets the DAC shadow value of the low comparator.
  30. 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
  31. static inline void CMPSS_initFilterHigh(uint32_t base)

  32. function: Initialize the digital filter of the high comparator.
  33. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  34. static inline void CMPSS_initFilterLow(uint32_t base)

  35. function: Initializes the digital filter of the low comparator.
  36. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  37. static inline uint16_t CMPSS_getDACValueHigh(uint32_t base)

  38. function: Get the internal DAC value of the high comparator.
  39. 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)
  40. static inline uint16_t CMPSS_getDACValueLow(uint32_t base)

  41. function: Get the internal DAC value of the low comparator.
  42. 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)
  43. static inline void CMPSS_clearFilterLatchHigh(uint32_t base)

  44. function function: Calling this function causes a software reset of the high comparator digital filter output latch.
  45. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  46. static inline void CMPSS_clearFilterLatchLow(uint32_t base)

  47. function function: Calling this function causes a software reset of the low comparator digital filter output latch.
  48. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  49. static inline void CMPSS_setMaxRampValue(uint32_t base, uint16_t value)

  50. function function: set the maximum reference value of ramp generator.
  51. 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
  52. static inline uint16_t CMPSS_getMaxRampValue(uint32_t base)

  53. function function: get the maximum reference value of ramp generator.
  54. 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.
  55. static inline void CMPSS_setRampDecValue(uint32_t base, uint16_t value)

  56. function function: set the decrement value of the ramp generator.
  57. 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
  58. static inline uint16_t CMPSS_getRampDecValue(uint32_t base)

  59. function function: get the decrement value of the ramp generator.
  60. 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.
  61. static inline void CMPSS_setRampDelayValue(uint32_t base, uint16_t value)

  62. function function: Set the delay value of the ramp generator.
  63. parameter description:

    • input parameters:
      • base: base address of CMPSS module
      • value: set delay value, 13 bits.
    • return parameters:
      • none
  64. static inline uint16_t CMPSS_getRampDelayValue(uint32_t base)

  65. function function: Obtain the delay value of ramp generator.
  66. 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.
  67. static inline void CMPSS_setHysteresis(uint32_t base, uint16_t value)

  68. function: set the hysteresis value of CMPSS.
  69. 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
  70. static inline void CMPSS_enableLatchResetOnPWMSYNCHigh(uint32_t base)

  71. function: Enable the EPWMSYNCPER signal to reset the latched output of the digital filter of the high comparator.
  72. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  73. static inline void CMPSS_disableLatchResetOnPWMSYNCHigh(uint32_t base)

  74. function: Turns off the EPWMSYNCPER signal to reset the latched output of the digital filter of the high comparator.
  75. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  76. static inline void CMPSS_enableLatchResetOnPWMSYNCLow(uint32_t base)

  77. function: Enable the EPWMSYNCPER signal to reset the latched output of the digital filter of the low comparator.
  78. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  79. static inline void CMPSS_disableLatchResetOnPWMSYNCLow(uint32_t base)

  80. function: Turns off the EPWMSYNCPER signal to reset the latched output of the digital filter of the low comparator.
  81. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  82. static inline void CMPSS_configBlanking(uint32_t base, uint16_t pwmBlankSrc)

  83. function: Configures which PWMBLANK signal from the ePWM module will remain in the trip reset state when epwmblank is enabled.
  84. 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
  85. static inline void CMPSS_enableBlanking(uint32_t base)

  86. function Function: This function enables the selected ePWMBLANK signal to hold the trip reset state.
  87. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  88. static inline void CMPSS_disableBlanking(uint32_t base)

  89. function Function: This function turns off the selected ePWMBLANK signal to maintain the trip reset state.
  90. parameter description:

    • input parameters:
      • base: base address of CMPSS module
    • return parameters:
      • none
  91. void CMPSS_configFilterHigh(uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold);

  92. function: Configure the digital filter of the high comparator.
  93. 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
  94. void CMPSS_configFilterLow(uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold)

  95. function: Configure the digital filter of the low comparator.
  96. 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
  97. void CMPSS_configLatchOnPWMSYNC(uint32_t base, bool highEnable, bool lowEnable)

  98. function: Configure whether the EPWMSYNCPER signal can reset the latched output of the digital filter of the high-low comparator.
  99. 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
  100. void CMPSS_configRamp(uint32_t base, uint16_t maxRampVal, uint16_t decrementVal, uint16_t delayVal, uint16_t pwmSyncSrc, bool useRampValShdw)

  101. function function: configure ramp generator
  102. 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
  103. void CMPSS_setDACHPrescale(uint32_t base, uint16_t value);

  104. function to set the high comparator DAC sample clock prescale factor.
  105. 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
  106. void CMPSS_setDACLPrescale(uint32_t base, uint16_t value);

  107. function to set the low comparator DAC sample clock prescale factor.
  108. 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