The tmote's will usually write about 17kB/sec using a 256-byte software RAM
buffer, which meets your requirements.  So that's good news.

There are some tricks you can do with the TinyOS 1.x STM25P BlockStorage
implementation to get it to write to multiple sectors and erase individual
sectors:

1. Define each volume as taking up exactly one sector: i.e. sector 0 ==
volume 0, sector 1 == volume 1, etc.  Format the flash like that.
2. Upon boot, mount to volume 0.  You can now read/write any address on the
flash even if the address is located in another volume.
3. When you want to erase a sector do this:  mount() to its volume id,
erase() it, and mount back to volume 0 to keep the address scheme
consistent.  I noticed that either after the call to erase() or mount(0) is
complete, I needed to post my next command in a task or call a Timer to get
the application going again.  Otherwise, my app would be mounted to the
wrong volume and my address scheme would be messed up.  You'll have to
experiment around to get it going.

If you're not using it already, I recommend trying to use the FlashViewer
(not FlashBridgeViewer) application located in TinyOS 1.x CVS under
contrib/rincon/apps/FlashViewer to test out the behavior of the STM25P
BlockStorage implementation.  This will let you see what's going on inside
the flash on your computer, and figure out how the BlockStorage
implementation works.

When you erase, it's going to take 1 second per sector, which is a lot of
time.  But if you only need to store 700kB, you should be able to write all
that data without having to erase in the middle.  Just erase every
volume/sector when the mote is booted (if you can do that) and your flash
will be ready to be written.

By the way, you can read, write, OR erase - one at a time.  Don't try to
call any two commands at once, just call a command and wait for its event
(or the call to return the BlockStorage equivalent of fail) before letting
your application access the flash again.

Hope that gives you some ideas,
-David



-----Original Message-----
From: lamiaimeil [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 27, 2006 12:57 AM
To: David Moss
Subject: RE: Question on flash


Hi David,
and thank you very much for your helpful suggestions.
I can't use the RAM (I believe you mean the 10kB of
RAM on MSP430?) because I must mount on tmote sky an accelerometer with
3-axis that sample at 6000Hz so I get 12kB/s (I have a data of 2B for every
axis) and RAM is too small. (My prof. tell me he wants about 700
- 800 KB of memory to store data).
Unfortunately also BlockWrite.erase() don't help me
because it erase all sectors I mount at the same time
and I want choose which sector erase..
I tell you what I've think. I must write data incoming
from accelerometer and after I send them by radio at
base station I must delete the space on eeprom where
they were. A format or an erase delete all memory and
I can't write on it at the same time so I'll lose some
data incoming from accelerometer. But if I don't
format a space of 700kB but i.e. 10 spaces of 70kB
when I fill one of them I can write on the next and at
the same time I can format it (after I send at base
station the data in it).
If this solution works I have a circular buffer (or
no?). In this way can't I read, write or format at the
same time?
Thank you very much for your patience and your help!!
Andrea



> Hi Andrea,
> 
> First, it sounds like you want a storage solution
> like LogStorage.
> Unfortunately, this isn't available in TinyOS 1.x,
> so if you're using
> BlockStorage you'll have to do it manually somehow.
> The best solution would
> be to do this in RAM if possible, since it sounds
> like your storage is
> temporary anyway.
> 
> In BlockStorage, you can erase the volume you're
> mounted to without having
> to format.  So, if you write data to the flash and
> want it erased, just call
> BlockWrite.erase().  From what I recall, you're
> using tmote's, right?  In
> that case, when you call BlockWrite.erase(), the
> sector(s) you're mounted to
> get wiped clean.  The bad part is it takes ~1 second
> to erase a single
> sector, and a lot of energy.  And, if you're erasing
> all the time, you'll
> reach the lifetime of the flash faster so it won't
> last as long.
> 
> If you really wanted to implement it on flash
> instead of RAM, maybe what you
> could do is mount() and erase() the flash when you
> turn on the mote, then
> write your data until the current volume is filled
> by keeping the write
> address and other address bookmarks in RAM (keep in
> mind the last page of
> each sector is reserved in BlockStorage for the
> STM25P tmote flash)  Then,
> once you reach the end of the volume, call
> BlockWrite.erase and start over
> from the beginning.
> 
> Overall, this sounds like a pretty difficult thing
> to do in flash without
> LogStorage available, but it can be done if you have
> a lot of time and
> patience!
> 
> -David

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to