Skip to content

Commit 1babb6d

Browse files
committed
docs: Update timer tutorial to reflect new behaviour of timer.
1 parent 5d323de commit 1babb6d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/tutorial/timer.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ it's not yet initialised. So let's initialise it to trigger at 10 Hz
2626
Now that it's initialised, we can see some information about the timer::
2727

2828
>>> tim
29-
Timer(4, prescaler=255, period=32811, mode=0, div=0)
29+
Timer(4, prescaler=624, period=13439, mode=UP, div=1)
3030

3131
The information means that this timer is set to run at the peripheral
32-
clock speed divided by 255, and it will count up to 32811, at which point
33-
it triggers an interrupt, and then starts counting again from 0. These
34-
numbers are set to make the timer trigger at 10 Hz.
32+
clock speed divided by 624+1, and it will count from 0 up to 13439, at which
33+
point it triggers an interrupt, and then starts counting again from 0. These
34+
numbers are set to make the timer trigger at 10 Hz: the source frequency
35+
of the timer is 84MHz (found by running ``tim.source_freq()``) so we
36+
get 84MHz / 625 / 13440 = 10Hz.
3537

3638
Timer counter
3739
-------------

0 commit comments

Comments
 (0)