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.

CCS/TMS320F280049: connect a CMPSS7 to a GPIO using OUTPUTxBAR peripheral

Part Number: TMS320F280049

Tool/software: Code Composer Studio

Dear TI hello,

I am using a CMPSS7 to  detect a threshold with a sinusoidal signal,

I connect the GPIO24 to the  outputxbar1.  threshold for the CMPSS High and Low is  0x800 and 0xc00,

Is there any thing wrong with my code,

In the Registers window in CSS i can see the high and low comparator status are moving, but the GPIO24, is always 1,

Thanks in advance for help,

S.Tarik,

            EALLOW;

            /* Configuration analog inputs VPH1 */
            /* CMPSS input MUX for CMP7 */
            /* A10 sur CMP7HP and CMP7LP */
            AnalogSubsysRegs.CMPHPMXSEL.bit.CMP7HPMXSEL = 0X00;
            AnalogSubsysRegs.CMPLPMXSEL.bit.CMP7LPMXSEL = 0X00;

            EDIS;

    EALLOW;

    /* Enable CMPSS */
    Cmpss7Regs.COMPCTL.bit.COMPDACE = 1;

    /* High comparator input source is DAC */
    Cmpss7Regs.COMPCTL.bit.COMPHSOURCE = 0X00;
    Cmpss7Regs.COMPCTL.bit.COMPLSOURCE = 0X00;

    /* High comparator output not inverted */
    Cmpss7Regs.COMPCTL.bit.COMPHINV = 0x00;

    /* Low comparator output inverted */
    Cmpss7Regs.COMPCTL.bit.COMPLINV = 0x01;

    /* High comparator asynchronous path NOT enableD */
    Cmpss7Regs.COMPCTL.bit.ASYNCHEN = 0x00; // 0x01;

    /* Use VDDA as the reference for DAC */
    Cmpss7Regs.COMPDACCTL.bit.SELREF = REFERENCE_VDDA;

    /* Set DAC to DACH TEST*/
    Cmpss7Regs.DACHVALS.bit.DACVAL = p_uDacHigh;

    /* Set DAC to DACL for Test*/
    Cmpss7Regs.DACLVALS.bit.DACVAL = p_uDacLow;

    /* Configure CTRIPOUTH output pin */
    /* Configure OUTPUTXBAR1 to be CMPSS7.CTRIPOUTH */
    OutputXbarRegs.OUTPUT1MUX0TO15CFG.bit.MUX12 = 0x00;

    /*Enable OUTPUTXBAR1 Mux for Output*/
    OutputXbarRegs.OUTPUT1MUXENABLE.bit.MUX12 = 0X01;

    EDIS;

  • I didn't see any issues with the CMPSS and XBAR configurations you shared. You didn't share your GpioCtrlRegs configuration for GPIO24. Can you double check that it's set to OUTPUTXBAR1 correctly?

    Whitney

  •     GPIO_SetupPinMux(24, GPIO_MUX_CPU1, 1);
        GPIO_SetupPinOptions(24, GPIO_OUTPUT, GPIO_ASYNC);

  • Okay, that also looks fine. What board are you using? If you're using a controlCARD, be aware that GPIO24 is connected to two different pins with a switch to select between them. Please check both pins and the switch setting on your board.

    If that doesn't help, try importing the cmpss_ex2_digital_filter example from the F28004x driverlib examples. See if it works as is and then see if it works after you change XBAR_OUTPUT3 -> XBAR_OUTPUT1 and GPIO_14_OUTPUTXBAR3 -> GPIO_24_OUTPUTXBAR1. If it does work, look at the configuration in the related registers and see how it matches with that of your own application.

    Whitney