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.

TMS320F280049 Analog subsystem Choice for CMPSS analog input

Other Parts Discussed in Thread: C2000WARE

Hello,

I m trying to use a CMPSS on the 280049.

We use the TI code as example then modified to have our own configuration.

We would like to use CMP2 SS  with pin COMPH connected to C2 and pin COMPL connected to A4.

Is it possible?

Do we have to connect the same pin to COMPH and COMPL?

We dont understand the differnce between HPMXSEL = 3 HNMXSEL = 0 LPMXSEL = 3 LNMXSEL = 0 for A5 and

HPMXSEL = 0 LPMXSEL = 0 for A4. (page 1267 of sprui33.pdf)

Could you please clarify what value to use ?

We d like to trigger on outputXBAR 3 for COMPH higher than DACHVAL = 3000. Actually we connect input to 3.3 V   

This is our code...

EALLOW;

 

    //

    //Enable CMPSS

    //

    Cmpss1Regs.COMPCTL.bit.COMPDACE = 1;

 

    /* CMPSS input MUX for CMP2 */

Cmp2H on C2

    AnalogSubsysRegs.CMPHPMXSEL.bit.CMP2HPMXSEL = 0X01;

CMP2L on A4   

AnalogSubsysRegs.CMPLPMXSEL.bit.CMP2LPMXSEL = 0X00;

 

    AnalogSubsysRegs.CMPHNMXSEL.bit.CMP2HNMXSEL = 0X00;

    AnalogSubsysRegs.CMPLNMXSEL.bit.CMP2LNMXSEL = 0X00;

 

    /* High comparator input source is DAC*/

    Cmpss2Regs.COMPCTL.bit.COMPHSOURCE = 0X00;

    Cmpss2Regs.COMPCTL.bit.COMPLSOURCE = 0X00;

 

    /* High comparator output not inverted */

    Cmpss2Regs.COMPCTL.bit.COMPHINV = 0x00;

    Cmpss2Regs.COMPCTL.bit.COMPLINV = 0x00;

 

    /* High comparator asynchronous path enable*/

    Cmpss2Regs.COMPCTL.bit.ASYNCHEN = 0x01;

 

    /* High comparator latch EPWMSYNCO not clear */

    Cmpss2Regs.COMPSTSCLR.bit.HSYNCCLREN = 0X00;

 

    /* High comparator latch software */

    Cmpss2Regs.COMPSTSCLR.bit.HLATCHCLR = 0X00;

 

    /* Use VDDA (3.3V) as the reference for DAC */

    Cmpss2Regs.COMPDACCTL.bit.SELREF = REFERENCE_VDDA;

 

    Cmpss2Regs.COMPDACCTL.bit.SWLOADSEL =0x00;

    Cmpss2Regs.COMPDACCTL.bit.DACSOURCE = 0x00;

 

    /* Set DAC to 3000 for high reference*/

    Cmpss2Regs.DACHVALS.bit.DACVAL = 3000;

 

    /* Set DAC to 1000 for low reference*/

    Cmpss2Regs.DACLVALS.bit.DACVAL = 1000;

 

    /* Configure CTRIPOUT path*/

    /* Asynch output feeds CTRIPH and CTRIPOUTH */

    Cmpss2Regs.COMPCTL.bit.CTRIPHSEL = CTRIP_ASYNCH;

    Cmpss2Regs.COMPCTL.bit.CTRIPOUTHSEL = CTRIP_ASYNCH;

 

 

    /* Configure CTRIPOUTH output pin */

    /* Configure OUTPUTXBAR3 to be CMP2 CTRIPOUTH */

    OutputXbarRegs.OUTPUT3MUX0TO15CFG.bit.MUX2 = 0;

 

    /*Enable OUTPUTXBAR3 Mux for Output*/

    OutputXbarRegs.OUTPUT3MUXENABLE.bit.MUX2 = 1;

   

    EDIS;

Thank you very much!

