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.

LP-MSPM0C1104: can't output 4 channels of pwm by using TIMG14

Part Number: LP-MSPM0C1104

Hi, experts:

     I used CCS Theia 1.3.1 and set TIMG14 as pwm output clock, enable all 4 channels, but only PA16/PA23 are OK, PA24/PA25 got nothing at oscilloscope, I also modified C:\ti\mspm0_sdk_2_00_00_03\source\ti\driverlib\dl_timerg.h, add below contents to fix compile errors as TI support suggested in another thread:

/**
* @brief Index associated to Capture Compare 2
*/
#define DL_TIMERG_CAPTURE_COMPARE_2_INDEX DL_TIMER_CC_2_INDEX

/**
* @brief Index associated to Capture Compare 3
*/
#define DL_TIMERG_CAPTURE_COMPARE_3_INDEX DL_TIMER_CC_3_INDEX

attached file is the project I test, please help to check what did I miss, thanks.

Bill

test_pwm.rar

  • update main() function, the result is same.

    /*
     * Copyright (c) 2023, 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"
    
    int main(void)
    {
        SYSCFG_DL_init();
        DL_TimerG_setCaptureCompareValue(PWM_0_INST, 50, DL_TIMER_CC_0_INDEX);
        DL_TimerG_setCaptureCompareValue(PWM_0_INST, 50, DL_TIMER_CC_1_INDEX);
        DL_TimerG_setCaptureCompareValue(PWM_0_INST, 50, DL_TIMER_CC_2_INDEX);
        DL_TimerG_setCaptureCompareValue(PWM_0_INST, 50, DL_TIMER_CC_3_INDEX);
        DL_TimerG_startCounter(PWM_0_INST);
    
        while (1) {
        }
    }
    

  • hi, Yuhao:

         Yes, we've just got the LP-MSPM0C1104 so we could test our code and found the issue, could you help me out? Thanks.

    Bill

        

  • Hi Bill,

    The root cause is the DL_TimerG_initPWMMode() is lack of configure for CC2 and CC3.

    Please add the following code after SYSCFG_DL_init();

    DL_Timer_setCaptureCompareAction(PWM_0_INST,
    (DL_TIMER_CC_LACT_CCP_HIGH | DL_TIMER_CC_CDACT_CCP_LOW),
    DL_TIMER_CC_2_INDEX);
    DL_Timer_setCaptureCompareAction(PWM_0_INST,
    (DL_TIMER_CC_LACT_CCP_HIGH | DL_TIMER_CC_CDACT_CCP_LOW),
    DL_TIMER_CC_3_INDEX);

    Thanks,

    Yuhao

  • Hi, Yuhao:

          I tried and it worked, another question: does these codes need to add for CC2 and CC3 as well? They're also in DL_TimerG_initPWMMode() 

    DL_Timer_setCaptureCompareCtl(
    gptimer, DL_TIMER_CC_MODE_COMPARE, 0, DL_TIMER_CC_0_INDEX);

    DL_Timer_setCaptureCompareCtl(
    gptimer, DL_TIMER_CC_MODE_COMPARE, 0, DL_TIMER_CC_1_INDEX);

    DL_Timer_setCaptureCompareOutCtl(gptimer, DL_TIMER_CC_OCTL_INIT_VAL_LOW,
    DL_TIMER_CC_OCTL_INV_OUT_DISABLED, DL_TIMER_CC_OCTL_SRC_FUNCVAL,
    DL_TIMER_CC_0_INDEX);

    DL_Timer_setCaptureCompareOutCtl(gptimer, DL_TIMER_CC_OCTL_INIT_VAL_LOW,
    DL_TIMER_CC_OCTL_INV_OUT_DISABLED, DL_TIMER_CC_OCTL_SRC_FUNCVAL,
    DL_TIMER_CC_1_INDEX);

    DL_Timer_setCaptureCompareInput(gptimer, DL_TIMER_CC_INPUT_INV_NOINVERT,
    DL_TIMER_CC_IN_SEL_CCPX, DL_TIMER_CC_0_INDEX);

    DL_Timer_setCaptureCompareInput(gptimer, DL_TIMER_CC_INPUT_INV_NOINVERT,
    DL_TIMER_CC_IN_SEL_CCPX, DL_TIMER_CC_1_INDEX);

    Bill

  • Yes, they are missing too. But for your case, I think it is enough to add setCaptureCompareAction.

    And we will fix the problem in the later version SDK.

  • Thank you very much!