Daniel, Yep - this is expected. It's a characteristic of NOR (and NAND) flash. Writing to the flash only makes 1 bits go to 0's. Erases make 0's go to 1's - but you have to erase in huge blocks (65536 byte sectors at a time on the tmote's st m25p80 flash).
This characteristics is sometimes a mental hurdle for developers to get past. How you use the flash, because of this, will depend greatly on your application requirements. Typically, if the flash is a one time use thing, you can get away with erasing the sector you want to write to, write to it, and then don't touch it again. This is the strategy BlockStorage takes. A different strategy would be to somehow locate the next write address in flash and keep appending data from there. Deleted data just gets marked deleted, and not actually erased (by writing over the top of an already written magic number somewhere on flash). This would be more how a file system handles things, like the Blackbook file system. If you're interested in more details on that second strategy, I can offer you advice. But the trick is basically keep appending data. Doing this automatically implements wear-leveling too, so your flash lasts longer. -David -----Original Message----- From: Daniel S. Menasche [mailto:[EMAIL PROTECTED] Sent: Sunday, October 08, 2006 7:18 PM To: [EMAIL PROTECTED] Subject: flashbridgeviewer Dear David, My name is Daniel and I'm working with the flashbridge module with a telosb (tmote sky). However, I'm finding out some very strange problems. For instance, after I run the FlashViewer application 2 or 3 times I get errors like the following: [EMAIL PROTECTED]:/nfs/copa/tmp1/tinyos-1.x/contrib/rincon/tools/java$ java com.rincon.flashviewer.FlashViewer -write 0 hellohellohello123 Writing data 0x68 0x65 0x6c 0x6c 0x6f 0x68 0x65 0x6c 0x6c 0x6f 0x68 0x65 0x6c 0x6c 0x6f 0x31 0x32 0x33 SUCCESS: 18 bytes written to 0x0 [EMAIL PROTECTED]:/nfs/copa/tmp1/tinyos-1.x/contrib/rincon/tools/java$ java com.rincon.flashviewer.FlashViewer -read 0 32 0x0 to 0x20 _________________________________________________ 68 65 6C 6C 6F 68 65 6C 6C 6F 68 65 6C 6C 6F 31 | hellohel lohello12 32 33 FF FF FF FF FF FF FF FF FF FF FF FF FF FF | 3ÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿ [EMAIL PROTECTED]:/nfs/copa/tmp1/tinyos-1.x/contrib/rincon/tools/java$ java com.rincon.flashviewer.FlashViewer -write 0 abcabcabcabcdef Writing data 0x61 0x62 0x63 0x61 0x62 0x63 0x61 0x62 0x63 0x61 0x62 0x63 0x64 0x65 0x66 SUCCESS: 15 bytes written to 0x0 [EMAIL PROTECTED]:/nfs/copa/tmp1/tinyos-1.x/contrib/rincon/tools/java$ java com.rincon.flashviewer.FlashViewer -read 0 32 0x0 to 0x20 _________________________________________________ 60 60 60 60 62 60 61 60 60 61 60 61 64 64 66 31 | ````b`a` `a`addf12 32 33 FF FF FF FF FF FF FF FF FF FF FF FF FF FF | 3ÿÿÿÿÿÿ ÿÿÿÿÿÿÿÿ The last write operation was corrupted! Do you know what may be the source of this kind of problem? More generally: what's the best way of accessing the flash memory of tmote (for reading and writing) using TinyOs 1.x? Thanks a lot! Best regards, Daniel _______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
