[Tinyos-devel] BaseStation clears packet payload on mica2

Andreas Köpke koepke at tkn.tu-berlin.de
Tue Jul 29 03:44:36 PDT 2008


The micaz is right -- the change in the meaning of "clear" was agreed
some time ago. But it seems that the new meaning is not implemented
everywhere...

Am Dienstag, den 29.07.2008, 10:26 +0200 schrieb Philipp Sommer:
> We observed a problem when using the BaseStation application on the
> mica2 platform. The current implementation (from CVS) clears the packet
> payload (setting it to all zeros) when packets are bridged between the
> radio and the UART.
> 
> The problem seems to arise from a call to the Packet.clear() method
> which is implemented differently for mica2. On the mica2 platform
> (CC1000SendReceiveP.nc) the whole message_t struct is cleared whereas
> on the micaz platform (CC2420ActiveMessageP.nc) only the header and the
> metadata fields are cleared (see code snippets below). 
> 
> Removing the call to Packet.clear() in BaseStationP.nc seems to solve
> the problem with the empty packet payload on the mica2 platform.
> However, this quick fix might possibly lead to problems on other
> platforms.
> 
> Philipp
> 
> 
> Here are the relevant code snippets:
> 
> 
> tos/chips/cc1000/CC1000SendReceiveP.nc:
> ***************************************************************
> command void Packet.clear(message_t *msg) {
>   memset(msg, 0, sizeof(message_t));
> }
> 
> 
> tos/chips/cc2420/CC2420ActiveMessageP.nc:
> ***************************************************************
> command void Packet.clear(message_t* msg) {
>   memset(call CC2420PacketBody.getHeader(msg), 0x0,
> sizeof(cc2420_header_t));
>   memset(call CC2420PacketBody.getMetadata(msg), 0x0,
> sizeof(cc2420_metadata_t));
> }
> 
> 
> tos/apps/BaseStation/BaseStationP.nc:
> ***************************************************************
> 
> task void radioSendTask() {
>     uint8_t len;
>     am_id_t id;
>     am_addr_t addr,source;
>     message_t* msg;
>     
>     atomic
>       if (radioIn == radioOut && !radioFull)
> 	{
> 	  radioBusy = FALSE;
> 	  return;
> 	}
> 
>     msg = radioQueue[radioOut];
>     len = call UartPacket.payloadLength(msg);
>     addr = call UartAMPacket.destination(msg);
>     source = call UartAMPacket.source(msg);
>     id = call UartAMPacket.type(msg);
> 
>     call RadioPacket.clear(msg);
>     call RadioAMPacket.setSource(msg, source);
>     
>     if (call RadioSend.send[id](addr, msg, len) == SUCCESS)
>       call Leds.led0Toggle();
>     else
>       {
> 	failBlink();
> 	post radioSendTask();
>       }
>   }
> 
> 
> _______________________________________________
> Tinyos-devel mailing list
> Tinyos-devel at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel



More information about the Tinyos-devel mailing list