cancel
Showing results for 
Search instead for 
Did you mean: 

SysTick calibration values

Posted on June 13, 2016 at 17:40

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee
Posted on June 02, 2017 at 13:57

Hi

Waclawek.Jan

,

I checked that reported typos are already fixed in revision 5 of RM0

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
Amel NASRI
ST Employee
Posted on June 27, 2016 at 13:44

Hi waclawek.jan,

Please note that the typo in RM0351 is reported internally, to be fixed in a coming version of the document.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on June 27, 2016 at 16:48

Thanks for taking care, Mayla.

Jan

Amel NASRI
ST Employee
Posted on June 02, 2017 at 13:57

Hi

Waclawek.Jan

,

I checked that reported typos are already fixed in revision 5 of RM0

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.