[Tinyos-devel] Fwd: [Tinyos-help] Bug report (was: ReadStream
period off on a telosb?)
Jan Hauer
jan.hauer at gmail.com
Mon Apr 7 03:47:59 PDT 2008
> I will put a small ReadStream
> wrapper on top of AdcP (which is wired only if there is a ReadStream
> client) which then uses an Alarm<TMicro, uint32_t> to schedule
> sampling in case usPeriod > 0xFFFF (I can probably copy some code from
> the atmega implementation)
FYI: this is now fixed in CVS.
Jan
On Thu, Mar 6, 2008 at 2:09 PM, Jan Hauer <hauer at tkn.tu-berlin.de> wrote:
> yes, it's a bug: the upper 16bit of the "usPeriod" parameter are
> currently truncated
>
>
> > What's the proper way to fix this? If there's no (nice) way of supporting
> > 32-bit wide periods on the MSP430, change the ReadStream interface to be
> > generic on both the sampled type and the width of the period and have the
> > MSP430 provide a ReadStream<uint16_t, uint16_t>?
>
> ReadStream is a standard TinyOS interface and I'm afraid we can't
> change it just because it doesn't 100% fit the HAL of the msp430
> adc... The usual approach here is "software simulation of the missing
> hardware capabilities" (TEP2) - i.e. I will put a small ReadStream
> wrapper on top of AdcP (which is wired only if there is a ReadStream
> client) which then uses an Alarm<TMicro, uint32_t> to schedule
> sampling in case usPeriod > 0xFFFF (I can probably copy some code from
> the atmega implementation)
>
> Jan
>
>
>
> On Wed, Mar 5, 2008 at 11:22 PM, Kevin Klues <klueska at gmail.com> wrote:
> > 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
> > _______________________________________________
> > Tinyos-devel mailing list
> > Tinyos-devel at millennium.berkeley.edu
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel
> >
>
More information about the Tinyos-devel
mailing list