Hi Saul,

 

There is a program called  "Bray's terminal", google it and download.. Try to 
catch your data on this, it is a really good Serial reader, whatever is coming 
on your COM ports, will be displayed there.....   so if you are getting the 
correct packet on Bray's terminal then we can be sure that there is something 
wrong at java end or your TinyOS serial communication settings.

 

What I can see from your 0utput is that you seem may be getting the data, I 
used to get "bad packets" with my platform in TESTNETWORK Application when the 
baudrate for my platform was 19200bps, since I have increased the Baudrate to 
57600bps, I have not had any problems. I have been doing extensive testing with 
moteàPC and PC-àmote testing with this baudrate. Since your baudrate is already 
set to 57600bps, you can try to increase the baudrate to 115200bps... OFF LATE 
there has been extensive discussion within TinyOS czars regarding what is the 
appropriate serial communication baudrate. 

 

MAY BE Dr.Phil or Martin Turon can shed some light on how to remove the bad 
packets in IRIS.

 

Search on the archives about "serial bad packets" and maybe you can get info 
there. My platform has an atmega128 and it seems to work fine at 57600bps. For 
changing your platform to 115200bps, you need to change certain files. One 
quick thing, how fast is your incoming data?? I WOULD ALSO SUGGEST that 
FIRSTLY, you should try doing the "TestSerial" application given in 
/apps/tests/........ here you try doing "java TestSerial" in this application, 
if this is working, then it eliminates the serial communication problem and we 
can think of other options. THIS IS EXPLAINED IN THE TUTORIALS 
here...............   
http://docs.tinyos.net/index.php/Mote-PC_serial_communication_and_SerialForwarder

 

 

Cheers,

 

Varun Jain

 

From: Saul Garcia [mailto:[email protected]] 
Sent: Monday, 16 February 2009 11:17 PM
To: Varun Jain
Cc: [email protected]
Subject: Re: Help with the TestNework.java

 

Hi Varun, 

I've been trying hard but no luck, the listen tool works and I can see all the 
packets. However, the TestNetworkMsg seems to work, but no info is shown but:

macbook-de-user:java user$ java net.tinyos.tools.MsgReader TestNetworkMsg -comm 
serial@/dev/tty.usbserial-XBPT57WYB:iris
serial@/dev/tty.usbserial-XBPT57WYB:57600: resynchronising
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: packet too long
serial@/dev/tty.usbserial-XBPT57WYB:57600: resynchronising
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet

On the listen tool:
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
00 FF FF 00 01 17 3F EE 00 01 01 14 00 01 1E EE 00 01 00 1E 00 00 01 14 00 13 
00 00 00 00 00 
00 FF FF 00 00 09 00 16 40 00 00 00 00 00 00 00 8B 
00 FF FF 00 00 17 00 EE 00 00 00 00 00 00 48 EE 00 00 00 23 00 00 00 00 FF FF 
00 00 00 00 00 
00 FF FF 00 00 09 00 16 20 00 49 00 00 00 00 00 8C 
00 FF FF 00 00 09 00 16 50 00 00 00 00 00 00 00 8D 
00 FF FF 00 00 09 00 16 40 00 00 00 00 00 00 00 95 
00 FF FF 00 00 17 00 EE 00 00 00 00 00 00 4E EE 00 00 00 27 00 00 00 00 FF FF 
00 00 00 00 00 
00 FF FF 00 00 09 00 16 20 00 4F 00 00 00 00 00 96 
00 FF FF 00 00 09 00 16 50 00 00 00 00 00 00 00 97 
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
00 FF FF 00 00 09 00 16 20 00 53 00 00 00 00 00 9D 
00 FF FF 00 00 09 00 16 50 00 00 00 00 00 00 00 9E 
00 FF FF 00 00 09 00 16 20 00 57 00 00 00 00 00 A4 
00 FF FF 00 00 09 00 16 50 00 00 00 00 00 00 00 A5 
serial@/dev/tty.usbserial-XBPT57WYB:57600: bad packet
00 FF FF 00 00 09 00 16 40 00 00 00 00 00 00 00 A7 
00 FF FF 00 00 17 00 EE 00 00 00 00 00 00 58 EE 00 00 00 2B 00 00 00 00 FF FF 
00 00 00 00 00 
00 FF FF 00 00 09 00 16 20 00 59 00 00 00 00 00 A8 
00 FF FF 00 00 09 00 16 50 00 00 00 00 00 00 00 A9 

Then, I have retyped the code to discard any typing mistake, what else can I 
do? Any idea?

2009/2/12 Varun Jain <[email protected]>

Hi Saul,

Can you execute the "Listen" tool?????????????

 

