Skip to main content
jyoung
Associate II
May 4, 2010
Question

SysTick.CTRL register documentation

  • May 4, 2010
  • 1 reply
  • 2790 views
Posted on May 04, 2010 at 17:24

SysTick.CTRL register documentation

    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    May 17, 2011
    Posted on May 17, 2011 at 13:49

    From RM0008 STM32 Reference Manual (13902.pdf)

    Pg 71

    ''The RCC feeds the Cortex System Timer (SysTick) external clock with the AHB clock divided by 8. The SysTick can work either with this clock or with the Cortex clock (AHB), configurable in the SysTick Control and Status Register.''

    HCLK is AHBCLK

    The register you want to program is defined by ARM, not ST

    http://books.google.com/books?id=T9heqSaErCcC&pg=PA147&lpg=PA147&dq=SysTick+Control+and+Status+Register&source=bl&ots=eNvsEdEc5z&sig=fWIFO_tBWbkN_a6-btdbkwiw_-Q&hl=en&ei=4UngS_CKLJTENpTz7c4J&sa=X&oi=book_result&ct=result&resnum=4&ved=0CCMQ6AEwAw#v=onepage&q=SysTick%20Control%20and%20Status%20Register&f=false

    The clocks used by ARM are either SYSCLK, or the external clock (in this case ST's HCLK/8). I don't think the HCLK/1 is used, but it would be easy to check.

    I use HCLK/8, because a 1ms tick doesn't need to be clocking at an excessively high rate

    SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK_Div8);

    void SysTick_CLKSourceConfig(u32 SysTick_CLKSource)

    {

      /* Check the parameters */

      assert_param(IS_SYSTICK_CLK_SOURCE(SysTick_CLKSource));

      if (SysTick_CLKSource == SysTick_CLKSource_HCLK)

      {

        SysTick->CTRL |= SysTick_CLKSource_HCLK;

      }

      else

      {

        SysTick->CTRL &= SysTick_CLKSource_HCLK_Div8;

      }

    }

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..