AnsweredAssumed Answered

SysTick calibration values

Question asked by waclawek.jan on Jun 13, 2016
Latest reply on Jun 2, 2017 by Amel N
Part of ARM's specification of the core (as given by ARM® v7-M Architecture Reference Manual, or ARMv7M ARM for short :-) ) is the SysTick counter, and part of that counter is a read-only register, containing a calibration value STK_CALIB, which, when used as a reload for SysTick, would produce a 10ms tick (reload/interrupt etc.etc.).

Now, according to PM0214, in ST's incarnation of Cortex-M4 in 'F3 and 'F4, using the calibration value yields a 1ms tick. Well, humm, okay.

This is valid, "when the SysTick counter runs on HCLK max/8", which is given by STK_CTRL.CLKSOURCE. Funnily, this bit resets to 1, which means SysTick running at HCLK. More hummm.

But even if we accept these, the constants are mostly wrong. The reload value should be one less than the required number of clock cycles, and it is not, in most of the families I've looked at (yes for the 'F4 I have already ranted in that "typos and stuff" document of mine).

Today I've worked with the 'L476. Looked at that constant in the RM0351 (rev.4, ch.11.2): "The SysTick calibration value is set to 0x100270F, which gives a reference time base of
1 ms with the SysTick clock set to 10 MHz (max f HCLK /8)."

Needless to say, it's wrong, but in a different way. The reload value to get 1ms from 10MHz is obviously 9999, which is 0x270F. Sure enough, the real hardware does contain the proper value, so it's "only" an error in documentation.

I mean, I know nobody cares, but still, how hard it might be to get it right?

And even if it's a ROM, it's still a bunch of transistors; and even if they come for millicents for a dozen, they could've been spent better. If this is easier to implement, ARMv7M ARM allows to use 0 for that constant, and it wouldn't make any difference.

JW


PS. I wrote this empty rant out of pure frustration. I've just spent wasted a day with trying to figure out the USB stuff in slightly more depth than just throwing at it a library or two. Not only is the description in RM poor, to be very polite; but there are are so many and so obvious factual errors that I am too disgusted even just to list them; and the way how the module is dealt with in the default header is simply outrageous.

PS2. Of course the forum glitched and threw away the post at the first attempt.

Outcomes