Due to the U.S. Thanksgiving holiday, please expect delayed responses during the week of 11/22.

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.

MSP430F6745: I have a question about how to use COMP_B.

Expert 2780 points
Part Number: MSP430F6745


Currently, Custuomer use COMP_B of MSP430F6745 to monitor multiple channels.
<It is said that it is just before mass production.>

There was a problem with COMP_B, investigated, set COMP_B ON, no delay time was set up.
The problem was solved by setting delay time to measurement.

I believe that this problem is due to the unstable reference power of COMP_B.
Is that recognition recognized?

About this delay time, how much should be set?
(Should it be delayed time by tSETTLE in the data sheet?)

Increasing the ambient temperature of the device will cause problems with more devices.
How about setting the delay time in the form including the temperature?


  • Hi da,
    You'll need to account for the turn on time and the settle time of the REF, so 275 uS. This should account for temperature differences, but please let me know if it does not.
  • Thank you for your reply.

    > the turn on time and the settle time of the REF, so 275 uS.

    How did you calculate this number?
    Is this time difference between -40 and 85 in the device temperature range?

    > temperature differences

    The MSP 430 is incorporated into the equipment to be set outdoors.
    The temperature of the equipment is affected by outside air temperature, direct sunlight and others.
    I think that there is no big change in microseconds
    It may change by about 20 degrees in one day.


  • da,
    Page 91 of the data sheet says that T_ON is 200 us and T_settle is 75 us. This should be good for the temperature range of the device.
  • Thanks Cameron,

    But Both parameters are not maximum values.
    If the device is a bad device, the delay time of COMP_B can not be kept.

    Customers are using the COMP_B with the following code.
    We want to know the optimal value of the delay time of the red letter part.

    CBCTL0 = 0x8000;
    CBCTL1 = 0x06c4;
    CBCTL2 = 0x20c0;
    CBCTL3 = 0x0001;
    CBINT = 0x0000;

    // COMP_B ON
    CBCTL1 | = CBON;

    us_wait (100); // Add COMP_B charge 100us wait

    rd_cbout = (CBCTL 1 & CBOUT);
    us_wait (20);
    rd_cbout &= (CBCTL 1 & CBOUT);
    us_wait (20);
    rd_cbout &= (CBCTL 1 & CBOUT);

    // COMP_B OFF
    CBCTL1 &= ~ CBON;


  • The 275 us should be good for "bad" devices. This was tested over many different devices and found to be the ideal time, hence why it is listed in the data sheet. Try 275 and let me know if that does not work. 

  • A detailed explanation request came from the customer.

    Why is adding Ton (200us) to this delay time (275us)?

    Is the time to stabilize the voltage 275 μs even by switching the internal reference voltage (1.5 V / 2.0 V / 2.5 V) of COMP_B?

    I confirmed the data sheet again and found the following description.

    (7) The condition is that the error in a conversion started after tREFON is less than ±0.5 LSB.

    Under the condition that the error is ± 0.5 LSB or less,
    The delay time of power supply on of COMP_B, in 75us, not 275us?

  • Q1. T_On needs to be accounted for when the REF is turned on from off state. If the REF is already on, then this does not need to be added.

    Q2. If the ref is already on, then only the 75us needs to be added when switching voltages.
  • Hi Cameron-san,
    I'm Da's colleague. Thank you for your kind support.

    His expression might be a little bad. I will ask this to you again.
    Our customer would like to know the waiting time after COMP_B =0 to COMP_B=1.

    like the below:
    CBCTL0 = 0x8000;
    CBCTL1 = 0x06c4; //=>CBPWRMD = 10
    CBCTL2 = 0x20c0;
    CBCTL3 = 0x0001;
    CBINT = 0x0000;

    // COMP_B ON
    CBCTL1 | = CBON;
    us_wait (???); //  How much longer should we wait???

    rd_cbout = (CBCTL 1 & CBOUT);
    us_wait (20);
    rd_cbout &= (CBCTL 1 & CBOUT);
    us_wait (20);
    rd_cbout &= (CBCTL 1 & CBOUT);

    We believe the time is "tEN_CMP"(max 50us). So, after CBON=0 to CBON=1, it needs to wait "50us".
    In conclusion,
    When reference is enabled(REFON = 0 to 1), it needs to wait 75us(tSETTLE).
    When reference is selected(SD24REFS = 0 to 1),it needs to wait 200us(tON).
    When comparator is ON(CBON= 0 to 1),it needs to wait 50us(tON).

    Is my understanding correct?
    Also, if it doesn't wait for 50us after CBON=0to1, what will happen? 

    Best Regards,
    Takahiro Ogo

  • Takahiro-san,

    I apologize for my misunderstandings. You are correct, SD needs the 200uS, REF on needs 75uS.

    You still need to wait the 75 uS IF this is the first time you turn on the REF via the CompB.

    If the REF has already been on, then you should only need the 50uS.

    Note that our COMPB example code all uses 75uS.

    #include <msp430.h>
    void main(void)
      WDTCTL = WDTPW + WDTHOLD;     // Stop WDT
      P1DIR |= BIT0;                // P1.0/LED output direction
    // Setup ComparatorB                           
      CBCTL0 |= CBIPEN + CBIPSEL_0; // Enable V+, input channel CB0            
      CBCTL1 |= CBPWRMD_1;          // normal power mode         
      CBCTL2 |= CBRSEL;             // VREF is applied to -terminal 
      CBCTL2 |= CBRS_3+CBREFL_1;    // R-ladder off; bandgap ref voltage (1.2V)
                                    // supplied ref amplifier to get Vcref=1.5V (CBREFL_2)            
      CBCTL3 |= BIT0;               // Input Buffer Disable @P6.0/CB0    
      __delay_cycles(75);           // delay for the reference to settle
      CBINT &= ~(CBIFG + CBIIFG);   // Clear any errant interrupts  
      CBINT  |= CBIE;               // Enable CompB Interrupt on rising edge of CBIFG (CBIES=0)
      CBCTL1 |= CBON;               // Turn On ComparatorB    
      __bis_SR_register(LPM4_bits+GIE);         // Enter LPM4 with inetrrupts enabled
      __no_operation();                         // For debug 

  • The bottom line is: I would wait at least 75uS. Ideally 275uS from when the COMP B is initialized.
  • Hi Cameron-san,
    Thank you for your reply. OK, I'm catching on.
    I have last one question.

    (if the REF has already been on)
    The datasheet is saying the wait time is 50us. 
    But you and example code are saying 75us.
    Which is correct? Does it mean 75us is safer than 50us. As the device specification, is it ok with 50us?

    I apologize for keep asking but we need a clear answer. Because this product already been released to the market.
    So, clear explanation and the waiting time are required by our customer for that.

    Best Regards,
    Takahiro Ogo
  • Takahiro-san
    My sincere apologies, all this time I was looking at an invalid datasheet parameter, T_on, which is only for the SDHS. My mistake.

    If COMP_B or REF has been on and the voltage level not changed then 50uS should be ok.

    If it's the first time turning on or changing the voltage then 75 uS is safer.

  • Hi Cameron-san
    Thank you for your kind support.

    I understood,
    If COMP_B or REF has been on and the voltage level not changed, then the waiting time is 50us(tEN_CMP).

    Sorry, I am a little confused. Please let me ask an additional question.
    If COMP_B or REF has been on and the reference voltage level changed, is the waiting time 75us(tSETTLE)?
    My customer is changing CB Reference voltage level using CBREFL bit. Is it ok with tSETTLE?

    Best Regards,
    Takahiro Ogo

  • Takahiro-san,

    That is correct. tSettle is for the REF voltage to settle to a new level. 

  • Hi Cameron-san,

    Thank you for your kind support.
    Now, da is talking about this with our customer. So, he will close this thread after that.

    I appreciate your help.
    Takahiro Ogo