Hi everybody,
I have find a possible bug with recieve interface in tinyOS 2.x
I have 3 sensor nodes, the first one periodically (10 s) sends a frame with
AMType=01. The second one receives the frame with AMType=01 and sends a
frame with AMType=02, it has the following configuration and program:
/*****************************
***********************************************************************/
configuration ApplicazSensor1C { }
implementation
{
components ApplicazSensor1P, MainC, ActiveMessageC, LedsC,
new TimerMilliC(),
new AMSenderC(AM_SENSOR1), new AMReceiverC(AM_RX_OBD);
ApplicazSensor1P.Boot -> MainC;
ApplicazSensor1P.RadioControl -> ActiveMessageC;
ApplicazSensor1P.AMSend -> AMSenderC;
ApplicazSensor1P.Receive -> AMReceiverC;
ApplicazSensor1P.Timer -> TimerMilliC;
ApplicazSensor1P.Leds -> LedsC;
}
/******************************************************************************************************/
/*************SENSOR1.h********************************************/
#ifndef SENSOR1_H
#define SENSOR1_H
enum {
AM_RX_OBD=0X01, //recive with AM_type 01
AM_SENSOR1 = 0x02 //send with AM_type 02
};
/*************************************************************************************/
/***********************PROGRAM**************************************************/
#include "Timer.h"
#include "SENSOR1.h"
module ApplicazSensor1P
{
uses {
interface Boot;
interface SplitControl as RadioControl;
interface AMSend;
interface Receive;
interface Timer<TMilli>;
interface Leds;
}
}
implementation
{
message_t sendbuf;
void report_problem() { call Leds.led0Toggle(); }
void report_sent() { call Leds.led1Toggle(); }
void report_received() { call Leds.led2Toggle(); }
event void Boot.booted() {
if (call RadioControl.start() != SUCCESS)
report_problem();
}
event void RadioControl.startDone(error_t error) {
}
event void RadioControl.stopDone(error_t error) {
}
event message_t* Receive.receive(message_t* msg, void* payload, uint8_t
len) { //recieve frame AM_type 01
report_received();
call Timer.startOneshot(2000); //start timer for sending frame AM_type
02
return msg;
}
event void Timer.fired() {//INIT EVENTO
sendbuf.data[0]=0xff;
call AMSend.send(AM_BROADCAST_ADDR, &sendbuf, 1); //send frame AM_type
02
} //FINE
event void AMSend.sendDone(message_t* msg, error_t error) {
if (error == SUCCESS){ // SE E' STATO SPEDITO CON SUCCESSO
call Leds.led0Toggle();
}
else{report_problem();}
}
}
/********************************************************************************************/
The third node is a sniffer with the program BaseStation furnished by
TinyOS2X.
The base station always sends to the UART the received frame with AMType=01
and rarely the frame with AMType=02, even if the second node always sends
the frame with AMType=02 when it receives the one with AMType=01.
This has been verified with sniffer Integration 802.15.4/Zigbee Dongle.
Can anyone help me to solve this bad behavior?
Thank you,
Adriano
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help