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.

TM4C123GH6PM: How do I reset the SysTick Counter?

Part Number: TM4C123GH6PM


Hi everyone,

Is there a way to reset the SysTick counter?

Each time I read the counter's value with SysTickValueGet(); I want to reset the Counter . I tried SysTickPeriodSet(); but that didn't work.

Thanks!

  • phuoc nguyen said:
    Each time I read the counter's value with SysTickValueGet(); I want to reset the Counter

    Why, what do you hope to achieve? And why the SysTick timer?

    Robert

  • Hello phuoc,

    The comments for SysTickPeriodSet(); has the reasoning for your observation:

    "Calling this function does not cause the SysTick counter to reload immediately.  If an immediate reload is required, the \b NVIC_ST_CURRENT register must be written.  Any write to this register clears the SysTick counter to 0 and causes a reload with the \e ui32Period supplied here on the next clock after SysTick is enabled."

    With that explained, I can say that there is no TivaWare API for resetting the SysTick counter as we don't have an API that sets the NVIC_ST_CURRENT register, only an API to read it.

    As Robert asked, I'd also be curious to know what your reasoning for wanting the ability to reset SysTick is though... that is not a normal thing to do.

  • *** LIKE *** (to be shared - first to Robert for (daring) to ask, "Why?"     Then to Ralph - for clearly presenting "deep dive" detail...)

    And - "not a normal thing to do" ... has that (ever) prevented posters from such unusual, "Choices/Desires?"     GREAT to see (some) challenge (2x - here!) to such poster requests - never/ever revealing poster motivation - and especially  "justification" (for such requests!)

  • I just want to know if I can thats all. Thanks you.