I am still working my way through the STM32 , and decided to move away from CubeMX, to use the registers. I have started by writing the following just to get the systick to work. Im not really interested on the time span, just want to see the interupt working. I have done the following, and wondering if anyone can tell me whats happening? I simply setup ticker interupt, and setup a delay. The delay should exit when count down to 0, but for some reason the Delay function never exits. I am using Keil and step through the Delay function and see it count down..
I am initialising the systick, and initialising the Load register.
I then simply create a Delay(x) routine to continue to check the variable to see if reached 0.
SysTick_Initialize(100); // << init Load and set interupt
Delay(5); //<<do a simple countdown. In here is the issue
void SysTick_Initialize(uint32_t ticks)
SysTick->CTRL |= SysTick_CTRL_CLKSOURCE_Msk;
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
if(TimeDelay>0) //simply count down
TimeDelay--; //just to test I have setup the interupt okay
void Delay(uint32_t nTime)
while(TimeDelay !=0) //<<< this loop never breaks out.. The variable does count down to 0.