Title: Message
There could be several issues here.
 
First, how are you wiring up your component?  You should do something like this:
 
// in a header file, included to your configuration:
enum {
  BLOCKSTORAGE_MYCOMPONENT = unique("BlockStorage"),
}
 
 
// In your configuration:
  MyComponent.Mount -> BlockStorageC.Mount[BLOCKSTORAGE_MYCOMPONENT];
  MyComponent.BlockWrite -> BlockStorageC.BlockWrite[BLOCKSTORAGE_MYCOMPONENT];
  MyComponent.BlockRead -> BlockStorageC.BlockRead[BLOCKSTORAGE_MYCOMPONENT];
 
 
Without doing it this way, your components may be accessing separate or invalid parameterized interfaces to the BlockStorage interface.  That means when you do a Mount, you'd be mounting only one of the 3 parameterized interfaces.  Then when you're trying to write, you'd be writing to a different parameterized interface than the one that's mounted.  Defining only one unique("BlockStorage") interface and then using that one throughout your component is the only way to do it.
 
Finally, keep in mind the parameters to the command are BlockWrite.write(uint32_t addr, void *buf, uint32_t len).  So your code should be looking something like:
 
// Define a buffer, we'll make it a page long
uint8_t myBuffer[256];
 
// After your mount gets done...
event void Mount.mountDone(...)  {
  // now you can interact with BlockStorage
  // write 10 bytes from myBuffer into flash starting at address 0x0:
  call BlockWrite.write(0x0, &myBuffer, 10);
}
 
event void BlockWrite.writeDone(...) {
  // Tada, your data exists on flash
}
 
-David
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Raja Jurdak
Sent: Friday, March 10, 2006 1:36 PM
To: [email protected]
Subject: [Tinyos-help] blockwrite.write command with Tmote invent

Hi,
 
I am new to mote flash programming. I am trying to write a simple application that writes some data to the mote external flash. I have followed the mailing list examples for formatting a volume on flash first with Format.nc, then mounting the volume, and I verified that the mountdone event returned STORAGE_OK. When I try to write data into flash using the command:
 

call BlockWrite.write(0, p,STORAGE_BLOCK_SIZE);

where p indicates the address of the buffer to be written to flash memory, the write operation returns a FAIL. I know that there is something I am missing with with the write command, perhaps with the block address, and I would really appreciate any help in resolving this issue.

Thanks in advance,

--Raja

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

Reply via email to