[Tinyos-help] help using stargate for mote

jsuh at xbow.com jsuh at xbow.com
Fri Jan 2 10:46:00 PST 2004


Hello Ganesh,

Here are a couple to tips to help you:

1) Use COM3, i.e., ttyS2 of the Stargate. It does not matter what COM port
of the PC you use to connect to the Stargate console.

2) In the read_packet() function this sample app uses "0x7E" to check for
the start of the TOS packet. You should change this appropriately for this
program to match your TOS packet contents.

How is Crossbow doing? Would you take a moment to fill our customer
satisfaction survey at http://www.xbow.com/satform.htm? Thank you.

Sincerely,
John Suh
Technical Support Engineer
Crossbow Technology, Inc.
408-965-3310
http://www.xbow.com


-----Original Message-----
From: tinyos-help-bounces at Millennium.Berkeley.EDU
[mailto:tinyos-help-bounces at Millennium.Berkeley.EDU] On Behalf Of Ganesh K
Godavari
Sent: Tuesday, December 30, 2003 5:34 PM
To: tinyos-help at Millennium.Berkeley.EDU
Subject: [Tinyos-help] help using stargate for mote

hello group,
 i am trying a simple application(surge) for gathering data using multihop
routing.using mib510 i am able to succesfully gather data from the mote0
attached to the serail port. now i want to run the same application on
stargate that xbow has provided. i attached the mote to the stargate board
and am using the sample application motetest(provided in the apps/sample
along the cd of stargate with a modification of only reading) to open a
serial interface with mote i am not able to retreive data from the mote
attached to stargate. can anybody tell me what i am doing wrong?.

the seial port is connected using com4 on the windows

