hi,
I want to write whole flash and then want to verify by reading. but, I am
not able to read perfectly. i tried to write(256 bytes each time) whole
flash recursively and after ultimate write, it started to read similar way.
I found that only 1sr reading gives 256 bytes acurate data. but, later
reading gives +-55 bytes data. I dont understand why later readings are
coming partially. I got the same result using Listen tool. please, someone
clarify me so that i can write and read whole flash. My configuration and
code used are mentioned below:
Mote type: TelosbB,
Flash: ST M25P80


uint32_t Waddr=0x00000, Raddr=0x00000;
event void Boot.booted() {
      call SerialControl.start();
}

event void SerialControl.startDone(error_t e) {
    call BlockWrite.erase();
}

event void BlockWrite.eraseDone(error_t result) {
   nextWrite();
}

event void BlockWrite.writeDone(storage_addr_t x, void* buf, storage_len_t
y, error_t result) __attribute__((noinline)) {
      if(writeCount ==  5)   // [lets try to make 5 successful consecutive
write/read]
           readNext();
      else
          writeNext();
}

event void BlockRead.readDone(storage_addr_t x, void* buf, storage_len_t
rlen, error_t result) __attribute__((noinline)) {
    printf(buf);
    printfflush();
    if(readCount !=  5)
         readNext();
}

void nextWrite(){
     call BlockWrite.write(Waddr, &myString, sizeof(myString)));
     Waddr = Waddr + 0x00100;
     writeCount++;
}

void nextRead(){
     call BlockRead.read(Raddr, &readBuffer, sizeof(readBuffer));
     Raddr = Raddr + 0x00100;
     readCount++;
}


pls ask me if you want more info. waiting for your reply

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

Reply via email to