1.4 Mote-PC serial communication and SerialForwarder 学习笔记

来源:互联网 发布:淘宝怎么充钱余额 编辑:程序博客网 时间:2024/06/01 09:30

学习这一小节遇到的问题

 

 

问题1:

 

java net.tinyos.tools.MsgReader BlinkToRadioMsg
java.lang.ClassNotFoundException: BlinkToRadioMsg
serial@/dev/ttyUSB0:115200: resynchronising

 

这个由于 classpath 路径设置的有些问题,所以

你只需要修改下 /opt/tinyos-2.1.1/ 下的 tinyos.sh

 

我的 tinyos.sh 如下

#! /usr/bin/env bash
# Here we setup the environment
# variables needed by the tinyos
# make system

echo "Setting up for TinyOS 2.1.1"
export TOSROOT=
export TOSDIR=
export MAKERULES=
export MOTECOM

TOSROOT="/opt/tinyos-2.1.1"
TOSDIR="$TOSROOT/tos"
CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java/:$TOSROOT/support/sdk/java/tinyos.jar

MAKERULES="$TOSROOT/support/make/Makerules"
MOTECOM="serial@/dev/ttyUSB0:115200"    # telosb

export TOSROOT
export TOSDIR
export CLASSPATH
export MAKERULES
export MOTECOM

 

 

问题2:

java net.tinyos.tools.MsgReader BlinkToRadioMsg

BlinkToRadioMsg does not have an AM type - ignored

warning: Cannot determine AM type for BlinkToRadioMsg
         (Looking for definition of AM_BLINKTORADIOMSG)

 

 

这个问题的解决方法是依据 

One part of the TinyOS communication toolchain requires being able to figure out which AM types correspond to what kinds of packets. To determine this, for a packet type named X, mig looks for a constant of the form AM_X. The warning is because we defined our AM type as AM_BLINKTORADIO, but mig wants AM_BLINKTORADIOMSG. Modify BlinkToRadio.h so that it defines the latter. You'll also need to update BlinkToRadioAppC.nc so that the arguments to AMSenderC and AMReceiverC use it. Recompile the application, and you should see no warning. Install it on a mote.

 

所以,你要把

BlinkToRadio.h 和 BlinkToRadioAppC.nc

里的AM_BLINKTORADIO 修改成 AM_BLINKTORADIOMSG

 

问题即解决