日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

修改Z

 xsx2008 2014-09-29

1、在Z-Stack協(xié)議安裝文件夾下的documents下的Z-Stack Developer's Guide.pdf文檔,找到9.2  Configuring the PAN ID and network to join 

有以下說明

This is an optional configuration item to control which network a ZigBee Router or End Device will join. The
ZDO_CONFIG_PAN_ID parameter in f8wConfig.cfg can be set to a value (between 0 and 0xFFFE). A coordinator
will use this value as the PANId of the network that it starts. A router or end-device will only join a network that has
a PANId configured in this parameter. To turn this feature off, set the parameter to a value of 0xFFFF.

For further control of the joining procedure, the ZDO_NetworkDiscoveryConfirmCB function in the
ZDApp.c should be modified. ZDO_NetworkDiscoveryConfirmCB() is called when the network layer has
finished with the Network Discovery process [started by calling NLME_NetworkDiscoveryRequest()
defined in the Stack API document].

 

2、如果使用過Sensor-Demo這個全程,見文檔CC2530ZDK_Sensor_Demo_Users_Guide.pdf

5.3.1 Network Settings
The software that is programmed on the CC2530ZDK uses IEEE 802.15.4 channel 11 (2405 MHz).
The PAN ID used is dependent on the last 2 bytes of the Coordinator’s IEEE address (i.e.
ZDAPP_CONFIG_PAN_ID=0xFFFF in the file f8wConfig.cfg in Z-Stack).

It is possible to choose another channel and PAN ID by using other settings in the file f8wConfig.cfg in
Z-Stack. See also Z-Stack Developer’s Guide [5] for further information.

 

以上兩種方法其實講的是同一種方法,兩個參數(shù)的名字不同,難道是其中一個TI的文檔沒有更新?

在我使用的ZStack-CC2530-2.3.1-1.4.0版的協(xié)議中,f8wConfig.cfg里的參數(shù)不是ZDO_CONFIG_PAN_ID,而是ZDAPP_CONFIG_PAN_ID。

用這種方法,就是修改tool下的f8wConfig.cfg文件里的參數(shù),編譯后再down到板子里。down完之后,網(wǎng)絡(luò)運行過程中想要修改就不能用這種方法了。


3、現(xiàn)在我想實現(xiàn)如下功能:

協(xié)調(diào)器跟PC通過RS232連接,我想在協(xié)調(diào)器在運行過程中,PC可以命令協(xié)調(diào)器修改PAN_ID。

使用函數(shù):void zb_WriteConfiguration( uint8 configId, uint8 len, void *pValue ) 

文檔:Z-Stack Simple API.pdf中對這個函數(shù)的解釋如下:

The zb_WriteConfiguration function is used to write a Configuration Property to nonvolatile memory. 

第一個參數(shù)configId在OSAL下的ZComDef.h文件中定義。

其中有一條:

#define ZCD_NV_PANID                      0x0083

 

那么通過如下語句可以實現(xiàn)目的:

uint16 pan_id;

pan_id=0x1122;//你想要的ID

zb_WriteConfiguration(ZCD_NV_PANID, sizeof(uint16),  &pan_id) ;

zb_SystemReset();//重啟后才會啟用新的PAN_ID,不然只是修改了NV里面的數(shù)據(jù)。

 

如果沒有添加zb_SystemReset();這條語句,通過zb_ReadConfiguration()函數(shù)讀取的PAN_ID也是0x1122,說明zb_WriteConfiguration已經(jīng)把數(shù)據(jù)成功寫進NV里了。

但是用zb_GetDeviceInfo(ZB_INFO_PAN_ID,&pan_id);讀出來的卻還是舊的PAN_ID,因為系統(tǒng)沒有啟用新的PAN_ID來建立網(wǎng)絡(luò)。

這時調(diào)用 zb_SystemReset();讓系統(tǒng)重啟一下,再用zb_ReadConfiguration()和zb_GetDeviceInfo()讀出來的數(shù)據(jù)就是一樣的了。

運行中修改協(xié)調(diào)器PAN ID和Channel,協(xié)調(diào)器廣播至所有的設(shè)備重啟加入新建后的網(wǎng)絡(luò) 


以上方法又不對了!?。?/span>

以下方法經(jīng)過驗證是可以的:

 

pan_id = 0x1122;     

 

_NIB.nwkPanId = pan_id;

 

NLME_UpdateNV(0x01);

 

zb_SystemReset();

 

這樣就可以建立一個新的pan_id的網(wǎng)絡(luò)了,而且也可以和節(jié)點進行正常通信。

 

NLME_UpdateNV()這個函數(shù)可以在Z-Stack API.pdf文檔里找到。

 

也可以參照這篇博文:http://blog.sina.com.cn/s/blog_63e7da980100oi4q.html

 

 

 

用zb_GetDeviceInfo(ZB_INFO_PAN_ID,&pan_id);這個函數(shù)讀取的pan_id是修改后的數(shù)據(jù);

 

但是為何用zb_ReadConfiguration(ZCD_NV_PANID, sizeof(uint16), &pan_id);讀取出來的是舊的數(shù)據(jù)呢?沒有更新NV?


    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多