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.

MSP430F415/F413 comparator limits

Currently, there is a design using the comparator input in order to detect if the voltage supplied is low or not. We do not know what the real limits of our applications are, in order to detect or not low voltage condition. I would like to ask your help in order to understand how to calculate such limits.

Electrical diagram

The simplified diagram of such application is the following:

As it can be noticed, the only circuitry is a voltage divider to try to match to the ~0.55V that triggers the comparator. Tolerance of both resistors is +/- 1%. Under nominal conditions the comparator should trigger approximately at Vcc = 2.55V. The factor generated by the variation of the resistors in the voltage divider is 0.215792Vcc to 0.222638Vcc.

Current configuration of comparator

CACTL2 = 0x0A;                 // P2CA1 = 1: CA1 pin selected (P1.7)

                                                // P2CA0 = 0: CA0 pin not selected (P1.6)

                                                // CAF = 1: Comparator output is filtered

 

CACTL1 = 0x38;                  // CAON = 1: Comparator A is on

                                                // CAREFx = 11: Diode reference selected (~0.55V)

                                                // CAEX = 0: Comparator exchange is off

                                                // CARSEL = 0: Vcaref is applied to + terminal

                                                // CAIES = 0: Comparator interrupt edge select

                                                // CAIE = 0: Comparator interrupt enable

                                                // CAIFG = 0: Comparator interrupt flag

 

P1DIR.P1DIR_7 = 0;         // P1.7 set as input

Reference voltages

For an initial analysis, it was considered that the microcontroller would be in a free-air temperature between 15 °C to 55 °C, so according to SLAS340J (MSP430x41x specification), the following curves were considered. This would give us a reference voltage between 0.51V and 0.57V, but some units were found out of that range (approximately 0.59V), and do not seem to follow any particular batch. The temperature is not lower than 15°C when testing the units, but we do not know the curves for minimum and maximum. The curves below only show typical scenarios. Is there a way to calculate real minimum and maximums?

Tests done

In order to discard the possibility of having an issue with the board, we have switched the microcontroller between two units, one unit which comparator threshold is within the expected range (0.51V and 0.57V) and other unit which comparator threshold is out of expected range. The behavior follows the microcontroller.

 

 

  • What about the leakage current on the input pin? YOu do not disable the digital I/O functionality, did you? So the pin is still in GPIO input mode. On different MSPs, teh input leakage current can be significantly different, depending on th einput voltage. if you are near the high/low threshold, currents may drastically increase. The 50nA are for GND/VCC input level only. And your input voltage divider is relatively high impedance too.

    use CAPD register to disable the input buffer.

  • Thanks for your response Jens-Michael.

    I forgot adding the configuration of CAPD, it is already used for this application

    CAPD = 0x40;                  // CAPD6 = 1: P1.6 input buffer disable.

    Would you recommend to use different resistor values? We use high resistor values due to overall current consumption (to decrease it).

  • Well, without a min/max specification in the datasheet it is quite hard to do a worst case design. The typical value is just giving you a rough idea about where the mean of the characterization lot of this product (IC) was. Usually during production test of ICs the min/max values are tested.

    In the table there is a statement that the V(VrefVT) at 85degC and 3V is min=400mV, typ=490mV, max=550mV => so min=typ-90mV and max=typ+60mV. This variation seems also be seen for V(VrefVT) at 85defC and 2.2V - so at least voltage dependency seems not too bad. So my assumption is that at 15degC or 55degC you should see a similar variation. But that is nothing that is guaranteed or production tested by TI!!!

  • Claudia Prieto said:
    CAPD = 0x40;                  // CAPD6 = 1: P1.6 input buffer disable.

    Okay, so this normally shouldn't cause a problem then.

    Did you try to measure the input voltage on the two chips compared ot the supply on the resistor divider?

    It's still possible that the input impedance of teh MSPs is different and therefore the voltage divider drifts (heavily).

    Claudia Prieto said:
    Would you recommend to use different resistor values?

    For testing purposes: definitely. The smaller the resistances are, the smaller the influence of the MSP input impedance. If the two chips still behave significantly differen, then maybe you stressed the input pin of the misbehaving chip.

  • Hello Voyager,

    Thanks a lot for your reply,

    Voyager said:

    Well, without a min/max specification in the datasheet it is quite hard to do a worst case design. The typical value is just giving you a rough idea about where the mean of the characterization lot of this product (IC) was. Usually during production test of ICs the min/max values are tested.

    In fact I was expecting someone from TI to provide minimum and maximum limits to obtain the worst case, but no luck yet.

  • Usually the voltage measured is the one at Vcc, typically, it is around 2.55V (at the comparator input it is around 0.55V). But on the failing units, the Vcc voltage is about 2.72V (at the comparator input it is ~0.59V).

    In one of the units with high threshold (~0.59V), we tried with different sets of resistors maintaining more or less the same ratio on the voltage divider, but the behavior seemed the same. Data is in the table below, all resistors used had 1% tolerance.

    R16 is the resistor connected to Vcc and R20 is the one connected to Gnd. Vcc value is the threshold where comparator is active and Vcomp is the threshold where comparator is active, this is measured at the comparator's input.

    Parameter

    Original Values

    Set 1 Values

    Set 2 Values

    R16

    301 Kohm

    20 Kohm

    200 ohm

    R20

    84.5 Kohm

    5.62K

    56.2 ohm

    R20/R16 Ratio

    0.2807

    0.2818

    0.2818

    Vcc

    0.5941 V

    0.5936 V

    0.5929 V

    Vcomp

    2.72 V

    2.71 V

    2.72 V

     Do you think we are missing something here?

    Also, in code, the input buffer is disabled in CAPD and immediately after that, the comparator is verified, do you think it could affect somehow the measurement?

     

    // Configure comparator to measure low battery threshold
    CACTL2 = P2CA1 | CAF; // P2CA1 = 1: Pin is connected to CA1
    // CAF = 1: Output is filtered
    CACTL1 = CAREF_3 | CAON; // CARSEL=0: Vcaref to "+" terminal
    // CAREF_3: Vcaref = Internal diode reference
    // CAON = 1: Comparator is ON
    CAPD = CAPD6; // Disconnect P1.6 from comparator

    // Check if battery is above or below the threshold
    if (CACTL2_bit.CAOUT) { // CAOUT = 1 => Vcc is below threshold
    low_batt = TRUE;
    } else { // CAOUT = 0 => Vcc is above threshold
    low_batt = FALSE;
    }

     

  • In the table above, Vcc and Vcomp are inverted. Please excuse my mistake.

    Thanks,

  • This experiments shows that the input impedance of teh MSP cannot be the reason for the different behavior. This isn't satisfying, but at least now we know for sure.

    Taking your results literally (no error in measurement and 0% resistor tolerance), it should be possible to calculate the exact input impedance. 40mV isn't that much, but in your case it is too much.
    So if you need the precision, there's only one way: calibrate it. Use the original value set (as it doen't seem to make a difference), but replace the bottom resistor by a smaller one and a series potentiometer that makes up for the rest. Then start your test software and apply the proper VCC for detection and adjust the poti until the comparator triggers.

    Precision reference voltage sources, which you could use for comparing with an external reference instead of the internal one, are expensive and require quite much operating current. And a simple zener diode has a far higher tolerance than the internal diode reference.
    However, you can turn the job ubside down: select VCC/2 or VCC/4 as reference and compare it against an external constant voltage.
    Or you skip the whole comparatior stuff and use the supply voltage supervisor. Saves you the two resistors and the comparator operating current. The SVS is usually less power-hungry. Unfortunately, it isn't that precise too.

**Attention** This is a public forum