on login(using hyper terminal) the stargate tells me that i am connected
using ttyS0
PAM_unix[90]: (login) session opened for user root by (uid=0)
login[90]: ROOT LOGIN on `ttyS0'


running the motetest program attached below(./motetest -p /dev/ttySX x =
0,1,2,3 all cause the same problem). i am not getting any data from the
mote. and my program is running without giving any data on the screen. i am
not even able to kill the program. ctrl-c, ctrl-d, ctrl-bksp does kill the
program. i have to restart the mote .

can any one tell me what i am doing wrong?. how i can i read the data i am
able to get succesfully on mib510 using the stargate? any sample program or
any inputs on where i can find one will be of great help.

thanks
gkgodava

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

/* Serial port information for talking to the mote */
#define TOS_PACKET_LENGTH 36 		/* Default TOS packet length */
#define SERIAL_PORT "/dev/ttyS2" 	/* Default serial port to use */
#define MICA1_BAUDRATE B19200		/* MICA1 baudrate */
#define MICA2_BAUDRATE B57600		/* MICA2 baudrate */
#define DEFAULT_BAUDRATE B57600		/* Default is MICA2 */

/* Functions */
void usage (char *);
void parse_opts (int, char **); /* Parse command line options */
void open_serial (void);	/* Open a serial channel to mote */
void read_packet (void);	/* Read a packet from the mote */
void create_packet(char *);     /* Create TOS packet */
void write_packet(void);	/* Write a packet to the mote */
void print_packet (char *);	/* Print mote packet to stdout */

/* Global variables */
int inout_stream;
char input_buffer[TOS_PACKET_LENGTH];
char output_buffer[TOS_PACKET_LENGTH];
char *serial_port = SERIAL_PORT;
char mote = 2, charflag = 0;

void usage(char *name) {
  fprintf(stderr,"Usage: %s [-h] [-c] [-m 1|2] [-p /dev/ttySXXX]\n",name);
  fprintf(stderr,"       -c              : Print packet data as char
(default is int)\n");
  fprintf(stderr,"       -m 1            : Use BAUDRATE settings for
MICA1\n");
  fprintf(stderr,"       -m 2            : Use BAUDRATE settings for MICA2
(default)\n");
  fprintf(stderr,"       -p /dev/ttySXXX : Talk to mote on /dev/ttySXXX
(default is /dev/ttyS2)\n");
  fprintf(stderr,"       -h              : Print usage information\n");
  exit(-1);
}

void parse_opts(int argc,char **argv) {
  int opt;

  while ((opt = getopt(argc,argv,"hcm:p:")) != EOF) {
    switch(opt) {
    case 'h':
      usage(argv[0]);
      break;
    case 'c':
      charflag = 1;
      break;
    case 'm':
      mote = atoi(optarg);
      if ((mote != 1) && (mote != 2))
	usage(argv[0]);
      break;
    case 'p':
      serial_port = optarg;
      break;
    default:
      usage(argv[0]);
    }
  }
}

int main(int argc, char ** argv) {
  int index = 0, count = 10;

  /* Parse command line arguments */
  parse_opts(argc,argv);

  /* Open serial channel to mote */
  open_serial();

  while (index < count) {

    /* Read packet from mote into input buffer */
    /* Note: The read blocks till a mote packet is received.
       An alternative is to use "poll" to check for incoming data */
    read_packet();

    /* Dump packet onto stdout */
    print_packet(input_buffer);

    index++;
  }

  exit(0);

}

/* Open serial channel to mote */
void open_serial() {
  struct termios tio;
  inout_stream = open(serial_port, O_RDWR|O_NOCTTY);
  if (inout_stream < 0) {
    fprintf(stderr,"Cannot open serial device %s\n", serial_port);
    exit(-1);
  }

  /* Serial port setting */
  bzero(&tio, sizeof(tio));
  if (mote == 1)
    tio.c_cflag = MICA1_BAUDRATE | CS8 | CLOCAL | CREAD;
  else if (mote == 2)
    tio.c_cflag = MICA2_BAUDRATE | CS8 | CLOCAL | CREAD;
  else
    tio.c_cflag = DEFAULT_BAUDRATE | CS8 | CLOCAL | CREAD;
  tio.c_iflag = IGNPAR | ICRNL;

  /* Raw output_file */
  tio.c_oflag = 0;

  /* Flush buffer; parameters take effect immediately */
  tcflush(inout_stream, TCIFLUSH);
  tcsetattr(inout_stream, TCSANOW, &tio);
}

/* Read TOS packet from mote */
void read_packet() {
  int count;
  bzero(input_buffer, TOS_PACKET_LENGTH);
  //Find start of packet
  while(input_buffer[0] != (char)(0x7E)){
    while(1 != read(inout_stream, input_buffer, 1)){};
  }
  count = 1;
  //Read packet contents
  while(count < TOS_PACKET_LENGTH)
    count += read(inout_stream, input_buffer + count, TOS_PACKET_LENGTH -
count); }

/* Print packet to stdout */
void print_packet(char *packet) {
  int i;
  printf("Raw TOS packet contents: ");
  for(i = 0; i < TOS_PACKET_LENGTH; i ++) {
    if (charflag)
      printf("%c ", (char) (packet[i] & 0xff));
    else
      printf("%d ", (char) (packet[i] & 0xff));
  }
  printf("\n");
}




> Send Tinyos-help mailing list submissions to
> 	tinyos-help at Millennium.Berkeley.EDU
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
> or, via email, send a message with subject or body 'help' to
> 	tinyos-help-request at Millennium.Berkeley.EDU
>
> You can reach the person managing the list at
> 	tinyos-help-owner at Millennium.Berkeley.EDU
>
> When replying, please edit your Subject line so it is more specific 
> than
> "Re: Contents of Tinyos-help digest..."
>
>
> Today's Topics:
>
>    1. Problems receiving Data on Initial Hardware Test (Sibin M)
>    2. RE: Problems receiving Data on Initial Hardware Tes	t
>       (jsuh at xbow.com)
>    3. Re: Welcome to the "Tinyos-help" mailing list
>       (Rachit Mukund Sanchela)
>    4. Re: Errors of LossyBuilder? (Philip Levis)
>    5. transmission rate (Kensuke Ueda)
>    6. RE: Problems receiving Data on Initial Hardware Test
>       (Kristin Wright)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 29 Dec 2003 16:41:15 -0500
> From: Sibin M <smohan at unity.ncsu.edu>
> Subject: [Tinyos-help] Problems receiving Data on Initial Hardware
> 	Test
> To: tinyos-help at Millennium.Berkeley.EDU
> Message-ID: <1072734074.25630.3.camel at sys02.csc.ncsu.edu>
> Content-Type: text/plain
>
> Hi,
>
> 	I have been trying to run the "MicaHWVerify" app on my mica2 board.
All
> the steps proceed normally ( as explained in 
> file:/opt/tinyos-1.x/doc/tutorial/verifyhw.html ), except for the last 
> one, i.e. : when I type
> MOTECOM=serial at COM1:57600 java hardware_check
>
> at the command line, I get the following response :
> Hardware check started
> serial at COM1:57600: resynchronising
> Node Transmission Failure.
>
> The node is plugged into the board, and the power has been turned on. 
> The Red LED is on.
>
> 	Any suggestions/ideas would be helpful.
>
> 	Thanks.
> 		- Sibin.
>
> --
> -------------------------------
> Sibin M
>
> PhD Student
> Computer Science Dept.
> North Carolina State University
> -------------------------------
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 29 Dec 2003 13:54:14 -0800
> From: jsuh at xbow.com
> Subject: RE: [Tinyos-help] Problems receiving Data on Initial Hardware
> 	Tes	t
> To: smohan at unity.ncsu.edu, tinyos-help at Millennium.Berkeley.EDU
> Message-ID: <C084AFDE30D9D511864500C04FA0626E848A11 at clavin.xbow.com>
> Content-Type: text/plain
>
> Hello Sibin,
>
> You may not have set the frequency of your mote correctly. The 
> question/answer #1 at 
> http://xbow.custhelp.com/cgi-bin/xbow.cfg/php/enduser/std_alp.php
> clarifies how to set the frequency of the mote when compiling the 
> MicaHWVerify application.
>
> How is Crossbow doing? Would you take a moment to fill our customer 
> satisfaction survey at http://www.xbow.com/satform.htm? Thank you.
>
> Sincerely,
> John Suh
> Technical Support Engineer
> Crossbow Technology, Inc.
> 408-965-3310
> http://www.xbow.com
>
>
>
> -----Original Message-----
> From: Sibin M [mailto:smohan at unity.ncsu.edu]
> Sent: Monday, December 29, 2003 1:41 PM
> To: tinyos-help at Millennium.Berkeley.EDU
> Subject: [Tinyos-help] Problems receiving Data on Initial Hardware 
> Test
>
>
> Hi,
>
> 	I have been trying to run the "MicaHWVerify" app on my mica2 board. 
> All the steps proceed normally ( as explained in 
> file:/opt/tinyos-1.x/doc/tutorial/verifyhw.html ), except for the last 
> one, i.e. : when I type MOTECOM=serial at COM1:57600 java hardware_check
>
> at the command line, I get the following response :
> Hardware check started
> serial at COM1:57600: resynchronising
> Node Transmission Failure.
>
> The node is plugged into the board, and the power has been turned on. 
> The Red LED is on.
>
> 	Any suggestions/ideas would be helpful.
>
> 	Thanks.
> 		- Sibin.
>
> --
> -------------------------------
> Sibin M
>
> PhD Student
> Computer Science Dept.
> North Carolina State University
> -------------------------------
>
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 29 Dec 2003 17:43:40 -0500 (EST)
> From: Rachit Mukund Sanchela <rmsanche at uncc.edu>
> Subject: [Tinyos-help] Re: Welcome to the "Tinyos-help" mailing list 
> To: tinyos-help at Millennium.Berkeley.EDU
> Message-ID: <4051721.1072737820498.JavaMail.rmsanche at uncc.edu>
> Content-Type: text/plain
>
>
> hi
> my name is Rachit Sanchela
> My email id is rmsanche at uncc.edu
>
> tinyos-help-request at Millennium.Berkeley.EDU wrote:
>
>
>>Welcome to the Tinyos-help at Millennium.Berkeley.EDU mailing list!
>>
>>To post to this list, send your email to:
>>
>>  tinyos-help at Millennium.Berkeley.EDU
>>
>>General information about the mailing list is at:
>>
>>  http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
>>
>>If you ever want to unsubscribe or change your options (eg, switch to  
>>or from digest mode, change your password, etc.), visit your 
>>subscription page at:
>>
>>
>
http://mail.Millennium.Berkeley.EDU/mailman/options/tinyos-help/rmsanche%40u
ncc.edu
>>
>>
>>You can also make such adjustments via email by sending a message to:
>>
>>  Tinyos-help-request at Millennium.Berkeley.EDU
>>
>>with the word `help' in the subject or body (don't include the 
>>quotes), and you will get back a message with instructions.
>>
>>You must know your password to change your options (including changing  
>>the password, itself) or to unsubscribe.  It is:
>>
>>  premaakash
>>
>>Normally, Mailman will remind you of your Millennium.Berkeley.EDU  
>>mailing list passwords once every month, although you can disable this  
>>if you prefer.  This reminder will also include instructions on how to  
>>unsubscribe or change your account options.  There is also a button on  
>>your options page that will email your current password to you.
>>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 29 Dec 2003 15:26:17 -0800 (PST)
> From: Philip Levis <pal at EECS.Berkeley.EDU>
> Subject: Re: [Tinyos-help] Errors of LossyBuilder?
> To: Zeng Peng <zp at sia.ac.cn>
> Cc: ToSHelp <tinyos-help at Millennium.Berkeley.EDU>
> Message-ID:
> 	<Pine.SOL.4.44.0312291525060.9857-100000 at argus.EECS.Berkeley.EDU>
> Content-Type: TEXT/PLAIN; charset=X-UNKNOWN
>
> There was a bug in LossyBuilder (actually, in one of the classes it
> uses) which caused motes to have an infinite interference range. That 
> should be fixed in CVS now.
>
> Phil
>
> ----------------------
>
> Society can and does execute its own mandates: and if it issues wrong 
> mandates instead of right, or any mandates at all in things with which 
> it ought not to meddle, it practises a social tyranny more formidable 
> than many kinds of political oppression, since, though not usually 
> upheld by such extreme penalties, it leaves fewer means of escape, 
> penetrating much more deeply into the details of life, and enslaving 
> the soul itself.
>
>           - John Stuart Mill, "On Liberty"
>
>
> On Tue, 23 Dec 2003, Zeng Peng wrote:
>
>> Hi, all.
>> 	I generate a lossy-5*5-10.nss by LossyBuilder and run surge on it. 
>> All nodes can send messages, but little can receive(little CRC 
>> errors), None can find parent. It looks like there are some errors in 
>> lossy-5*5-10.nss. then i generate a lossy-20*20-10.nss by 
>> LossyBuilder, it still can't work. But when i use the 
>> lossy-20*20-10.nss in tos/platform/pc directory. Everything is ok. 
>> who can tell me is it the error of LossyBuilder?
>>
>> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Zeng Peng
>> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡zp at sia.ac.cn
>> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2003-12-23
>>
>>
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> Tinyos-help at Millennium.Berkeley.EDU
>> http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
>>
>
>
>
>
> ------------------------------
>
> Message: 5
> Date: Sat, 20 Dec 2003 23:16:11 +0900(JST)
> From: Kensuke Ueda<ken-ueda at nal.ics.es.osaka-u.ac.jp>
> Subject: [Tinyos-help] transmission rate
> To: tinyos-help at today.CS.Berkeley.EDU
> Message-ID: <20031220231611.2af4.ken-ueda at nal.ics.es.osaka-u.ac.jp>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I want to change OscilloscopeRF to make
> the tranmission rate become faster.
> I changed the value of Clock.setRate,
> but the rate did not become more than
> 7,8 packets per second.
>
> What should I do to make the rate faster?
>
> Best regards,
>
> -----------------------------------
> Kensuke Ueda <ken-ueda at ics.es.osaka-u.ac.jp>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Tue, 30 Dec 2003 10:31:17 -0700
> From: "Kristin Wright" <kwright at cs.berkeley.edu>
> Subject: RE: [Tinyos-help] Problems receiving Data on Initial Hardware
> 	Test
> To: <smohan at unity.ncsu.edu>, <tinyos-help at millennium.berkeley.edu>
> Message-ID: <E1AbNi9-0005hU-01 at mgr1.xmission.com>
> Content-Type: text/plain;	charset="US-ASCII"
>
>
> The good news: this probably doesn't indicate that your mica2 is not 
> working. Make sure that you're using com1 and not com2 (or something 
> else). Ensure that nothing else is using COM1. You can try doing the 
> Listen experiment on COM1 (see Lesson 6 of the tutorial -- that might 
> mean skipping ahead but it can be less complicated than running 
> MicaHWVerify).
>
> -kw
>
> -----Original Message-----
> From: tinyos-help-bounces at Millennium.Berkeley.EDU
> [mailto:tinyos-help-bounces at Millennium.Berkeley.EDU] On Behalf Of 
> Sibin M Sent: Monday, December 29, 2003 2:41 PM
> To: tinyos-help at Millennium.Berkeley.EDU
> Subject: [Tinyos-help] Problems receiving Data on Initial Hardware 
> Test
>
> Hi,
>
> 	I have been trying to run the "MicaHWVerify" app on my mica2 board. 
> All the steps proceed normally ( as explained in
> file:/opt/tinyos-1.x/doc/tutorial/verifyhw.html ), except for the last
> one, i.e. :
> when I type
> MOTECOM=serial at COM1:57600 java hardware_check
>
> at the command line, I get the following response :
> Hardware check started
> serial at COM1:57600: resynchronising
> Node Transmission Failure.
>
> The node is plugged into the board, and the power has been turned on. 
> The Red LED is on.
>
> 	Any suggestions/ideas would be helpful.
>
> 	Thanks.
> 		- Sibin.
>
> --
> -------------------------------
> Sibin M
>
> PhD Student
> Computer Science Dept.
> North Carolina State University
> -------------------------------
>
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
>
>
>
> ------------------------------
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at Millennium.Berkeley.EDU
> http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help
>
>
> End of Tinyos-help Digest, Vol 8, Issue 30
> ******************************************



_______________________________________________
Tinyos-help mailing list
Tinyos-help at Millennium.Berkeley.EDU
http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-help


More information about the Tinyos-help mailing list