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.

MSPM0G3507: Does COMP module uses DAC12/8 module for the VREF(internal/external)?

Part Number: MSPM0G3507
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

I am adding comparator module for my existing project to support for the overcurrent monitoring, In comparator module the reference voltage can be taken from VREF(internal/external). In my case the VREF+ pin is hooked with the 3.3V source. So, I cannot use the internal voltage reference which can generate 1.4V or 2.5V. I saw in the COMP diagram, VREF is hooked with block called "Reference generator including 8-bit DAC".

Question is -

1. To use the external VREF with the DAC do we need to use the actual DAC12/8 module?

2. If answer to above question is YES, then why in the CCS SDK files they are not using the DAC 8/12 module and directly they are setting the DACCODE value by using the formulae 

/*
     * Set output voltage:
     *  DAC value (8-bits) = DesiredOutputVoltage x 255
     *                          -----------------------
     *                              ReferenceVoltage
     */

In CCS example they are generating the 2.5 volt from the internal VREF, but in the formluae they are putting ReferenceVoltage = 3 volt. and DesiredOutputVoltage  = 1.5V. the DAC value they are pushing it to the DACCODE bits in COMPx.CTL3 register.

Can somebody give me the clarification here please?

  • Hi Nishant,

    The comparator module has it's own 8-bit DAC, this DAC can use the VREF+ node as its reference source. If using SysConfig:

    Under the VREF Module Basic Configuration:

    • Mode: External
    • VREF+/VREF- Configuration: VREF+ Enabled, VREF- enabled (disabled will also work if you want to use MCU ground instead)
    • External Voltage: Set this value to what you're external reference is (3.3V in your case)
      • This value will get propagated to your DAC module

    In the COMP module under Basic Configuration -> Reference Voltage Generation Configuration set:

    • Reference source: "VREF selected as the reference source to DAC and DAC output applied as reference to comparator"
    • Terminal: Reference Applied to positive terminal
      • Negative terminal can also be used
    • DAC Control: DACSW bit controls selection between DACCODE0 and DACCODE1
    • DAC Input: DACCODE0 selected as input for 8-bit COMP when DACCTL bit is 1
    • Input Code through DACCODE0: Hex value associated with the voltage you want
      • 0xFF is max so if you have a 2.8V reference then 0xFF will output 2.8V.

    The DAC12 module is completely separate module and can be input into the positive terminal of the comparators. This is helpful if needing that extra resolution.

    For the example, were you looking at the comp_hs_dac_vref_external example? To me it looks like the wrong VREF setting is getting chosen in SysConfig, you would need to make the change that I listed under the VREF Module Basic Configuration. The .c code is correct though.

    Regards,
    Luke

  • Hi Nishant, thanks for reaching out! So if you are wanting to leverage the M0 comparator using an external VREF, you will need to change the REFSRC bits in the COMPx.CTL2 register based on the following:

    • REFSRC = 0: the reference voltage generator is disabled and cannot be used for comparator operation
    • REFSRC = 1: the analog supply VDDA is selected as the reference input for the DAC and the DAC output is used as reference voltage for the comparator
    • REFSRC = 2: the VREF from internal reference module output is selected as the reference input for the DAC and the DAC output is used as reference voltage for the          comparator
    • REFSRC = 3: tthe VREF from internal reference module output is used directly as reference voltage for the comparator and the DAC is switched off

    It sounds like the last option is what you are looking for. An easier way to do this would be leveraging the SysConfig tool under ANALOG-->COMP. Just be sure to also change your VREF (also under ANALOG) to external. This should bypass the DAC alltogether and use your ext. VREF as the reference.

    -Brian

  • Yes, this is what the example code also says. Thanks for clarification and your support :)