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-MSPM0G3507: MSPM0G3507

Part Number: LP-MSPM0G3507
Other Parts Discussed in Thread: MSPM0G3507, , SYSCONFIG

Hi All,

Currently, I am delving into the study of TI’s MSPM0G3507 MCU for an upcoming project that I will be actively involved in. To facilitate my understanding, I am utilizing the LP-MSPM0G3507 Evaluation Kit to familiarize myself with TI’s ARM MCU architecture and IDE platform. Furthermore, I am exploring example projects to gain insight into the peripherals.

Beginning with the GPIO toggle output example, I successfully observed the output toggling. Subsequently, I progressed to studying timers and attempted the “timg_32bit_timer_mode_pwm_edge_sleep” example to test the PWM signals generated using timer-related examples from mspm0_sdk_1_30_00_03.

However, upon building and debugging the project in CCS Studio, I encountered an issue where the code entered the “Default_Handler” when the “DL_TimerG_reset” function was called.

After further investigation, I found a suggestion in TI E2E design support. I implemented the suggested code to determine the trigger for the Default Handler event, only to discover that the code actually entered the “Hardfault_Handler” instead.

So I used SysConfig file in the project, changed the current TIMG12(32bit) timer into TIMA1(16bit) and changed the 32bit PWM Period value into 16-bit Period value.

And I rebuilt and debugged the project again. But this time, the code didn’t enter the Hardfault_Handler but I couldn’t see any signals generated from both CCP channels, PA10 and PA11 pin on the Eval Kit when I probed these signals.

I have also attempted another pwm_edge example, but the outcome was largely similar.

I would greatly appreciate any insights or assistance you could provide regarding this matter.

 

