cancel
Showing results for 
Search instead for 
Did you mean: 

SysTick timing problem

jbl_raw
Associate II
Posted on June 01, 2013 at 14:45

the problem is when i make     Delay(1000);  it must delay 1second

but it make delay about 3second not 1second . it was 3time slower than the real time

volatile uint32_t msTicks;   

void SysTick_Handler(void) {

  msTicks++;

}

void Delay (uint32_t dlyTicks) {                                              

  uint32_t curTicks;

  curTicks = msTicks;

  while ((msTicks - curTicks) < dlyTicks);

}

SystemCoreClockUpdate();                      /* Get Core Clock Frequency   */

  if (SysTick_Config(SystemCoreClock / 1000)) { /* SysTick 1 msec interrupts  */

 while (1);                                  /* Capture error              */

  }

1 REPLY 1
Posted on June 01, 2013 at 16:36

At a guess, I'd say your HSE_VALUE and/or settings in system_stm32f4xx.c are for an external 25 MHz crystal, and a design (like the F4-Disco) using an 8 MHz crystal. Thus the 3x difference.

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