PA .

  • Hi PA,

    Pin C2 cannot be connected to CMPSS2 internally because pin C2 is in group 3 and CMPSS2 is in group 2. Only pins and signals within a group can be connected internally. Please look at the "Analog Pins and Internal Connections" table. For your question on what HPMXSEL, LPMXSEL... mean, please look at the figure "Analog Group Connections" diagram in the TRM. Basically what it means is, there are 2 comparators per CMPSS, every comparator has 2 inputs (pos and neg), each of the positive and negative inputs has multiple mux options. It's not as complicated as it sounds, if you look at the diagram i mentioned, it will make sense.
  • Thank you Franck .
    Sorry.. it was a mistake in my proposal...
    We attempt to connect pin C1 ... And it is exactly the table you ask me to look at, that raises all my question...
    Let s say i want to connect C1 to CMPH and A4 to CMPL.. Is it possible?

    Our code with the right comments:

    /* CMPSS input MUX for CMP2 */

    CMP2H on C1

    AnalogSubsysRegs.CMPHPMXSEL.bit.CMP2HPMXSEL = 0X01;

    CMP2L on A4

    AnalogSubsysRegs.CMPLPMXSEL.bit.CMP2LPMXSEL = 0X00;

    Or should i connect both CMP2H and CMP2L to C1? Or to A4?

    Regards, PA.
  • PA,

    No problem. Yes, both C1 and A4 can be connected to CMPSS2. However, as i mentioned in the prior post, each CMPSS has 2 comparators (COMPH and COMPL) and each of COMPH/COMPL has 2 inputs (Pos and Neg). Looks like you want to use both high and low comparators so in your case, you end up with something like this:

    1. COMP2HP (Comparator 2 High Positive Input).
    2. COMP2HN (Comparator 2 High Negative Input).
    3. COMP2LP (Comparator 2 Low Positive Input).
    4. COMP2LN (Comparator 2 Low Negative Input).

    Which of these 4 do you want to connect to C1 and which do you want to connect to A4?
  • Hello Franck,

    The setting we d like is:

    1. COMP2HP (Comparator 2 High Positive Input) => C1
    2. COMP2HN (Comparator 2 High Negative Input)=> DAC set to 3000
    3. COMP2LP (Comparator 2 Low Positive Input) => A4
    4. COMP2LN (Comparator 2 Low Negative Input).=> DAC set to 1000

    I provided you the code in the first message...
    I think we are not so far from goood... ;)
  • PA,

    Yes, in that case, the code you supplied should work. Let us know how it turns out.
  • Hello Franck,

    Thank you for the good news...

    Unfortunately, we have very poor result, we never see COMPSTS flags (H or L ) raised.

    Our plan was to set input CMP2_HP  to VDD and CMP2_LP  to 0 to trigger the outputXBAR3, but it doesnt seem as good as we thought.

    Is the VDD idea not good becasue it s too extreme?

    Should we use a sinus / square / sawtooth signal?

    Do we have a negative interraction on the 2 signal (VDD/0) that prevents the module to react correctly?

    Thank you,

    PA.

      

  • Thank you!

    Problem solved)! :)

    Little coding error... and some more trust in our choices thanks to your support...

    Now i m going to connect the CTRIPL and CTRIPH to 2 EPWM events thank to the EPWM X bar module...

    I didnt find any examples for this connection... any tips to perform it adequatly please?

    If i am correct, you advised in another support subject that it could be connected to an ECAP to COUNT how long it is triggered...  also to be performed via EPWM XBAR? 

    Thank you for the support! Super effective!:

    PA.

  • Hi PA,

    I'm glad you were able to resolve the issue! Seems you had a question in the last post that you marked resolved so I'm assuming you figured it out. However, if you still need help on that, we have CMPSS examples in C2000Ware: "cmpss_ex1_asynch" and "cmpss_ex1_digital_filter" which should help you on how to configure the CMPSS <-> EPWM trips.