zigbee3.0 ota 實驗

軟件:simplicity stdio 、ubuntu18.04

芯片:EFR32MG21A020F768(設備),EFR32MG1P233F256GM48(ncp)

SDK:6.6.3

參考文檔:AN728、

服務器:

在simplicity stdio 生成Z3gatewayHost ,然後按默認操作再ubuntu裏面編譯,編譯成功後會有可執行文件,命名爲Z3gatewayHost,將後面需要升級的ota文件放到ota-files這個文件夾

ncp:

先生成BootLoader,

步驟:

1.看下圖

2.打開hwconf文件,更改usart0 的流控模式爲軟件流控(Xon-Xoff),然後生成編譯,可執行文件命令爲EFR32MG1P233F256GM48_bootloader-uart-xmodem-combined.s37

再生成ncp:

1.看圖

2. 如下圖,聲明一點,我這裏用的是usart1

3.如下圖

4.如下圖

 生成編譯,固件命名爲ncp-uart-sw.s37

設備:

生成BootLoader:BootLoader生成跟平時的一樣但是裏面的改動看圖片

下面就是改動後的

生成編譯,固件命名爲bootloader-storage-internal-single_MG21A.s37

生成應用程序,按照AN728文檔的步驟,一步步來,不同的地方如下圖

生成編譯,固件爲SwitchSoc_Endpoint4.s37(version 1);

複製出來,將版本號改爲version2 ,重新編譯,將它複製到項目ota-files文件下;

將EFR32MG1P233F256GM48_bootloader-uart-xmodem-combined.s37和ncp-uart-sw.s37下載到EFR32MG1P233F256GM48芯片的設備,此設備跟電腦usb連接;

將bootloader-storage-internal-single_MG21A.s37和SwitchSoc_Endpoint4.s37(version 1)下載到EFR32MG21A020F768(設備)上;

在ubuntu上運行Z3GatewayHost, 打開網絡,允許設備入網;

設備加網,執行ota命令,進行ota升級,在此過程,設備會發ota升級請求幀給網關,網關查看對比兩個固件的版本是否一致,如果網關的固件版本比設備的固件版本高的話,就進行升級,整個過程大概8分鐘;

開始:

[2019-09-17 17:01:31.092]# RECV ASCII>
Processing message: len=19 profile=0104 cluster=0019

T00000000:RX len 19, ep 01, clus 0x0019 (Over the Air Bootloading) FC 19 seq 05 cmd 07 payload[02 10 00 00 04 00 00 00 00 00 00 00 00 00 00 00 ]
OTA command from unrecognized server 0x0000.  My OTA server: 0xFFFD
Error: failed parsing OTA cmd 0x07
T00000000:TX (resp) Ucast 0x00
TX buffer: [00 05 0B 07 7E ]


[2019-09-17 17:03:42.982]# RECV ASCII>
Processing message: len=6 profile=0000 cluster=8006
Setting OTA Server to 0x0000


[2019-09-17 17:03:45.009]# RECV ASCII>
Bootload state: Get OTA Server EUI
OTA Cluster: setting IEEE address of OTA cluster
Last offset downloaded: 0x00000000
No image found in storage.
Processing message: len=16 profile=0104 cluster=0019

T00000000:RX len 16, ep 01, clus 0x0019 (Over the Air Bootloading) FC 19 seq 06 cmd 02 payload[00 02 10 00 00 04 00 00 00 F6 71 03 00 ]
Query next image response: New image is available for download.
Starting download, Version 0x00000004
Bootload state: Downloading Image
Starting erase from offset 0x0

[2019-09-17 17:03:45.094]# RECV ASCII>
0060000 to 0x000BC000


[2019-09-17 17:03:46.176]# RECV ASCII>
EEPROM Erase complete
Processing message: len=80 profile=0104 cluster=0019

T00000000:RX len 80, ep 01, clus 0x0019 (Over the Air Bootloading) FC 19 seq 07 cmd 05 payload[00 02 10 00 00 04 00 00 00 00 00 00 00 3F 1E F1 EE 0B 00 01 38 00 00 00 02 10 00 00 04 00 00 00 02 00 45 42 4C 20 53 77 69 74 63 68 53 6F 63 5F 45 6E 64 70 6F 69 6E 74 34 00 00 00 00 00 00 00 00 00 F6 71 03 00 00 00 B8 71 03 00 EB ]
Download: 0% complete


[2019-09-17 17:03:46.280]# RECV ASCII>
Processing message: len=80 profile=0104 cluster=0019

T00000000:RX len 80, ep 01, clus 0x0019 (Over the Air Bootloading) FC 19 seq 08 cmd 05 payload[00 02 10 00 00 04 00 00 00 3F 00 00 00 3F 17 A6 03 08 00 00 00 00 00 00 03 00 00 00 00 F4 0A 0A F4 1C 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 FD 03 03 FD B0 00 00 00 00 40 00 00 ]

…………

…………

T00000000:RX len 19, ep 01, clus 0x0019 (Over the Air Bootloading) FC 19 seq 07 cmd 07 payload[02 10 00 00 04 00 00 00 00 00 00 00 00 00 00 00 ]
OTA Cluster: wait for 0 s
RXed timeOut 0x00000000 s, MAX timeOut 0x00000DBB s
Adding 3000 ms. delay for immediate upgrade.
Countdown to upgrade: 3000 ms
Bootload state: Co

[2019-09-17 17:10:12.733]# RECV ASCII>
untdown to Upgrade


[2019-09-17 17:10:15.705]# RECV ASCII>
Applying upgrade
Executing bootload callback.


[2019-09-17 17:10:21.266]# RECV ASCII>
Reset info: 0x02 (BTL)
Extended Reset info: 0x0201 (GO )


[2019-09-17 17:10:21.379]# RECV ASCII>
init pass
EEPROM init: 0x00
EMBER_NETWORK_UP 0xB0DC
Bootload state: Random Delay before start
Delaying 55 seconds before starting OTA client
 

 

 

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