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.

MSPM0G1506: DAC: CALCTL CALSEL bit

Part Number: MSPM0G1506
Other Parts Discussed in Thread: MSPM0G3507

Hi Team,

My customer found if call DL_DAC12_startCalibration, the DAC performace get better. Even if they don't read and use CALDATA.

But from this E2E, they should use CALDATA after DAC Calibration. We don't know why DAC performace get better.

__STATIC_INLINE void DL_DAC12_startCalibration(DAC12_Regs *dac12)
{
    dac12->CALCTL =
        (DAC12_CALCTL_CALON_ACTIVE | DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM);
}

 

  1. Could you help explain CALSEL bit function? TRM don't explain how to use this bit. 
  2. what the relationship of CALSEL and CALON bit? There is some infomation about CALON , and tell user how to do offset calibration in TRM 19.2.11 DAC Output Amplifier Offset Calibration. But in our driverlib, why we set DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM?

image.png

 

  • Hi Zane,

    Enabling the CALON bit allows the user to calibrate any offset errors to achieve the best performance of the DAC. 

    CALSEL bit let the user chooses whether to use the factory trimmed value which is one time adjustment during final test or using the Self Calibration during customer user case to Calibrate the best trim value. It is default to Factory trim but using the Self Calibration Trim will have better results.

    In order to achieve the best results, we want to enable CALON bit to initiate the offset error calibration and enable CALSEL bit to self calibration trim to calibrate to the optimal trim to compensate the offset errors. Therefore in the Driverlib we setting the DAC12_CALCTL_CALSEL_SELFCALIBRATIONTRIM.

    Regards,

    Bill

  • Hi Bill,

    I do some tests on M0G1507-LP, and import dac12_fixed_voltage_vref_internal_LP_MSPM0G3507_nortos_ticlang demo, use multimeter to measure PA15 and GND.

     

    I use below code to test ADC  Calibration function:

    /*
     * Copyright (c) 2021, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    #include "ti_msp_dl_config.h"
    
    /*
     * DAC12 Reference Voltage in mV
     *  Adjust this value according to DAC12 reference settings in SysConfig
     *    Or, in registers CTL1.REFSN and CTL1.REFSP
     */
    #define DAC12_REF_VOLTAGE_mV (2500)
    /*
     * DAC12 static output voltage in mV
     *  Adjust output as needed and check in DAC_OUT pin
     */
    #define DAC12_OUTPUT_VOLTAGE_mV (100)
    
    int main(void)
    {
        uint32_t DAC_value;
        uint32_t DAC_CALDATA;
    
        uint32_t realdata;
    
    
    
        SYSCFG_DL_init();
    
        DL_DAC12_performSelfCalibrationBlocking(DAC0);
    
        DAC_CALDATA = DL_DAC12_getCalibrationData(DAC0);
    
    
    
        /* Set output voltage:
         *  DAC value (12-bits) = DesiredOutputVoltage x 4095
         *                          -----------------------
         */
        DAC_value = (DAC12_OUTPUT_VOLTAGE_mV * 4095) / DAC12_REF_VOLTAGE_mV;
    
        realdata = DAC_value + DAC_CALDATA;
    
        DL_DAC12_output12(DAC0, realdata);
        DL_DAC12_enable(DAC0);
    
        while (1) {
            __WFI();
        }
    }
    

    When #define DAC12_OUTPUT_VOLTAGE_mV (1000)

    Don’t perform Calibration: PA15 voltage is 0.991V

    After perform Calibration and add CALDATA: PA15 voltage is 1.030V

    When #define DAC12_OUTPUT_VOLTAGE_mV (100)

    Don’t perform Calibration: PA15 voltage is 99.1mV

    After perform Calibration and add CALDATA: PA15 voltage is 138.4mV

     

    From the test results: After DAC Calibration, DAC output precision get worse.

  • Hi Zane,

    I made some adjustment on the code you provided above.

    For DL_DAC12_performSelfCalibrationBlocking(DAC0) and DL_DAC12_getCalibrationData(DAC0) function to work correctly you will need to enable it after the DAC module is enabled which is after the DL_DAC12_enable(DAC0). 
     

    #include "ti_msp_dl_config.h"
    
    /*
     * DAC12 Reference Voltage in mV
     *  Adjust this value according to DAC12 reference settings in SysConfig
     *    Or, in registers CTL1.REFSN and CTL1.REFSP
     */
    #define DAC12_REF_VOLTAGE_mV (2500)
    /*
     * DAC12 static output voltage in mV
     *  Adjust output as needed and check in DAC_OUT pin
     */
    #define DAC12_OUTPUT_VOLTAGE_mV (2000)
    
    
    
    int main(void)
    {
        uint32_t DAC_value;
        uint32_t DAC_CALDATA;
        uint32_t realdata;
    
        SYSCFG_DL_init();
        // DL_DAC12_performSelfCalibrationBlocking(DAC0);
    
        // DAC_CALDATA = DL_DAC12_getCalibrationData(DAC0);
        /* Set output voltage:
         *  DAC value (12-bits) = DesiredOutputVoltage x 4095
         *                          -----------------------
         *                              ReferenceVoltage
         */
        DAC_value = (DAC12_OUTPUT_VOLTAGE_mV * 4095) / DAC12_REF_VOLTAGE_mV;
        DL_DAC12_enable(DAC0);
        
        DL_DAC12_performSelfCalibrationBlocking(DAC0);
        DAC_CALDATA = DL_DAC12_getCalibrationData(DAC0);
        realdata = DAC_value - DAC_CALDATA;
        DL_DAC12_output12(DAC0, realdata);
        // DL_DAC12_output12(DAC0, DAC_value);
    
        while (1) {
            __WFI();
        }
    }

    Without the calibration and with voltage Output 1000 mV PA15  measured: 1.012 V

    With calibration: PA15 Voltage is 1.008 V

    Without the calibration and with voltage Output 2000 mV PA15 measured: 2.010V

    With calibration: PA15 Voltage is: 2.006 V

    I hope this helps.

    Regards,

    Bill