Re: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2
I was also thinking that the CC2420_NO_ACKNOWLEDGMENTS flags was wrong, but I have another question about another flag: CC2420_HW_ACKNOWLEDGEMENTS What happens in this case? What is the difference with software acks? Inviato da Yahoo! Mail. La casella di posta intelligente. http://it.docs.yahoo.com/mail/overview/index.html___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
Re: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2
Hello David and Kevin, More thanks. It is ok. I had BaseStation reciving packets every minute for two hours and it does not lose anything message. Now, the next step, low power listening. A greeting, Juan Antonio. - Original Message - From: David Moss To: 'Juan Antonio López Riquelme' ; tinyos-help@millennium.berkeley.edu Sent: Monday, April 07, 2008 11:10 PM Subject: RE: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2 Hi Juan - According to your BaseStation makefile, you are disabling acknowledgments at the base station. This would cause PacketLink to fail because PacketLink requires the destination node to send back an acknowledgment. Remove the CC2420_NO_ACKNOWLEDGMENTS line from the BaseStation Makefile and recompile. -David ___ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
RE: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2
The functionality youre 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/tep1 27.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
Re: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2
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
RE: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2
Hi Juan According to your BaseStation makefile, you are disabling acknowledgments at the base station. This would cause PacketLink to fail because PacketLink requires the destination node to send back an acknowledgment. Remove the CC2420_NO_ACKNOWLEDGMENTS line from the BaseStation Makefile and recompile. -David _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Juan Antonio López Riquelme Sent: Monday, April 07, 2008 1:45 PM To: tinyos-help@millennium.berkeley.edu Subject: Re: [Tinyos-help] Problems with ACKs in TinyOS 2.0.2 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 mailto:[EMAIL PROTECTED] To: 'Juan mailto:[EMAIL PROTECTED] 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 youre 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/tep1 27.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