At a quick glance, I didn't see how you write the data to flash. Are you
sure there are more than one packet of data? Mostly the reason for
inexistent data is forgetting to flush the flash buffer, which actually
burns the data to flash.
 
Regards,
 
    Harri

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Thusitha Bandara
Sent: Friday, March 23, 2007 1:54 PM
To: [email protected]
Subject: [Tinyos-help] Please Help Me to Continuously READ DATA FROM
theEEPROM




Hi Hunkeler,
 
    Yes. Your understanding is correct. This is a part of the protocol
which i am going to implement. So it needs to communicate with the Base
Station, before it broadcast its packets. So in my application:
 
*    First Sense the Sensor Data and store them in the EEPROM as a
Packet. 
*    When it over the Sensing (Say 16 Time), It broadcast a request
Message to ask     for its data             Transfer. 
*    When the base Station confirms the request, it broadcast the
confirmation.
*    When the Mote recieve the confirmation: It should send all its
stored data continuously.
*     But the problem is that it just send the first data packet always.
Like:
 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

........................................................................
    But i want it to send the data packets one by one in its EEPROM.
Like:
 

FF FF 09 7D 12 01 00 F5 03 F4 03 F7 03 EE 03 F0 03 EC 03 E9 03 F2 03 

FF FF 09 7D 12 01 00 E0 03 E4 03 E6 03 E6 03 F5 03 E7 03 EE 03 E7 03 

FF FF 09 7D 12 01 00 EE 03 ED 03 ED 03 ED 03 EC 03 EC 03 EC 03 E8 03 

FF FF 09 7D 12 01 00 ED 03 F0 03 E9 03 E7 03 E6 03 E2 03 DD 03 D9 03 

FF FF 09 7D 12 01 00 69 03 63 03 52 03 49 03 3A 03 34 03 33 03 24 03 

FF FF 09 7D 12 01 00 DE 02 DF 02 D4 02 2F 03 21 03 23 03 05 03 08 03 

FF FF 09 7D 12 01 00 ED 03 EB 03 EB 03 EA 03 C7 03 C1 03 E6 03 E9 03 

FF FF 09 7D 12 01 00 CB 12 83 42 69 21 9A 50 04 27 00 92 10 06 03 82 

 

The following Code does the above communication scenario and attempt to
send the stored data. 
 
*    I can sure that my module correctly write to the EEPROM. Because it
reads correctly, when i programm this application to execute without
that request-confirmation thing.
 
1) So can you please analyse this code and say, what would be the
problem??
        or
2) Is there any special procedure to follow when we want to make EEPROM
READ Continuously?
        or
3) Is there any special procedure to follow when we want to broadcast
several packets continuously in a short interval of time??
 
I really need yours help.
Please help me to resolve them.
 
Regards,
Bandara.
 
    

// $Id: SimpleCmdM.nc,v 1.2 2003/10/07 21:44:59 idgay Exp $

includes SimpleCmdMsg;

module SimpleCmdM { 

provides { 

interface StdControl;

interface ProcessCmd; 

interface Reading; 

}

uses {

interface Leds;

interface ReceiveMsg as ReceiveCmdMsg;

interface StdControl as CommControl;

interface StdControl as RequestCommControl;

interface StdControl as SounderControl;

interface LoggerRead;

interface SendMsg as SendLogMsg;

interface ReceiveMsg as RequestReceiveMsg;

interface SendMsg as RequestSendMsg;

interface Sensing;

}

}

implementation 