Thank you so much in advance for your time and assistance.

  • Hi,

    PA10 and PA11 is reserved as UART communication port with PC through XDS-110 on the EVM board. You need to changes the jumpers position on J25 and J26 or just use other pins to output the PWM signal. 

    Best regards,

    Cash Hao

  • Hi Cash Hao11,

    thanks so much for the reply. I tried using other pins PB26, PB27 and PA17, PA18. There are still no PWM signals.

  • Hi,

    That is abnormal. Could you send me your code here so I can test on? 

    Best regards,

    Cash Hao

  • Hi Cash Hao11,

    thanks so much for your prompt response.

    Please have a look at the project I used.

  • Hi,

    Could you directly share your code here not through a drive? The drive could be blocked by company.

    Best regards,

    Cash Hao

  • Sure Cash Hao11, please let me know if you need any more information. Thanks again for your prompt response and help.

    timg_32bit_timer_mode_pwm_edge_sleep.c

    #include "ti_msp_dl_config.h"
    /*
    * These are traps for debugging when you find that your code
    * ends up in the default handler for some unknown reason.
    * To keep the compiler from complaining, comment out the ones
    * below if you already have a working handler for that vector.
    *
    */
    void NMI_Handler(void){ __BKPT(0);}
    void HardFault_Handler(void){ __BKPT(0);}
    void SVC_Handler(void){ __BKPT(0);}
    void PendSV_Handler(void){ __BKPT(0);}
    void SysTick_Handler(void){ __BKPT(0);}
    void GROUP0_IRQHandler(void){ __BKPT(0);}
    void GROUP1_IRQHandler(void){ __BKPT(0);}
    void TIMG8_IRQHandler(void){ __BKPT(0);}
    void UART3_IRQHandler(void){ __BKPT(0);}
    void ADC0_IRQHandler(void){ __BKPT(0);}
    void ADC1_IRQHandler(void){ __BKPT(0);}
    void CANFD0_IRQHandler(void){ __BKPT(0);}
    void DAC0_IRQHandler(void){ __BKPT(0);}
    void SPI0_IRQHandler(void){ __BKPT(0);}
    void SPI1_IRQHandler(void){ __BKPT(0);}
    void UART1_IRQHandler(void){ __BKPT(0);}
    void UART2_IRQHandler(void){ __BKPT(0);}
    void UART0_IRQHandler(void){ __BKPT(0);}
    void TIMG0_IRQHandler(void){ __BKPT(0);}
    void TIMG6_IRQHandler(void){ __BKPT(0);}
    void TIMA0_IRQHandler(void){ __BKPT(0);}
    void TIMA1_IRQHandler(void){ __BKPT(0);}
    void TIMG7_IRQHandler(void){ __BKPT(0);}
    void TIMG12_IRQHandler(void){ __BKPT(0);}
    void I2C0_IRQHandler(void){ __BKPT(0);}
    void I2C1_IRQHandler(void){ __BKPT(0);}
    void AES_IRQHandler(void){ __BKPT(0);}
    void RTC_IRQHandler(void){ __BKPT(0);}
    void DMA_IRQHandler(void){ __BKPT(0);}
    
    int main(void)
    {
        SYSCFG_DL_init();
    
        DL_TimerG_startCounter(PWM_0_INST);
    
        while (1) {
            __WFI();
        }
    }

    ti_msp_dl_config.c

    /*
     *  ============ ti_msp_dl_config.c =============
     *  Configured MSPM0 DriverLib module definitions
     *
     *  DO NOT EDIT - This file is generated for the MSPM0G350X
     *  by the SysConfig tool.
     */
    
    #include "ti_msp_dl_config.h"
    
    DL_TimerA_backupConfig gPWM_0Backup;
    
    /*
     *  ======== SYSCFG_DL_init ========
     *  Perform any initialization needed before using any board APIs
     */
    SYSCONFIG_WEAK void SYSCFG_DL_init(void)
    {
        SYSCFG_DL_initPower();
        SYSCFG_DL_GPIO_init();
        /* Module-Specific Initializations*/
        SYSCFG_DL_SYSCTL_init();
        SYSCFG_DL_PWM_0_init();
        /* Ensure backup structures have no valid state */
    	gPWM_0Backup.backupRdy 	= false;
    
    }
    /*
     * User should take care to save and restore register configuration in application.
     * See Retention Configuration section for more details.
     */
    SYSCONFIG_WEAK bool SYSCFG_DL_saveConfiguration(void)
    {
        bool retStatus = true;
    
    	retStatus &= DL_TimerA_saveConfiguration(PWM_0_INST, &gPWM_0Backup);
    
        return retStatus;
    }
    
    
    SYSCONFIG_WEAK bool SYSCFG_DL_restoreConfiguration(void)
    {
        bool retStatus = true;
    
    	retStatus &= DL_TimerA_restoreConfiguration(PWM_0_INST, &gPWM_0Backup, false);
    
        return retStatus;
    }
    
    SYSCONFIG_WEAK void SYSCFG_DL_initPower(void)
    {
        DL_GPIO_reset(GPIOA);
        DL_GPIO_reset(GPIOB);
        DL_TimerA_reset(PWM_0_INST);
    
        DL_GPIO_enablePower(GPIOA);
        DL_GPIO_enablePower(GPIOB);
        DL_TimerA_enablePower(PWM_0_INST);
        delay_cycles(POWER_STARTUP_DELAY);
    }
    
    SYSCONFIG_WEAK void SYSCFG_DL_GPIO_init(void)
    {
    
        DL_GPIO_initPeripheralOutputFunction(GPIO_PWM_0_C0_IOMUX,GPIO_PWM_0_C0_IOMUX_FUNC);
        DL_GPIO_enableOutput(GPIO_PWM_0_C0_PORT, GPIO_PWM_0_C0_PIN);
        DL_GPIO_initPeripheralOutputFunction(GPIO_PWM_0_C1_IOMUX,GPIO_PWM_0_C1_IOMUX_FUNC);
        DL_GPIO_enableOutput(GPIO_PWM_0_C1_PORT, GPIO_PWM_0_C1_PIN);
    
    }
    
    
    
    SYSCONFIG_WEAK void SYSCFG_DL_SYSCTL_init(void)
    {
    
    	//Low Power Mode is configured to be SLEEP0
        DL_SYSCTL_setBORThreshold(DL_SYSCTL_BOR_THRESHOLD_LEVEL_0);
    
        DL_SYSCTL_setSYSOSCFreq(DL_SYSCTL_SYSOSC_FREQ_BASE);
    	/* Set default configuration */
    	DL_SYSCTL_disableHFXT();
    	DL_SYSCTL_disableSYSPLL();
    
    }
    
    
    /*
     * Timer clock configuration to be sourced by  / 1 (32000000 Hz)
     * timerClkFreq = (timerClkSrc / (timerClkDivRatio * (timerClkPrescale + 1)))
     *   32000000 Hz = 32000000 Hz / (1 * (0 + 1))
     */
    static const DL_TimerA_ClockConfig gPWM_0ClockConfig = {
        .clockSel = DL_TIMER_CLOCK_BUSCLK,
        .divideRatio = DL_TIMER_CLOCK_DIVIDE_1,
        .prescale = 0U
    };
    
    static const DL_TimerA_PWMConfig gPWM_0Config = {
        .pwmMode = DL_TIMER_PWM_MODE_EDGE_ALIGN,
        .period = 65535,
        .isTimerWithFourCC = true,
        .startTimer = DL_TIMER_STOP,
    };
    
    SYSCONFIG_WEAK void SYSCFG_DL_PWM_0_init(void) {
    
        DL_TimerA_setClockConfig(
            PWM_0_INST, (DL_TimerA_ClockConfig *) &gPWM_0ClockConfig);
    
        DL_TimerA_initPWMMode(
            PWM_0_INST, (DL_TimerA_PWMConfig *) &gPWM_0Config);
    
        DL_TimerA_setCaptureCompareValue(PWM_0_INST, 16383, DL_TIMER_CC_0_INDEX);
        DL_TimerA_setCaptureCompareOutCtl(PWM_0_INST, DL_TIMER_CC_OCTL_INIT_VAL_LOW,
    		DL_TIMER_CC_OCTL_INV_OUT_DISABLED, DL_TIMER_CC_OCTL_SRC_FUNCVAL,
    		DL_TIMERA_CAPTURE_COMPARE_0_INDEX);
    
        DL_TimerA_setCaptCompUpdateMethod(PWM_0_INST, DL_TIMER_CC_UPDATE_METHOD_IMMEDIATE, DL_TIMERA_CAPTURE_COMPARE_0_INDEX);
    
        DL_TimerA_setCaptureCompareValue(PWM_0_INST, 32767, DL_TIMER_CC_1_INDEX);
        DL_TimerA_setCaptureCompareOutCtl(PWM_0_INST, DL_TIMER_CC_OCTL_INIT_VAL_LOW,
    		DL_TIMER_CC_OCTL_INV_OUT_DISABLED, DL_TIMER_CC_OCTL_SRC_FUNCVAL,
    		DL_TIMERA_CAPTURE_COMPARE_1_INDEX);
    
        DL_TimerA_setCaptCompUpdateMethod(PWM_0_INST, DL_TIMER_CC_UPDATE_METHOD_IMMEDIATE, DL_TIMERA_CAPTURE_COMPARE_1_INDEX);
    
        DL_TimerA_enableClock(PWM_0_INST);
    
    
        
        DL_TimerA_setCCPDirection(PWM_0_INST , DL_TIMER_CC0_OUTPUT | DL_TIMER_CC1_OUTPUT );
    
    }

    ti_msp_dl_config.h

    /*
     *  ============ ti_msp_dl_config.h =============
     *  Configured MSPM0 DriverLib module declarations
     *
     *  DO NOT EDIT - This file is generated for the MSPM0G350X
     *  by the SysConfig tool.
     */
    #ifndef ti_msp_dl_config_h
    #define ti_msp_dl_config_h
    
    #define CONFIG_MSPM0G350X
    
    #if defined(__ti_version__) || defined(__TI_COMPILER_VERSION__)
    #define SYSCONFIG_WEAK __attribute__((weak))
    #elif defined(__IAR_SYSTEMS_ICC__)
    #define SYSCONFIG_WEAK __weak
    #elif defined(__GNUC__)
    #define SYSCONFIG_WEAK __attribute__((weak))
    #endif
    
    #include <ti/devices/msp/msp.h>
    #include <ti/driverlib/driverlib.h>
    #include <ti/driverlib/m0p/dl_core.h>
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /*
     *  ======== SYSCFG_DL_init ========
     *  Perform all required MSP DL initialization
     *
     *  This function should be called once at a point before any use of
     *  MSP DL.
     */
    
    
    /* clang-format off */
    
    #define POWER_STARTUP_DELAY                                                (16)
    
    
    
    #define CPUCLK_FREQ                                                     32000000
    
    
    
    /* Defines for PWM_0 */
    #define PWM_0_INST                                                         TIMA1
    #define PWM_0_INST_IRQHandler                                   TIMA1_IRQHandler
    #define PWM_0_INST_INT_IRQN                                     (TIMA1_INT_IRQn)
    #define PWM_0_INST_CLK_FREQ                                             32000000
    /* GPIO defines for channel 0 */
    #define GPIO_PWM_0_C0_PORT                                                 GPIOA
    #define GPIO_PWM_0_C0_PIN                                         DL_GPIO_PIN_17
    #define GPIO_PWM_0_C0_IOMUX                                      (IOMUX_PINCM39)
    #define GPIO_PWM_0_C0_IOMUX_FUNC                     IOMUX_PINCM39_PF_TIMA1_CCP0
    #define GPIO_PWM_0_C0_IDX                                    DL_TIMER_CC_0_INDEX
    /* GPIO defines for channel 1 */
    #define GPIO_PWM_0_C1_PORT                                                 GPIOA
    #define GPIO_PWM_0_C1_PIN                                         DL_GPIO_PIN_18
    #define GPIO_PWM_0_C1_IOMUX                                      (IOMUX_PINCM40)
    #define GPIO_PWM_0_C1_IOMUX_FUNC                     IOMUX_PINCM40_PF_TIMA1_CCP1
    #define GPIO_PWM_0_C1_IDX                                    DL_TIMER_CC_1_INDEX
    
    
    
    /* clang-format on */
    
    void SYSCFG_DL_init(void);
    void SYSCFG_DL_initPower(void);
    void SYSCFG_DL_GPIO_init(void);
    void SYSCFG_DL_SYSCTL_init(void);
    void SYSCFG_DL_PWM_0_init(void);
    
    bool SYSCFG_DL_saveConfiguration(void);
    bool SYSCFG_DL_restoreConfiguration(void);
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* ti_msp_dl_config_h */

  • Hi,

    Your code is working on my side. I can get PWM signals on those pins. 

    Best regards,

    Cash Hao

  • Hi Cash Hao11,

    is there any jumper configurations that I need to look into for LP-MSPM0G3507 EVK to generate output from these pins?

  • Hi Cash Hao11,

    I have another LP-MSPM0G3507 EVK and I tried it out on this as well. But I got the same result.

    For your information,


    Green => PA18

    Yellow => PA17

  • Hi Cash Hao11,

    I forgot to mention about this. Whenever I tried to debug, I received this pop-up in IDE.

    But I still can run the debug function after I cliicked OK.

    Maybe this is the issue??

  • Hi Cash Hao11,

    I wanted to provide you with an update regarding the issues I've encountered. Since the microcontroller is currently being utilized in one of the projects by my colleague. I took one PCBA with the MCU and ran the same project on it. To my relief, I was able to observe the PWM output without encountering any issues.

    However, I did notice one discrepancy. When attempting to flash the code into the G3507 MCU on the actual PCBA, I didn't see the pop-up I just mentioned.

    From this, I inferred that the MCU on the current evaluation kit may not support the latest SDK. As a result, I plan to purchase a new evaluation kit. Nevertheless, I am curious to know if there is any workaround to address this issue.

  • Hi,

    Sorry for the late response. Just back to the office due to the holiday here.

    Good to know you are able to observe the PWM outputs. 

    That pop-up in IDE means you are using an early sample of MSPM0 MCU. Usually you can click OK and ignore this message. However, there are some changes between early sample and production version. Something like the timer module and etc.. So, the best way for you is to apply some new EVM boards. 

    Best regards,

    Cash Hao