1.4 Mote-PC serial communication and SerialForwarder 學習筆記

學習這一小節遇到的問題

 

 

問題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

 

問題即解決

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章