{

// declare module static variables here

TOS_MsgPtr cur_msg; // The current command message

TOS_Msg log_msg , request_msg; // The current log message

bool send_pending; // TRUE if a message send is pending

bool eeprom_read_pending; // TRUE if an EEPROM read is pending

TOS_Msg buf; // Free buffer for message reception

uint16_t num;

bool request_send_pending;

 

task void cmdInterpret() {

result_t status = SUCCESS;

if(!eeprom_read_pending){

if (call LoggerRead.readNext(((struct LogMsg *)log_msg.data)->log)) {

call Leds.yellowOn();

eeprom_read_pending = TRUE;

}

}

 

signal ProcessCmd.done(cur_msg, status);

}

 

task void cmdInterpretRepeat() {

if(!eeprom_read_pending){

call SounderControl.start();

if (call LoggerRead.readNext(((struct LogMsg *)log_msg.data)->log)) {

eeprom_read_pending = TRUE;

}

}

}

 

task void RequestConfirm()

{

struct RequestMsg *request = (struct RequestMsg * )request_msg.data;

result_t status = FAIL;

if(!request_send_pending)

{

/**

uint16_t sourceMoteID; uint8_t type; uint8_t sendDone;

uint16_t packetNumber; uint8_t noOfPackets; uint16_t npackets; 

uint16_t token; uint8_t confirm; uint8_t channel; 

**/

atomic{

request->sourceMoteID = TOS_LOCAL_ADDRESS;

}

request->type = 0;

request->sendDone = 0;

request->packetNumber = 0;

request->noOfPackets = 0;

request->npackets = 0;

request->token = 0;

request->confirm = 0;

request->channel = 0;

if(call RequestSendMsg.send(TOS_BCAST_ADDR , (sizeof(struct RequestMsg))
, &request_msg))

{

request_send_pending = TRUE;

status = SUCCESS; 

}

}

}

 

 

command result_t StdControl.init() {

cur_msg = &buf;

send_pending = FALSE;

eeprom_read_pending = FALSE;

request_send_pending = FALSE; 

num = 30;

return rcombine(call CommControl.init(), call Leds.init());

}

command result_t StdControl.start(){

call Sensing.start(256, 500);

return SUCCESS;

}

command result_t StdControl.stop(){

return SUCCESS;

} 

 

command result_t ProcessCmd.execute(TOS_MsgPtr pmsg) {

signal Reading.done();

post cmdInterpret();

return SUCCESS;

}

 

command result_t Reading.start(){

TOS_MsgPtr pmsg;

result_t retval;

retval = call ProcessCmd.execute(pmsg);

if (retval==SUCCESS) {

return retval;

} 

return SUCCESS; 

}

 

 

event result_t LoggerRead.readDone(uint8_t * packet, result_t success) {

result_t retval;

// Send message only if read was successful 

struct LogMsg *lm;

num--;

if (success && eeprom_read_pending && !send_pending) {

lm = (struct LogMsg *)(log_msg.data);

lm->sourceaddr = TOS_LOCAL_ADDRESS;

eeprom_read_pending = FALSE;

if (call SendLogMsg.send(TOS_BCAST_ADDR, sizeof(struct LogMsg),
&log_msg)) {

call Leds.redOn();

send_pending = TRUE;

if(num>0){

call Reading.start();

}

}

}

eeprom_read_pending = FALSE;

call Leds.yellowOff();

return SUCCESS;

}

 

event TOS_MsgPtr ReceiveCmdMsg.receive(TOS_MsgPtr pmsg){

result_t retval;

TOS_MsgPtr ret = cur_msg;

call Leds.greenToggle();

retval = call ProcessCmd.execute(pmsg);

if (retval==SUCCESS) {

return ret;

} else {

return pmsg;

}

}

 

event TOS_MsgPtr RequestReceiveMsg.receive(TOS_MsgPtr pmsg){

struct RequestMsg *rmsg=(struct RequestMsg *)pmsg->data;

 

if(rmsg->confirm == TOS_LOCAL_ADDRESS)

{

//call ProcessRead.readEEPROM(no_of_packets_to_read);

call Reading.start();

}

return pmsg; 

}

 

event result_t SendLogMsg.sendDone(TOS_MsgPtr pmsg, result_t status) {

send_pending = FALSE;

//call Reading.start();

return SUCCESS;

}

event result_t RequestSendMsg.sendDone(TOS_MsgPtr pmsg, result_t status)
{

request_send_pending = FALSE;

return SUCCESS;

}

 

default event result_t ProcessCmd.done(TOS_MsgPtr pmsg, result_t status)
{

return status;

} 

default event result_t Reading.done() {

return SUCCESS;

} 

event result_t Sensing.done() {

post RequestConfirm();

 

return SUCCESS;

}

 

 

} // end of implementation





________________________________

Don't pick lemons.
See all the new 2007 cars
<http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE0OGRsc3F2BF9TAzk3MTA3M
Dc2BHNlYwNtYWlsdGFncwRzbGsDbmV3Y2Fycw-->  at Yahoo! Autos.
<http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE0OGRsc3F2BF9TAzk3MTA3M
Dc2BHNlYwNtYWlsdGFncwRzbGsDbmV3Y2Fycw--> 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to