2010-12-29 04:56 AM
SysTick - SystemCoreClock - mismatch?
2011-05-17 05:19 AM
Sounds more like a compiler optimization or code placement issue. Or the length of the test, and the granularity of your timebase.
Software timing loops are notoriously unpredictable, and will be compounded by placement with respect to the flash/cache lines. For predictable timing, I'd use the core's cycle counter. Something like this would generate more consistent code and placement between two compiles. void SetSysTick(int i) { SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK); if (i == 1) SysTick_Config(SystemCoreClock / 1000); // = 1ms else if (i == 2) SysTick_Config(72000); // = 1ms } SetSysTick(1); //SetSysTick(2);