Thank you Michael…

I appreciate your help …

 .

 

Regarding the middleman.. I have peevishly cutoff the serial forwarder and I  used my own C# application but I couldn’t calculate the CRC, therefore I faced many problems.

So I want to use serial forwarder  I guess that .. I shouldn’t calculate the CRC.

 

Regarding the actual message I am using to generate it the BcastInject .

 

Also I update the code to the below one, and tested it but nothing worked.. exactly I removed the two lines

call SendMsg.send(TOS_UART_ADDR, sizeof(*m),m);

call Leds.greenToggle();

from it .

 

//sendreceive.nc

configuration sendreceive { }

implementation

{

components Main, sendreceiveM, LedsC, UARTComm as Comm;

Main.StdControl -> sendreceiveM;

sendreceiveM.Leds -> LedsC;

sendreceiveM.CommControl -> Comm;

sendreceiveM.ReceiveMsg -> Comm.ReceiveMsg[32];

sendreceiveM.SendMsg -> Comm.SendMsg[10];

}

 

 

//sendreceiveM.nc

module sendreceiveM{

provides interface StdControl;

uses {

interface Leds;

interface StdControl as CommControl;

interface SendMsg;

interface ReceiveMsg;

}

}

implementation

{

command result_t StdControl.init() {

call Leds.init();

call CommControl.init();

return SUCCESS;

}

command result_t StdControl.start() {

call CommControl.start();

return SUCCESS;

}

command result_t StdControl.stop() {

call CommControl.stop();

return SUCCESS;

}

event result_t SendMsg.sendDone(TOS_MsgPtr sent, result_t success) {

return SUCCESS;

}

event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m) {

call Leds.redToggle();

 

return m;

}

}

 



----- Original Message -----
From: Michael Schippling <[EMAIL PROTECTED]>
Date: Monday, December 10, 2007 9:50 am
Subject: Re: [Tinyos-help] message using UART

> There are a few problems with your use of send(), but you should still
> receive a message and toggle the Leds. 1) you need to specify
> the size
> of the payload, not the size of the whole TOS_Msg, 2) when receive()
> returns the message pointer, it may be freed or overwritten
> before it
> can be resent so you should copy it before send()ing, 3) I'm hesitant
> to call send() from an event so I always post a new task to do it.
>
> What are you using to generate the actual message?
> If the CRC is not calculated correctly it may be dropped.
>
> Also you can cut out the SerialForwarder middleman and just use
> you message
> send program and/or Listen to talk directly to the serial port.
>
> For an example of something that works, sort of like what you
> want but is
> probably more complicated than necessary, see my old code:
> http://www.etantdonnes.com/Motes/robocode.tar.gz
>
> MS
>
> [EMAIL PROTECTED] wrote:
> > i have write the following small program (with name
> sendreceive) that i
> > expect work like this:
> > 1- send a packet from SerialForwarder to a directly connected
> mote
> > (micaz) via serial port (COM,mib510)
> > 2- the micaz response by toggling the red led on it
> > 3- then resend the same packet back to the SerialForwarder
> > 4- and toggle the green led
> >
> > i bush a all 1s data packet with destination address of "FF"
> and handler
> > ID of "0A"
> > but there is no response at all
> > it neither toggle red nor green led and no packet returned to
> > SerialForwarder
> >
> > please help
> >
> >
> > //sendreceive.nc
> > configuration sendreceive { }
> > implementation
> > {
> > components Main, sendreceiveM, LedsC, UARTComm as Comm;
> > Main.StdControl -> sendreceiveM;
> > sendreceiveM.Leds -> LedsC;
> > sendreceiveM.CommControl -> Comm;
> > sendreceiveM.ReceiveMsg -> Comm.ReceiveMsg[32];
> > sendreceiveM.SendMsg -> Comm.SendMsg[10];
> > }
> >
> >
> > //sendreceiveM.nc
> > module sendreceiveM{
> > provides interface StdControl;
> > uses {
> > interface Leds;
> > interface StdControl as CommControl;
> > interface SendMsg;
> > interface ReceiveMsg;
> > }
> > }
> > implementation
> > {
> > command result_t StdControl.init() {
> > call Leds.init();
> > call CommControl.init();
> > return SUCCESS;
> > }
> > command result_t StdControl.start() {
> > call CommControl.start();
> > return SUCCESS;
> > }
> > command result_t StdControl.stop() {
> > call CommControl.stop();
> > return SUCCESS;
> > }
> > event result_t SendMsg.sendDone(TOS_MsgPtr sent, result_t
> success) {
> > call Leds.greenToggle();
> > return SUCCESS;
> > }
> > event TOS_MsgPtr ReceiveMsg.receive(TOS_MsgPtr m) {
> > call Leds.redToggle();
> > call SendMsg.send(TOS_UART_ADDR, sizeof(*m),m);
> > return m;
> > }
> > }
> >
> >
> > ---------------------------------------------------------------
> ---------
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> > https://www.millennium.berkeley.edu/cgi-
> bin/mailman/listinfo/tinyos-help
>
> --
> Platform: WinXP/Cygwin
> TinyOS version: 1.x, Boomerang
> Programmer: MIB510
> Device(s): Mica2, MicaZ, Tmote
> Sensor board: homebrew
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to