madagaskar

KL25Z, SysTick problem.

Discussion created by madagaskar on Feb 21, 2013
Latest reply on Jul 28, 2016 by Ken Carlo Ferry

Hello everyone,

bellow I wrote my SysTick code. It's works but i have problem with time couting:

 

#include "derivative.h"

 

void SysTick_Handler()

{

     //LED TOGGLE

     GPIOB_PTOR |= (1<<0);

}

 

 

     int main(void){

 

     SYST_RVR = SysTick_RVR_RELOAD(6000000);

     SYST_CVR = SysTick_CVR_CURRENT(0);

     SYST_CSR |= SysTick_CSR_ENABLE_MASK | SysTick_CSR_TICKINT_MASK | SysTick_CSR_CLKSOURCE_SHIFT;

 

     for(;;){}

     return 0;

}

 

Default i have 48MHz system clock and 8MHz external oscillator. Why LED doesn't toggle once for a second (now it's mutch longer)? Maybe I forgot about something important?

 

Outcomes