[Tinyos-help] A possible bug in BaseStation application, TinyOS 2.1.0
Dongzhen Piao
parkurm at gmail.com
Fri Jun 19 13:24:03 PDT 2009
I'm using CC1000 radio module. Here's what I found in CC1000SendReceiveP.nc
file:
Starting from line 629 >>
/* Abstract packet layout */
command void Packet.clear(message_t *msg) {
memset(msg, 0, sizeof(message_t));
}
<<
So I guess this 'memset' function is clearing everything.
On Thu, Jun 18, 2009 at 10:47 AM, Janos Sallai
<sallai at isis.vanderbilt.edu>wrote:
> Packet.clear() does not clear the packet payload, only the control
> fields. Your problem was probably something else.
>
> What platform do you use?
>
> Janos
>
> On Thu, Jun 18, 2009 at 12:58 AM, Dongzhen Piao<parkurm at gmail.com> wrote:
> > Hi all,
> >
> > I was writing a simple program to send commands from a base station to
> > sensor motes. I defined several fields in the command packet, and set
> them
> > to predefined command value before sending the packet.
> >
> > But when the sensor motes received the command message, all the fields
> are
> > 0. After a long period of debugging, I finally found that the problem
> > happens in the standard BaseStation application shipped with TinyOS
> 2.1.0.
> >
> > Here's the function in BaseStationP.nc file, where the problem occurs:
> >
> > 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();
> > }
> > }
> >
> > In the line bolded, the function clears all fields in the packet received
> > from UART, and forwards it to the radio. The behaviour is strangely set
> to
> > clear the packet, which is not desirable in such a "bridging"
> application.
> >
> > After commenting out the line, my program worked just fine.
> >
> > Does anybody have some idea about this? Is this a bug, or is this some
> > behaviour desired by the application author?
> >
> > Thanks.
> >
> > Dongzhen Piao
> >
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > Tinyos-help at millennium.berkeley.edu
> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20090619/1126e059/attachment.htm
More information about the Tinyos-help
mailing list