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: SysTicks works exceptionally

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

hi all:

I am new with this EVB and MCU. I want to create a systicks running a 1ms period and trigger a callback function. Here is the problem. 

I can enable systicks and get the value in a close loop. But in CCS syscfg, if i checked "Enable SysTick Interrupt". When the program starts, the system will crash in a while. (My program will print out a string after the system starts. The string can't print out completely in this situation, and the system crashes into the hard_fault().) It seems the interrupts crashed. any suggestion?? and how do I register a callback function?? Thanks~~

  • Hi, 

    Please have a try of demo code from SDK: systick_periodic_timer_LP_MSPM0G3507_nortos_ticlang

    It will toggle LED in every systick interrupt (500ms).

    Regards,

    Helic

  • It works fine for me.

    // Systick stuff
    volatile uint32_t Tick;
    
    uint32_t GetTicks() {
      uint32_t tmp;
    
      DL_SYSTICK_disableInterrupt();
      tmp = Tick;
      DL_SYSTICK_enableInterrupt();
      return tmp;
    }
    
    void SysTick_Handler(void) { Tick++; }
    
    void Delay(uint32_t delaytime) {
      uint32_t start = GetTicks();
    
      while ((GetTicks() - start) < delaytime) {
        delay_cycles(10000); // nothing better to do...
      }
    }

  • Hi 

    I will recheck the example, thanks for your advice.

    Hi

    From your example the "SysTick_Handler()" seems to be the default interrupt callback function. Thanks, I wasn't sure I could use that in another place.

    By the way, I have figured this issue out. I was wrong about the 1st parameter of DL_Interrupt_registerInterrupt(). I used the definition in dl_interrupt.h in the beginning. That's wrong. I checked the RTM again and again. Finally, I used the definition from "mspm0g350x.h". Then everything goes fine.

    int main(void)
    {
        SYSCFG_DL_init();
    
        DL_Interrupt_registerInterrupt(SysTick_IRQn, SysTick_CB);
        DL_SYSTICK_enableInterrupt();
        DL_SYSTICK_enable();
    
        SWTimer_Create();
        CLI_Init();
    
        uart_printf(CYAN"\r\nFIDM Start\r\n"NONE);
    
        SWTimer_UserSetRepeat(loop_1s, 1000U, 0, false);
    
        while (true) {
            SCLI_Run();
        }
    }

    Thank you, both

    Jacky

**Attention** This is a public forum