The clock configuration about SysTick

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
Post Reply
satellite
Posts: 1
Joined: Wed May 24, 2017 9:11 am

The clock configuration about SysTick

Post by satellite » Wed May 24, 2017 9:19 am

Good afternoon, I want to ask a question about STM32F051. The clock source of systick is 8 frequency division of HCLK and this is the datasheet of STM32F051: http://www.kynix.com/uploadfiles/pdf879 ... 51C4T6.pdf .
The code about my systick.c is given below:
[code]#include "Systick.h"

static __IO uint32_t TimingDelay;

void Delay_ms(__IO uint32_t nTime)

  TimingDelay = (nTime*1000);

  while(TimingDelay != 0);
}

void Delay_us(__IO uint32_t nTime)

  TimingDelay = nTime;

  while(TimingDelay != 0);
}

/**
  * @brief  Decrements the TimingDelay variable.
  * @param  None
  * @retval None
  */
void TimingDelay_Decrement(void)
{
  if (TimingDelay != 0x00)
  { 
    TimingDelay--;
  }
}

void Systick_Init(void)
{
  if (SysTick_Config(SystemCoreClock / 1000000))                //1us
  { 
    /* Capture error */ 
    while (1);
  }
}[/code]
And then invoking them in main:
[code] LED_Open();
                        Delay_us(500000);
                        LED_Close();
                        Delay_us(500000);[/code]
When in the file--it.c:
[code]void SysTick_Handler(void)
{
        TimingDelay_Decrement();
}[/code]
Then the light can’t flash. Here the default is set to be frequency division.
2)It can operate normally before. The code is :
[code]void Systick_Init(void)
{
  if (SysTick_Config(SystemCoreClock / 1000))                //1ms
  {
    /* Capture error */
    while (1);
  }
}[/code]
But when invoking them:
  [code] LED_Open();
                        Delay_ms(500);
                        LED_Close();
                        Delay_ms(500);[/code]
The SystemCoreClock is set to be: “uint32_t SystemCoreClock    = 48000000” and it haven’t be changed.
In this situation it is normal, why? ? ?
Last edited by satellite on Thu May 25, 2017 1:33 am, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: The clock configuration about SysTick

Post by dhylands » Wed May 24, 2017 5:19 pm

Are you porting MicroPyhon to the STM32F051?

If not, then this is definitely the wrong place to be asking about this. I'd recommend that you try the st forums instead.

Post Reply