If you can run that then it should be pretty much same. Is your TestNetworkMsg 
file generated correctly??????????? If it is not, then check that in 
"Makefile",  you need to have a TAB before "java" and "mig java"

 

Have you set up your MOTECOM environment variable?? If you have then you only 
need to give the following command:

 

java net.tinyos.tools.MsgReader TestNetworkMsg

 

It should work straight away. Also check if your serial port is connected to 
the Root of the network. But if you are able to see anything using "Listen" 
tool then there is some other problem.

 

I hope it helps.

 

Cheers,

 

Varun Jain

 

From: Saul Garcia [mailto:[email protected]] 
Sent: Thursday, 12 February 2009 12:35 AM
To: Varun Jain
Cc: [email protected]
Subject: Re: Help with the TestNework.java

 

Thank you, I have been working but there is a problem, I cannot execute the 
second command:

java net.tinyos.tools.MsgReader TestNetworkMsg

Am I missing something? I have tried adding the -comm 
serial@/dev/tty.usb......B:iris, but no luck because it appeared the message: 
s...@localhost:9002 died - exiting (java.net.ConnectException: Connection 
refused)

Kindly,

2009/2/11 Varun Jain <[email protected]>

Hi Saul,

TestNetwork application is the best application to start with to check if your 
networking is working alright, BACAUSE the application exercises the basic 
networking layers, i.e collection (using CTP) and dissemination (Using DIP or 
DRIP).

 

You will have to make two new files so that you can print all the data on the 
Screen

 

I suggest that in the TestNetwork application you make another folder called 
"java:. Make the following two new files in this folder.

 

1)      Makefile

 

BUILD_EXTRA_DEPS += TestNetwork.class

CLEAN_EXTRA = *.class TestNetworkMsg.java

                

TestNetwork.class: $(wildcard *.java) TestNetworkMsg.java

                javac *.java

 

TestNetworkMsg.java:

                mig java -target=null -java-classname=TestNetworkMsg 
../TestNetwork.h TestNetworkMsg -o $@

 

 

2)      TestNetwork.java

 

import net.tinyos.message.*;

import net.tinyos.util.*;

import java.io.*;

 

public class TestNetwork implements MessageListener

{

    MoteIF mote;

    

    // Main entry point

    void run() {

                

                                mote = new MoteIF(PrintStreamMessenger.err);

                                mote.registerListener(new TestNetworkMsg(), 
this);

    }

 

  synchronized public void messageReceived(int dest_addr, Message message) {

                 if (message instanceof TestNetworkMsg) {

                    TestNetworkMsg msg = (TestNetworkMsg)message;

                                

                                 System.out.println("Event is happening at node 
number      =  " + msg.get_source());

                

                                System.out.println("The message sequence for 
source node   =  " + msg.get_seqno());

                

                                System.out.println("PARENT for the event 
generating node   =  " + msg.get_parent());

                

                                System.out.println("Link quality with the 
parent is        =  " + msg.get_metric());

                                

                                System.out.println("Number of hops to get to 
the base      =  " + msg.get_data());

 

                                System.out.println("Number of hops to get to 
the base      =  " + msg.get_hopcount());

                                

                                System.out.println("Number of hops to get to 
the base      =  " + msg.get_ sendCount ());

 

                                System.out.println("Number of hops to get to 
the base      =  " + msg.get_ sendSuccessCount ());

                

                                System.out.println(" " );

                 }

    }

 

    

    public static void main(String[] args) {

                                TestNetwork me = new TestNetwork();

                                me.run();

    }

}

 

 

 

Now if you go to this java directory, you should type "make". This should 
automatically create all .class files and TestNetworkMsg.java file.

 

Now you can run the following two tests at this point. If your Root Node is 
attached to the serial port/PC then you run the following command:

 

java net.tinyos.tools.Listen -comm serial@/dev/ttySn:micaz  ---------à Put the 
correct number in place of 'n' and correct mote

 

AND

java net.tinyos.tools.MsgReader TestNetworkMsg

 

 

You should be seeing loys of data coming in like "the source", "the parent", 
etc.... I hope this helps.................

 

 

Cheers,

 

Varun Jain

 

From: Saul Garcia [mailto:[email protected]] 
Sent: Wednesday, 11 February 2009 2:33 AM
To: Varun Jain
Subject: Help with the TestNework.java

 

Hi,

I have been reading the tinyos mailing-list since I am working with it for my 
Master Thesis. I have to make modify the TestNetwork application, but for now I 
would like to understand what it does exactly. Then, I wonder if you could 
resend me the java applications to print out all the data in the screen. I read 
on the mailing-list that you attached them in June, but I haven't found them. I 
would really appreciate your help.

Bests,

-- 
Saul Garcia Huertes




-- 
Saul Garcia Huertes




-- 
Saul Garcia Huertes

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to