thanks a lot David. You have saved me a lot of debugging time :)

you are welcome to checkin the modified version of the code.

thanks for your notes as well.

Mayur


On 7/11/07, David Gay <[EMAIL PROTECTED]> wrote:

On 7/10/07, Mayur Maheshwari <[EMAIL PROTECTED]> wrote:
> Has anyone tried logging data in a MicaZ in TOS2 ? I experienced a
problem
> with the wrong read/write on flash on micaz. I tried making few
applications
> to detect the exact nature of the error. I tried this:
>
> 1. Periodically logging data in the flash of MicaZ.
> 2. Periodically reading last values and sending them over the radio to
the
> basestation
>
> Result: I get first few values all correct. However when the second and
> subsequent bunch of readings are sent they are preceded with quite a
large
> number of 0XFFFF readings(arbit readings). My read uses cookie
information
> to detect and stop reading further if the read and write pointer are at
the
> same position. I am not able to ascertain if it is the problem of the
write
> operation OR read operation.

Thanks for the report :-) It's a bug related to sync. It's now fixed
in CVS (and should show up in the upcoming 2.0.2 release).

Do you mind if I checkin a modified version of your test code into the
TinyOS 2 apps/tests/storage directory? Tests to avoid regression are
always good...

Also, a couple of notes on the code:
- you don't need the atomic statements (there's no async commands and
events)
- calling sync after every write is a *bad* idea - it will make every
reading take 256 bytes of flash on mica family motes. Note the comment
in TEP103: "Using ``sync`` MAY waste some space in the log.".
- comparing the read and write offsets is not a reliable way to detect
that you've read to the end of the log - those offsets really are
"cookies" (magic numbers helping you go back to some position), not
file-style offsets. The reliable way to detect that you've read to the
end of the log is that the len argument to LogRead.readDone is 0 (and
yes, the readOffset == writeOffset test will misbehave on mica family
motes - your code on a fixed LogStorage implementation reports some
readings twice).

David Gay




--
Mayur Maheshwari([EMAIL PROTECTED])

"Karmanye Vadhikaraste Ma Phaleshu Kadachana,
Ma Karma Phala Hetur Bhurmatey Sangostva Akarmani"
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to