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.

MSPM0G3519: Sytick Re-init Sequence

Part Number: MSPM0G3519
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I’m trying to re-initialize the SysTick timer. I can successfully de-initialize it, but when I attempt to initialize it again, the SysTick interrupt no longer triggers. Is there a specific sequence or procedure I need to follow to re-initialize SysTick correctly

  • How (exactly) are you de-initializing/re-initializing? 

    DL_SYSTICK_init() leaves the timer stopped, with the interrupt disabled. DL_SYSTICK_config() leaves the timer running, with the interrupt enabled.

    I don't see a (Driverlib) deInit function. If you stopped it using DL_SYSTICK_disable(), you can reverse this by calling DL_SYSTICK_enable().

    [These functions are quite small. You can see what they do by right-clicking on the name, then "Open Declaration".]

  • I’m using DL_SYSTICK_disable() before entering STANDBY0 mode and DL_SYSTICK_enable() after exiting, but SysTick still doesn’t resume. I also tried disabling and re-enabling the interrupt directly using __NVIC_DisableIRQ(SysTick_IRQn) and __NVIC_EnableIRQ(SysTick_IRQn), but the behavior is the same.

    I also tried to disable the timer by directly accessing its registers:

        SysTick->CTRL = 0;
        SysTick->LOAD = 0;
        SysTick->VAL = 0;

    and then calling the normal initialization sequence via SysTick_Config();, but still the timer doesn't work.

    Could you share a minimal, working example that demonstrates the correct way to suspend and restore SysTick across STANDBY0 on MSPM0G3519, including any required reinitialization steps?

  • Hi Embedded,
    Can you share your example? I may be able to find out what could be wrong based on your code.

    Best Regards,

    Diego Abad

  • Hi Diego, Sorry for the late reply. Here are the code snippets for the methods I used:

    snippet 1:


        DL_SYSTICK_disable();

        DL_SYSCTL_setPowerPolicySTANDBY0();
        while(g_GPIOIntStatusFlag == 0)
        {
          __WFI();
        }
       
       DL_SYSTICK_enable();
    snippet 2:
        
        SysTick->CTRL = 0;  // Disable SysTick timer
        SysTick->LOAD = 0;  // Reset reload value
        SysTick->VAL  = 0;  // Clear current value
        while(g_GPIOIntStatusFlag == 0)
        {
          __WFI();
        }
      
        SysTick_Config(32000); // Corresponds to 1ms period for 32Mhz SYSOSC CLK input.
    snippet 3: 
        NVIC_DisableIRQ(SysTick_IRQn);
      
        while(g_GPIOIntStatusFlag == 0)
        {
          __WFI();
        }
        NVIC_EnableIRQ(SysTick_IRQn);
        
    Note: g_GPIOIntStatusFlag  is set to 1 via a GPIO interrupt which is working as expected.
    Neither of them seem to work as intended. 
    Best Regards,
    Embedded

  • Hi Embedded,
    Let me inspect this tomorrow. In the meantime, can you share your sysconfig file as well?

    Best Regards,

    Diego Abad

  • Hi Diego,

    This project has been made without sysconfig, is there anything specific about the project that you want to see?

    Regards,

    Embedded

  • Hi Embedded,
    Mainly how you originally set up your code. I see that the problem relies that you disable the SYSTICK before triggering the interrupt. If you disable the SYSTICK module, the interrupt won't trigger. I would recommend to disable it in the interrupt, and then re-enable it whenever you need it.

    #include "ti_msp_dl_config.h"

    uint8_t lol = 0;
    int main(void)
    {
        SYSCFG_DL_init();

        /* Calling WFI after calling DL_SYSCTL_enableSleepOnExit will result in
         * only ISR code to be executed. This is done to showcase the device's
         * low power consumption when sleeping.
         */
        // DL_SYSCTL_enableSleepOnExit();
        DL_SYSCTL_setPowerPolicySTANDBY0();
        while (1) {
            __WFI();
            DL_SYSTICK_enable();
            DL_SYSTICK_config(16000000);
        }
    }

    void SysTick_Handler(void)
    {
        DL_GPIO_togglePins(
            GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN | GPIO_LEDS_USER_TEST_PIN);
        if(lol == 0){
            DL_SYSTICK_disable();
            delay_cycles(100000000);
            lol++;
        }
    }
    Best Regards,
    Diego Abad
  • Hi Diego,

    I’m able to initialize and use the SysTick timer correctly at first. However, at a later point in the application, I need to disable it, enter standby mode, and then reinitialize the timer. The issue is that after exiting standby mode, the SysTick initialization appears to succeed, but the interrupt no longer triggers.

    Thanks and Regards,

    Embedded

  • Hi Embedeed,

    In the previous snipets you shared I don't see that you enabled the SYSTICK timer and call the DL_SYSTICK_config() as the following code:  

    DL_SYSTICK_enable();
    DL_SYSTICK_config(16000000);
    If that doesn't work. Can you try the snippet code I shared and see if this makes the SYSTICK be able to disable and enable itself again?
    Best Regards,
    Diego Abad
  • Hi Diego,

    The snippets I provided are from the section where I attempt to stop the SysTick timer and then reinitialize it. The proper initializations were already performed beforehand. However, I’ll try the snippet you shared and get back to you.

    Thanks for your support!

    Best regards,
    Embedded