[Tinyos-devel] Fwd: [Tinyos-help] Bug report (was: ReadStream period off on a telosb?)

Kevin Klues klueska at gmail.com
Wed Mar 5 14:22:54 PST 2008


Forwarding to devel list.  Jan do you have anything to say about this?

Kevin


---------- Forwarded message ----------
From: Sivan Toledo <stoledo at tau.ac.il>
Date: Wed, Mar 5, 2008 at 6:28 AM
Subject: [Tinyos-help] Bug report (was: ReadStream period off on a telosb?)
To: TinyOS Help Mailing List <tinyos-help at millennium.berkeley.edu>,
Michiel Konstapel <m.konstapel at sownet.nl>


You're right, but fixing it didn't help so I dug deeper and found that
 the ReadStream implementation on the MSP430 is broken.

 The problem is that chips/msp430/adc12/AdcP represents the usecond
 period as uint32_t, but its ResourceReadStream.granted event passes
 the usecond argument to
 Msp430Adc12SingleChannel.configureMultiple, which expects a uint16_t period.

 So even if I set the usecond period correctly in my program to a large
 value, it gets truncated in this function call. For some reason, GCC
 does not complain.

 The bug actually goes a bit deeper; it's not a simple matter of
 changing the argument of  Msp430Adc12SingleChannel.configureMultiple
 to uint32_t, because the argument is eventually used to directy set a
 compare register, and the compare registers are 16 bits on the MSP430.
 So there is no easy way to fix this except by using a virtual timer or
 alarm. Not a good solution.

 The bug does not affect me because I need a short period and was just
 using the 1 second period as a sanity check, but it is there (and as
 far as I could see, there was no warning about it anywhere).

 Regards, Sivan

 On 3/5/08, Michiel Konstapel <m.konstapel at sownet.nl> wrote:
 >
 >
 >
 > In C, integer constants are of type int, which on the MSP is 16 bits. I.e.,
 > you're actually sampling every (1000000 & 0xFFFF) clock ticks (are those
 > microseconds?). To specify a long integer (32 bit) constant, add an L to the
 > number. You can also add a U to make it unsigned: read(1000000UL) should do
 > the trick.
 >
 >  HTH,
 >  Michiel
 >
 >
 >  -----Original Message-----
 >  From: tinyos-help-bounces at millennium.berkeley.edu on
 > behalf of Sivan Toledo
 >  Sent: Tue 3/4/2008 9:07 PM
 >  To: TinyOS Help Mailing List
 >  Subject: [Tinyos-help] ReadStream period off on a telosb?
 >
 >  I am trying to read from the TelosB ADC using the ReadStream interface
 >  (wired to AdcReadStreamClientC), and it seems that when I set a large
 >  period, for sanity checking, the actual sampling period is much
 >  smaller. For example, if I call read(1000000) when the posted buffers
 >  are of size 8, I get several buffers per second back, rather than 1
 >  every 8 seconds.
 >
 >  Any idea why this is happening?
 >
 >  Thanks, Sivan
 >  _______________________________________________
 >  Tinyos-help mailing list
 >  Tinyos-help at millennium.berkeley.edu
 > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
 >
 >
 >
 >
 _______________________________________________
 Tinyos-help mailing list
 Tinyos-help at millennium.berkeley.edu
 https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



-- 
~Kevin


More information about the Tinyos-devel mailing list