[Tinyos-help] Problem sending messages with 39 bytes of payload.

Philip Levis pal at cs.stanford.edu
Tue Apr 1 15:34:54 PDT 2008


On Apr 1, 2008, at 2:37 PM, Juan Antonio López Riquelme wrote:
> Hello
>
> I am working with 2.0.2 release of Tinyos. I have two remote nodes  
> and one with BaseStation application. By all programs I have  
> configured the payload to 39 bytes with the line "#define  
> TOSH_DATA_LENGTH 39". To send messages I have a function and one  
> task. When I have all data from one sensor I call the function  
> FunctionSendData, later a delay of 5 seconds before to get the data  
> from the other sensor and finally the program calls the function  
> again.
>
> The computer uses the program TestSerial with some modications from  
> the tutorials.
>
> The nodes sends two messages every minute. Sometimes I have observed  
> that in Cygwin does not appear the message from one sensor (not  
> always the same).
>
> I would like to know if I can have problems with 39 bytes of payload  
> because the default value is 28 or another idea about what is the  
> problem.
>
> Thanks, Juan Antonio.
>
> task void FunctionSendDataTask(){FunctionSendData();}
>
> void FunctionSendData()
>
> {
>
>   uint8_t j;
>
>   uint8_t len;
>
>   atomic if (!enviarDatosBusy)
>
>   {
>
>           MensajeDatos* btrpkt = (MensajeDatos*)(call  
> Packet.getPayload(&PaqueteDatos, NULL));
>
>
>           len = recibidos - 5;
>
>           btrpkt->nodeid = TOS_NODE_ID;
>
>
>           if (sensor0) btrpkt->sensor = 0;
>
>           else btrpkt->sensor = 1;
>
>
>           btrpkt->longitud = len;
>
>           for (j = 0; j < 36; j++)
>
>           {
>
>                   if (!leerDatos) btrpkt->datos[j] = debug[j];
>
>                   else btrpkt->datos[j] = debug[j+5];
>
>           }
>
>           if (call EnviarDatos.send(0, &PaqueteDatos,  
> sizeof(MensajeDatos)) == SUCCESS)
>
>           {
>
>                   enviarDatosBusy = TRUE;
>
>           }
>
>           else post FunctionSendDataTask();
>
>   }
>
>   else post FunctionSendDataTask();
>
> }

I'm not sure if this is the problem, but you should most definitely  
not be calling send from within an atomic section. Please take a look  
at the TinyOS programming manual.

Phil


More information about the Tinyos-help mailing list