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

 

问题即解决

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值