This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049C: Comparator Ramp Generator not working

Part Number: TMS320F280049C

Hello,

I have the DACB generating a 50Hz sinewave between 0.5V and 2.5V.

I then have CMPSS3 High set up with its non-inverting input connected to the DACB output.

If I set the inverting input to the DAC SHDW (fixed value), the comparator works well and triggers when the DACB crosses the fixed value.

However, when I set the inverting input to use the RAMP, the comparator output never triggers and is High.

I therefore think that I am not setting the ramp correctly and would like your help to solve this.

This is my CMPSS3 init function (where I uncomment NORAMP to use the fixed DAC value):

void initCMPSS3(void)
{   SysCtl_resetPeripheral(SYSCTL_PERIPH_RES_CMPSS3);
    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CMPSS3);
    CMPSS_enableModule(CMPSS3_BASE);
    CMPSS_configHighComparator(CMPSS3_BASE, CMPSS_INSRC_DAC);
//#define NORAMP
#ifdef NORAMP
    CMPSS_configDAC(CMPSS3_BASE, CMPSS_DACREF_VDDA | CMPSS_DACVAL_SYSCLK | CMPSS_DACSRC_SHDW);
    CMPSS_setDACValueHigh(CMPSS3_BASE, 2000);
#else
    CMPSS_configDAC(CMPSS3_BASE, CMPSS_DACREF_VDDA | CMPSS_DACVAL_PWMSYNC | CMPSS_DACSRC_RAMP);
    CMPSS_configRamp(CMPSS3_BASE, 3000, 10, 1, 2, true);
#endif
    CMPSS_configOutputsHigh(CMPSS3_BASE, CMPSS_TRIP_ASYNC_COMP | CMPSS_TRIPOUT_ASYNC_COMP);
    CMPSS_setHysteresis(CMPSS3_BASE,4); //max hysteresis
    XBAR_setOutputMuxConfig(XBAR_OUTPUT3, XBAR_OUT_MUX04_CMPSS3_CTRIPOUTH);
    XBAR_enableOutputMux(XBAR_OUTPUT3, XBAR_MUX04); //GPIO26->J6.74
    ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_3, 2); //AnalogSubsysRegs.CMPHPMXSEL.bit.CMP3HPMXSEL = 2; //PGA3_IN
}