[Tinyos-help] GenericComm SimpleCmd UART.
Phani Kumar Arava
arava at cse.ohio-state.edu
Tue Nov 28 15:12:07 PST 2006
Exactly,
Now my question is why isnt this symmetric? Why should i send TOS_BCAST_ADDR
or NODE_ID when i receive the message from the UART ?
Anyone can throw light on the reason ?
On 11/28/06, Michael Schippling <schip at santafe.edu> wrote:
>
> Oh, I think I get it now...
>
> When sending from the PC, use the destination node ID, or BCAST, as the
> TOS_Msg.addr. It's not symmetric with the GenericComm usage, but since
> there is only one serial port of interest this PC side kludge allows
> you to send to specific destination motes when using TOSBase. Again my
> code has examples of Java code on the host side which may make sense.
>
> MS
>
> Phani Kumar Arava wrote:
> > Maybe, I was unclear in my previuos mail. I was trying to send messages
> > from the PC to the mote, trying to send commands to the mote, for
> > example LEDS_ON .Similar to SimpleCmd, but just using UART.
> >
> > I was trying to do this, but was not successful, so started debuggin and
> > found the same results, the issue here was in AMStandard.nc where
> > UARTRecv.receive was saying
> >
> > event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr packet) {
> > // A serial cable is not a shared medium and does not need group-id
> > // filtering
> > packet->group = TOS_AM_GROUP;
> > return received(packet);
> > }
> >
> >
> > and the received function here says.
> >
> >
> > TOS_MsgPtr received(TOS_MsgPtr packet) __attribute__ ((C, spontaneous))
> {
> > uint16_t addr = TOS_LOCAL_ADDRESS;
> > counter++;
> > dbg(DBG_AM, "AM_address = %hx, %hhx; counter:%i \n ", packet->addr,
> > packet->type, (int)counter);
> >
> > if (packet->crc == 1 && // Uncomment this line to check crcs
> > packet->group == TOS_AM_GROUP &&
> > (packet->addr == TOS_BCAST_ADDR ||
> > packet->addr == addr))
> > {
> >
> > uint8_t type = packet->type;
> > TOS_MsgPtr tmp;
> > // Debugging output
> > dbg(DBG_AM, "Received message:\n\t");
> > dbgPacket(packet);
> > dbg(DBG_AM, "AM_type = %d\n", type);
> >
> > // dispatch message
> > tmp = signal ReceiveMsg.receive[type](packet);
> > if (tmp)
> > packet = tmp;
> > }
> > return packet;
> > }
> >
> >
> > The problem here Iam pointing to is with the UART.Lets say Iam sending
> > something into the mote using SerialForwarder, with TOS_UART_ADDR ,
> > will that raise the signal ReceiveMsg.receive ?
> >
> > I think it will not.
> >
> > So to get my stuff running, I modified the code of receive to be like
> >
> > event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr packet) {
> > uint16_t addr = TOS_LOCAL_ADDRESS;
> > // A serial cable is not a shared medium and does not need group-id
> > // filtering
> > packet->group = TOS_AM_GROUP;
> > packet->addr =TOS_LOCAL_ADDRESS;
> > return received(packet);
> > }
> >
> > Now Iam able to receive the commands from the C, But iam not sure
> > whether is the right way the TINYOS people meant it to be like.
> >
> >
> > On 11/28/06, *Michael Schippling* <schip at santafe.edu
> > <mailto:schip at santafe.edu>> wrote:
> >
> > This is all T1 stuff...
> >
> > I'm not entirely clear on what you are doing or asking since the
> > question is about send and you have some snippets of receive code...
> >
> > In general you can send to the serial port using TOS_UART_ADDR ala:
> > call RStatusMsg.send( TOS_UART_ADDR, sizeof(RoboStatusMsg),
> > statmsgp );
> >
> > If you have another mote on the other end of the serial line, then
> you
> > should be able to get GenericComm messages from radio or uart using
> the
> > standard message configuration techniques to wire to your method,
> like:
> > event TOS_MsgPtr RCmdStartMsg.receive(TOS_MsgPtr m) { }
> >
> > There are some convoluted comm examples in my code at:
> > http://www.etantdonnes.com/Motes/robocode.tar.gz
> >
> > MS
> >
> > Phani Kumar Arava wrote:
> > > I was trying to write a Command Interface to my mote. Iam not
> sure
> > > whether this is a bug, (Or maybe iam using the wrong component
> > for UART
> > > communication)
> > >
> > > But when I send some message to my mote using GenericComm (or
> > anything
> > > using AMStandard)
> > >
> > > event TOS_MsgPtr UARTReceive.receive(TOS_MsgPtr packet) {
> > > // A serial cable is not a shared medium and does not need
> > group-id
> > > // filtering
> > > packet->group = TOS_AM_GROUP;
> > > return received(packet);
> > > }
> > >
> > >
> > > In AMStandard received.
> > >
> > > if (packet->crc == 1 && // Uncomment this line to check crcs
> > > packet->group == TOS_AM_GROUP &&
> > > (packet->addr == TOS_BCAST_ADDR ||
> > > packet->addr == addr) )
> > >
> > > Isnt this a problem with TOS_UART_ADDR . I mean the message that
> is
> > > communicated through UART, does not indicate a signal to the
> event
> > > received. that means if Iam sending anything through UART with my
> > > messages, it doesnt signal anything?
> > >
> > > Is that the architecture of TinyOS always meant that the packet
> sent
> > > through UART always meant to be TOS_LOCAL_ADDR ?
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Phani Kumar Arava
> > > Grad Student 1560
> > > Worthington Street
> > > Department Of Computer Science Columbus Ohio 43201
> > > 2015 Neil Avenue
> > > Ohio State University
> > > Columbus Ohio-43210
> > >
> > > Contact: (614)-286-2618
> > > URL : www.cse.ohio-state.edu/~arava/
> > <http://www.cse.ohio-state.edu/~arava/>
> > <http://www.cse.ohio-state.edu/~arava/>
> > > mailto: arava.3 at osu.edu <mailto:arava.3 at osu.edu> <mailto:
> > arava.3 at osu.edu <mailto:arava.3 at osu.edu>>,phani.arava at gmail.com
> > <mailto:phani.arava at gmail.com>
> > > <mailto:phani.arava at gmail.com <mailto:phani.arava at gmail.com>>,
> > arava_phani at yahoo.com <mailto:arava_phani at yahoo.com>
> > > <mailto:arava_phani at yahoo.com <mailto:arava_phani at yahoo.com>>
> > >
> > >
> > >
> >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > Tinyos-help mailing list
> > > Tinyos-help at Millennium.Berkeley.EDU
> > <mailto:Tinyos-help at Millennium.Berkeley.EDU>
> > >
> >
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
> >
> >
> >
> > --
> > Phani Kumar Arava
> > Grad Student 1560
> > Worthington Street
> > Department Of Computer Science Columbus Ohio 43201
> > 2015 Neil Avenue
> > Ohio State University
> > Columbus Ohio-43210
> >
> > Contact: (614)-286-2618
> > URL : www.cse.ohio-state.edu/~arava/ <
> http://www.cse.ohio-state.edu/~arava/>
> > mailto: arava.3 at osu.edu <mailto:arava.3 at osu.edu>,phani.arava at gmail.com
> > <mailto:phani.arava at gmail.com>, arava_phani at yahoo.com
> > <mailto:arava_phani at yahoo.com>
>
>
--
Phani Kumar Arava
Grad Student 1560 Worthington
Street
Department Of Computer Science Columbus Ohio 43201
2015 Neil Avenue
Ohio State University
Columbus Ohio-43210
Contact: (614)-286-2618
URL : www.cse.ohio-state.edu/~arava/
mailto: arava.3 at osu.edu,phani.arava at gmail.com, arava_phani at yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20061128/be5c0394/attachment.htm
More information about the Tinyos-help
mailing list