I'm not positive, and David would have to verify, I would imagine that you DON'T want to set the flag -DCC2420_NO_ACKNOWLEDGEMENTS if you set the flag -DPACKET_LINK
Kevin On Mon, Apr 7, 2008 at 1:44 PM, Juan Antonio López Riquelme <[EMAIL PROTECTED]> wrote: > > > Hello, > > Thank David for your answer. > > I have implemented the new version with PacketLink. The messages arrive to > BaseStation, but wasDelivered failed. I know it because before a new > iterarion to read the sensors the program sends a message with three > variables: calls, inputs and dataSendDone. The program adds one to calls > when it call the fuction to send the data, inputs the same when the > execution is inside the function to send data and dataSendDone if > wasDelivery returns true. > > For BaseStation I use this Makefile: > COMPONENT=BaseStationC CFLAGS += -DCC2420_NO_ACKNOWLEDGEMENTS CFLAGS += > -DCC2420_NO_ADDRESS_RECOGNITION CFLAGS+=-DPACKET_LINK include $(MAKERULES) > In the Makefile for remote sensor also I added the flag DPACKET_LINK. The > configuration for remote mote: > #include <Timer.h> #include "HP2.h" configuration HP2AppC{} implementation > { ... components CC2420ActiveMessageC; components new > AMSenderC(AM_MENSAJEDATOS) as EnviarDatos; //Only I use PacketLink with > thsese messages components new AMSenderC(AM_MENSAJEDATO) as EnviarDato; > components new AMSenderC(AM_MENSAJEBATERIA) as EnviarAlarma; components new > AMReceiverC(AM_MENSAJEPERIODO); .. App.Packet -> EnviarDatos; App.AMPacket > -> EnviarDatos; App.EnviarDatos -> EnviarDatos.AMSend; App.EnviarDato -> > EnviarDato.AMSend; App.EnviarAlarma -> EnviarAlarma.AMSend; App.AMControl -> > CC2420ActiveMessageC; App.PacketLink -> CC2420ActiveMessageC; App.Receive -> > AMReceiverC; ... } > > The module: > //In function to send data ... call PacketLink.setRetries(&PaqueteDatos, > 10); call PacketLink.setRetryDelay(&PaqueteDatos, 100); if (call > EnviarDatos.send(0, &PaqueteDatos, sizeof(MensajeDatos)) == SUCCESS) ... > //sendDone event event void EnviarDatos.sendDone(message_t* msg, error_t > error) { if (&PaqueteDatos == msg) { enviarDatosBusy = > FALSE; if (call PacketLink.wasDelivered(msg)) dataSendDone = > dataSendDone + 1; //The value is always the init value (0). > //There is a code below and it runs. } } > > Thanks in advance, > > Juan Antonio. > > > > ----- Original Message ----- > From: David Moss > To: 'Juan Antonio López Riquelme' ; tinyos-help@millennium.berkeley.edu > Sent: Monday, April 07, 2008 8:05 PM > Subject: RE: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2 > > > > > The functionality you're interested in - reliably link layer transmissions - > is included in the CC2420 radio stack in the PacketLink interface. You can > add the PacketLink layer into the radio stack by adding > CFLAGS+=-DPACKET_LINK into your Makefile. In your software, instead of > requesting an acknowledgment, setup a reliable packet transmission through > the PacketLink interface: > > > > call PacketLink.setRetries(&myMsg, 5); > > call PacketLink.setRetryDelay(&myMsg, 0); > > > > This will automatically retry sending the packet 5 times, with no delays > between retransmissions. When you get a sendDone() event back, you can > check to see if the packet was delivered either by calling > PacketAcknowledgments.wasAcked(&myMsg); OR by calling > PacketLink.wasDelivered(&myMsg);. > > > > You are receiving multiple packets at the base station because > acknowledgments are just as unreliable as sending any packet. If an > acknowledgement is dropped and you have to retransmit, then the base station > will receive duplicates. The PacketLink layer, combined with UniqueSend > and UniqueReceive layers in the CC2420 stack, prevent duplicate packet > receptions due to dropped acknowledgments. There is more documentation > here: > http://tinyos.cvs.sourceforge.net/*checkout*/tinyos/tinyos-2.x/doc/html/tep127.html > > > > Finally, there is already a delay built into the send for the acknowledgment > wait period, and you will not get a sendDone() event back until an ack was > received or the ack wait period timed out. > > > > -David > > > > > > > > ________________________________ > > > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Juan > Antonio López Riquelme > Sent: Monday, April 07, 2008 9:33 AM > To: tinyos-help@millennium.berkeley.edu > Subject: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2 > > > > > Hello, > > > > > > I am working with TinyOS 2.0.2 and payload of 29 bytes. Two remotes nodes > send messages to node with BaseStation application. > > > > > > I changed BaseStation program to work with 29 bytes of payload and > acknowledgements. I compiled with address 0. In BaseStationP: > > > > > #include "AM.h" > > #include "Serial.h" > > #define TOSH_DATA_LENGTH 29 //Added line > > The Makefile: > > COMPONENT=BaseStationC > > #CFLAGS += -DCC2420_NO_ACKNOWLEDGEMENTS > > CFLAGS += -DCC2420_NO_ADDRESS_RECOGNITION > > include $(MAKERULES) > > The remote node requests an ack before to send the message: > > call ACK.requestAck(&PaqueteDatos); > > if (call EnviarDatos.send(0, &PaqueteDatos, sizeof(MensajeDatos)) == > SUCCESS) > > And finally the code at sendDone event: event void > EnviarDatos.sendDone(message_t* msg, error_t error) { if (&PaqueteDatos > == msg) { enviarDatosBusy = FALSE; enviados = enviados + > 1; if (!call ACK.wasAcked(msg) && intentos < REINTENTOS) { > intentos = intentos + 1; FuncionEnviarDatos(); } > else { //New iteration with the sensors > intentos = 0; ... } ... } } > > > If the ack failed the program tries to send the message 5 times. At the > computer sometimes I get the same message twice. Can the program requiere a > delay between sendDone is signaled and check the acknowledgement? > > > > > > Thanks, Juan Antonio. > _______________________________________________ > Tinyos-help mailing list > Tinyos-help@millennium.berkeley.edu > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > -- ~Kevin _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help