本帖最后由 wes58 于 2024-11-13 07:51 编辑
1. Importing application code is not a solution. You need to import build configuration (which is stored in .cproject file, And I don't see how you can do it.
2. I have finished adding OTA image transfer via BLE_ZBHCI to my Android app. I have tried and it works much faster then using UART (which didn't work for me).
It took me less time to do it than I spent on trying to figure out why UART transfer didn't work.
I used ZigBee BLE concurrent Sdk. And of course there were some problems. In the sample app there is a file app_ble2zigbee.c and function zb_ble_hci_cmd_handler() which calls zbhciCmdHandler().
But this function doesn't work for messages that have crc8 byte in them. It took me some time to figure out why I get an error response.
I have triansferred OTA image to the gateway got the last message - 82 12 00 09 99 00 02 A1 F2 00 02 A1 F2 00 AA
I sent "Image Notify" message to the gateway - 55 01 90 00 07 37 02 17 AC 01 1A 03 00 AA
The device sends zcl_ota_queryNextImageReqCmdSend() with
manuCode 0x1141
imageType 0x0201
curFileVer 0x30011001
dstAddr 0x0000
dstEp 0x01
g_otaCtx.simpleDesc->endpoint 0x1a ->device EP
Gateway ZBHCI msg 55 82 00 00 09 C7 02 17 AC 01 1A 00 19 00 F7 AA
55 82 00 00 09 C8 02 17 AC 01 1A 00 19 00 F8 AA
Device never gets call ota_queryNextImageReqHandler()?
The device keeps sending zcl_ota_queryNextImageReqCmdSend() from ota_periodicQueryServerCb()
I don't know what should happen. That's why I asked you for messages for complete OTA upgrade. At least, I could check what am I missing.
On the device there is a callback function but it is never called. I thought that it will process messages?
ota_callBack_t Light_otaCb =
{
Light_otaProcessMsgHandler,
};
And device is not being updated and I don't get any error messages.
When looking in the code you have to send "Image notify" message because it calls the function zbhci_clusterOTAHandle() -> and cust_ota_start_req(&dstEpInfo,srcEp,&pCmd); -> and zcl_ota_imageNotifyCmdSend(srcEp, dstEpInfo, FALSE, &in);
zcl_ota_imageNotifyCmdSend() has correct information about destination device.
What is a fucntion on the device that receives and processing message from the gateway from zcl_ota_imageNotifyCmdSend(srcEp, dstEpInfo, FALSE, &in)?
Ok, I found out that it is function ota_imageNotifyHandler()
Image
if(ZB_NWK_IS_ADDRESS_BROADCAST(pAddrInfo->dstAddr)){
if((pImageNotify->payloadType >= IMAGE_NOTIFY_QUERT_JITTER_MFG)
&& (pImageNotify->manuCode != g_otaCtx.pOtaPreamble->manufacturerCode)){
return ZCL_STA_SUCCESS;
}
if((pImageNotify->payloadType >= IMAGE_NOTIFY_QUERY_JITTER_MFG_TYPE)
&& (pImageNotify->imageType != g_otaCtx.pOtaPreamble->imageType)){
return ZCL_STA_SUCCESS;
}
if((pImageNotify->payloadType >= IMAGE_NOTIFY_QUERY_JITTER_MFG_TYPE_VER)
&& (pImageNotify->newFileVer == zcl_attr_currFileVer)){
return ZCL_STA_SUCCESS;
}
if((zb_random() % 100) > pImageNotify->queryJitter){
return ZCL_STA_SUCCESS;
}
}
From this code I understood that when I sent broadcast address the device sends zcl_ota_queryNextImageReqCmdSend after a preset time.
When I send device network address the device sends zcl_ota_queryNextImageReqCmdSend and receives responsein ota_queryNextImageRspHandler
But what i get is pQueryNextImageRsp->st = ZCL_STA_NO_IMAGE_AVAILABLE?
Here is what is sent by the gateway:
rsp.st = 0x98 <- ZCL_STA_NO_IMAGE_AVAILABLE
rsp.imageType = 0x0201;
rsp.manuCode = 0x1141
rsp.fileVer = 0x30011001
pQueryNextImageReq->curFileVer = 0x30011001
rsp.imageSize 0x02A482
It looks like it fails because file version are the same.
But file version are not the same. Here are the pictures of the files.
image1.png shows the header added to the .bin file by zigbee_ota_tool_v2.2.exe
image2.png show the end of this file which shows the file version.
You can see that file version is 03 not 01. Why?
|