Static volatile global variable updated in systick handler gives garbage values on startup despite being initialized to 0. Is this memory corruption?
Static volatile global variable updated in systick handler gives garbage values on startup despite being initialized to 0. Is this memory corruption?
Hey Jibin,
Can you share the code relevant to the initialization of the variable?
Cheers,
Håkon.
Hey,
**********************************
uint32_t returnCode;
static volatile uint32_t msTicks = 0;
void SysTick_Handler(void)
{
msTicks++;
}
//in main fn
returnCode = SysTick_Config(SystemCoreClock / 1000);
if(returnCode!=0)
{
printf("syserr\r\n");
}
************************************
It seems msTicks value shoots up very quickly.
Thanks,
Jibin
What SDK are you using? I can't find any reference to 'SysTick_Config'
My guess is that you are expecting the SysTick_Handler to be called every millisecond, when in fact it is called every 1/(64MHz/1000) = 15.6 µs.
What SDK are you using? I can't find any reference to 'SysTick_Config'
My guess is that you are expecting the SysTick_Handler to be called every millisecond, when in fact it is called every 1/(64MHz/1000) = 15.6 µs.