配置为 a 的 XBee 系列 2Coordinator API
正在尝试向配置为 a 的 XBee 系列 2 发送数据包Router AT
。Coordinator 连接到运行 node.js 和xbee-api
library的 Mac OSX 。
var frame_obj = {
type: 0x10,
ud: 0x01,
destination64: "0013a20040b19213",
data: "1"
}
serialport.write(xbeeAPI.buildFrame(frame_obj))
这会导致 Node 抛出错误:
/Users/me/Dropbox/Projects/test-node/node_modules/xbee-api/lib/xbee-api.js:173
throw new Error("Checksum Mismatch", S);
^
Error: Checksum Mismatch
at XBeeAPI.parseRaw (/Users/me/Dropbox/Projects/test-node/node_modules/xbee-api/lib/xbee-api.js:173:15)
at Object.parser (/Users/me/Dropbox/Projects/test-node/node_modules/xbee-api/lib/xbee-api.js:119:10)
at Object.SerialPort.options.dataCallback (/Users/me/Dropbox/Projects/test-node/node_modules/serialport/serialport.js:136:15)
at SerialPortFactory.SerialPort._emitData (/Users/me/Dropbox/Projects/test-node/node_modules/serialport/serialport.js:305:20)
at afterRead (/Users/me/Dropbox/Projects/test-node/node_modules/serialport/serialport.js:283:18)
at /Users/me/Dropbox/Projects/test-node/node_modules/serialport/serialport.js:297:9
at Object.wrapper [as oncomplete] (fs.js:454:17)
使用AT Router
侧面的 Arduino 的 Serial Monitor,我们可以看到 Coordinator 发送的数据实际上到达了 Router。
问题:为什么会出现校验和错误?我们怎样才能解决这个问题?
路由器 AT 配置
<data>
<profile>
<description_file>XB24-ZB_22A7.xml</description_file>
<settings>
<setting command="ID">2001</setting>
<setting command="SC">FFFF</setting>
<setting command="SD">3</setting>
<setting command="ZS">0</setting>
<setting command="NJ">FF</setting>
<setting command="NW">0</setting>
<setting command="JV">1</setting>
<setting command="JN">0</setting>
<setting command="DH">13A200</setting>
<setting command="DL">40A74613</setting>
<setting command="NI">0x20</setting>
<setting command="NH">1E</setting>
<setting command="BH">0</setting>
<setting command="AR">FF</setting>
<setting command="DD">30000</setting>
<setting command="NT">3C</setting>
<setting command="NO">3</setting>
<setting command="CR">3</setting>
<setting command="SE">E8</setting>
<setting command="DE">E8</setting>
<setting command="CI">11</setting>
<setting command="PL">4</setting>
<setting command="PM">1</setting>
<setting command="EE">0</setting>
<setting command="EO">0</setting>
<setting command="KY"></setting>
<setting command="BD">3</setting>
<setting command="NB">0</setting>
<setting command="SB">0</setting>
<setting command="RO">3</setting>
<setting command="D7">1</setting>
<setting command="D6">0</setting>
<setting command="CT">64</setting>
<setting command="GT">3E8</setting>
<setting command="CC">2B</setting>
<setting command="SM">0</setting>
<setting command="SN">1</setting>
<setting command="SO">0</setting>
<setting command="SP">20</setting>
<setting command="ST">1388</setting>
<setting command="PO">0</setting>
<setting command="D0">0</setting>
<setting command="D1">0</setting>
<setting command="D2">0</setting>
<setting command="D3">0</setting>
<setting command="D4">0</setting>
<setting command="D5">1</setting>
<setting command="P0">1</setting>
<setting command="P1">0</setting>
<setting command="P2">0</setting>
<setting command="PR">1FFF</setting>
<setting command="LT">0</setting>
<setting command="RP">28</setting>
<setting command="DO">1</setting>
<setting command="IR">3E8</setting>
<setting command="IC">0</setting>
<setting command="V+">0</setting>
</settings>
</profile>
</data>
协调器 API 配置
<data>
<profile>
<description_file>XB24-ZB_21A7.xml</description_file>
<settings>
<setting command="ID">2001</setting>
<setting command="SC">FFFF</setting>
<setting command="SD">3</setting>
<setting command="ZS">0</setting>
<setting command="NJ">FF</setting>
<setting command="DH">0</setting>
<setting command="DL">FFFF</setting>
<setting command="NI">0x20</setting>
<setting command="NH">1E</setting>
<setting command="BH">0</setting>
<setting command="AR">FF</setting>
<setting command="DD">30000</setting>
<setting command="NT">3C</setting>
<setting command="NO">3</setting>
<setting command="CR">3</setting>
<setting command="PL">4</setting>
<setting command="PM">1</setting>
<setting command="EE">0</setting>
<setting command="EO">0</setting>
<setting command="KY"></setting>
<setting command="NK"></setting>
<setting command="BD">3</setting>
<setting command="NB">0</setting>
<setting command="SB">0</setting>
<setting command="D7">1</setting>
<setting command="D6">0</setting>
<setting command="AP">1</setting>
<setting command="AO">0</setting>
<setting command="SP">20</setting>
<setting command="SN">1</setting>
<setting command="D0">1</setting>
<setting command="D1">0</setting>
<setting command="D2">0</setting>
<setting command="D3">0</setting>
<setting command="D4">0</setting>
<setting command="D5">1</setting>
<setting command="P0">1</setting>
<setting command="P1">0</setting>
<setting command="P2">0</setting>
<setting command="PR">1FFF</setting>
<setting command="LT">0</setting>
<setting command="RP">28</setting>
<setting command="DO">1</setting>
<setting command="IR">0</setting>
<setting command="IC">0</setting>
<setting command="V+">0</setting>
</settings>
</profile>
</data>