[Tinyos-help] telosB cpu speed
cire831 at gmail.com
Wed Aug 8 20:43:13 PDT 2012
Greetings from America!
I'm fairly familar with the msp430 product line and in particular the 1611
(telosb), 2618 (z1 and mm4 motes), and 5438a (mm5 mote).
I've reworked significant sections of the 2618 msp430 and 5438 msp430 core
code and maintain the tinyprod tinyos repository which includes the result
of that msp430 rework
On Wed, Aug 8, 2012 at 9:02 AM, Xiaohui Liu <whulxh at gmail.com> wrote:
> Hi everyone,
> I'm working on protocol where timing is critical so I need to know exactly
> how long it will take for a code snippet to run. To that end, I want to
> know how fast the cpu is and have the following questions.
> 1) According to the telosB datasheet, the cpu frequency is 8 MHz, but I
> guess this is maximum, right? Then, what is the actual frequency of the
Actually, you want to be looking at the msp430f1611 datasheet which states
that f_system max is 8MHz.
The CPU MCLK gets connected to DCOCLK which is the output of a modulator.
This modulator mixes two frequencies to get approximately the frequency
that you want. So on average the DCOCLK flutuates between f_DCO-1 and
Note of caution, h/w manufacturers specify sizes and frequencies in terms
of base ten so 8MHz is 8,000,000 Hz. TinyOS has specified frequencies as
power of twos but still designates them using MHz units which causes
confusion. So when TinyOS talks about 4 MHz they are really talking about
4x1024x1024 Hz. I've taken to explcitly referencing power of two
frequencies using units like 1 MiHZ = 1024x1024 HZ and 1 KiHZ = 1024 HZ.
I've cleaned this up by going to flat HZ units in the msp430 code in the
TinyProd msp430 code.
Bottom line, is you need to be real careful at looking at timing units and
make sure you understand exactly what is being talked about.
Now why does this matter? Well TinyOS has liked to specify binary time.
And sets the clocks accordingly. The only reason this has mattered in the
past is using binary makes clock calibration from the 32KiHz clock crystal
oscillator vs. a binary DCO somewhat easier.
The big issue with running 8MHz on the 1611 is you can't do it unless using
an external Rosc which the TelosB doesn't have. You may be able to add
one. The pin isn't wired. From page 25, it also looks like you need
3.6V to run at the full 8.0 MHZ. With 3V it looks like you will only get 5
MHZ. So you proabably are out of luck without a fair amount of pain
tweaking the h/w. It probably makes more sense to move to a different
more capable mote.
The other thing is you have to break the assumption of binary time which
TinyOS states is what is required. (See TEP 102). I don't think
breaking this assumption has any significant ramifications. Keep in mind
that 1mis = 0.9765625 ms != 1ms. It matters what you are timing. This
might have an impact of various timeout values and things like that but in
practice doesn't seem to be that critical.
You definitly don't want to try to run the main cpu clock at 8MiHz
(8,388,608 Hz, or 4.8% too high). You might be able to get away with it
but I wouldn't recommend it because it is far outside the TI spec.
> 2) What is the calibration in Msp430ClockP.nc for? It seems to be related
> to DCOx setting.
The DCO isn't very stable and can vary depending on temperature and fab
issues. When you set it, you don't really know what frequency you are
getting. So you need to calibrate it to something that is stable. That
is one of the purposes of ACLK. (The other is ACLK clocks the timing
circuits when the CPU is in full sleep (DCOCLK is turned completely turned
off in full sleep).
The calilbration code looks at the DCO relationship to the ACLK and tweaks
the DCO parameters until we know what frequency the DCO is actually running
at. Originally it was thought that making DCOCLK a power of two would
make this process simpler. But in practice it doesn't matter and the ACLK
can be used to reasonably calibrate most frequencies. If DCOCLK is not a
power of two there is some potential for error but these errors are small.
Do keep in mind that this calibration is currently only run once when the
mote is first booted. This is actually a problem over time because the
DCO will drift and should be recalibrated with some fairly longish period.
3) Be default MCLK is sourced from DCOCLK, where can I find DCOCLK's
> frequency? I failed to locate it in the MSP430F1611 datasheet<http://www.ti.com/product/msp430f1611>
TI makes great h/w but their documentation leaves something to be desired.
Their System Architecture is pretty bad at times too. But the low power
aspects of the msp430 make it very desireable. Sigh. So it is what we've
got so you learn to live with it and to read between the lines.
One would think that such a major parameter would be clearly specified.
But it isn't.
If you look at pg 37 there is a tiny little foot note (note 1) that states
"The DCO frequency may not exceed the maximum system frequency defined by
parameter processor frequency, f_system."
The actual DCOCLK depends on the various settings of the Modulator bits,
RSEL, and DCO. See page 38.
> 4) Be default, the cpu runs at about 4MHz, is there any reason for not
> running at 8 MHz? Save power? Impossible since no external Rosc is
The main reason is there is no Rosc resister populated. Without that
resister you have to use the internal which is ~300kohms which only allows
about 5 MHZ.
I have see some related discussions
> but neither has definite answers for the questions above. If you can give
> any hint, that will be great. Thanks in advance.
> -- Cheers,
> -Xiaohui Liu
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
Eric B. Decker
Senior (over 50 :-) Researcher
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tinyos-help