This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[OTA] Zigbee ota client / server connection problem

Hello, I am developing a Zigbee OTA client / server application. My code is based on the example from the 4.1.0 nRF5 SDK. From the example I took only the code related to the OTA cluster because I want only to sent image file from the server to the client without reprogramming the client.

On the server side I do the initialization and I am inserting a file into the memory (currently only providing a pointer to the empty array, the header is filled with 0xFF), something like this:

zb_void_t ota_server_clusters_init(zb_void_t)
{
test_file.head.file_id = ZB_ZCL_OTA_UPGRADE_FILE_HEADER_FILE_ID;

/* Initialize the attributes */
ota_server_attr_init();

/* Register OTA Client device context (endpoints). */
ZB_AF_REGISTER_DEVICE_CTX(&ota_upgrade_server_ctx);

zb_zcl_ota_upgrade_init_server(OTA_ENDPOINT_SERVER, next_data_ind_cb);
}

The insert_ota_file() is called when the server connects to the network.
static zb_void_t insert_ota_file(zb_uint8_t param)
{
zb_buf_t * pBuff = ZB_BUF_FROM_REF( param );
zb_zcl_ota_upgrade_server_insert_file_t * file_data;

ZB_BUF_INITIAL_ALLOC( pBuff, sizeof( zb_zcl_ota_upgrade_server_insert_file_t ) + ( 1 ) * sizeof( zb_uint16_t ), file_data );

ZB_ZCL_OTA_UPGRADE_INSERT_FILE(pBuff, OTA_ENDPOINT_SERVER, 0, (zb_uint8_t *)(mp_ota_file), OTA_UPGRADE_TEST_UPGRADE_TIME/*, ZB_TRUE, zb_err_code*/);
}

On the client side i also do the initialization:
/**@brief Function for initializing the Zigbee Stack.
*/
zb_void_t ota_client_clusters_init(zb_void_t)
{
/* Initialize application context structure. */
UNUSED_RETURN_VALUE(ZB_MEMSET(&m_dev_ctx, 0, sizeof(m_dev_ctx)));

/* Register OTA Client device context (endpoints). */
ZB_AF_REGISTER_DEVICE_CTX(&ota_upgrade_client_ctx);

/* Initialize clusters' attributes. */
ota_client_attr_init();

/* Register callback for handling ZCL commands. */
ZB_ZCL_REGISTER_DEVICE_CB(zcl_device_cb);
}

then i am calling this function periodically:

UNUSED_RETURN_VALUE(ZB_GET_OUT_BUF_DELAYED(zb_zcl_ota_upgrade_init_client));

Both, the server and client are connected to the network but after calling zb_zcl_ota_upgrade_init_client nothing happens - I expect the image download starts automatically and on the client side the callback zcl_device_cb be called with appropiate events type, but that does not happen.

Could anyone suggests what should I check first why it is not working? Maybe some additional initalization is needed, ie. the server is checking the file content before start sending it, maybe some additional checks are done inside the Zigbee stack and something is missing in the initialization to trigger the image download.
Any advice will be helpfull.

Best regards,
Michal.

  • Hi Michael,

    Can you please share the log from your devices? Are you able to share a sniffer log of the network traffic? If you have another DK or Dongle you can use it to capture a sniffer log by following the guide in nRF Sniffer for 802.15.4. Please share the sniffer log as a pcap file. 

    From the example I took only the code related to the OTA cluster

     Can you clarify what you mean by this? Are you only using the OTA cluster? Or do you mean that the only things you copied from the OTA example were things directly related to the OTA cluster? Do you still have functionality required by the Zigbee stack in your example, such as for example zboss_signal_handler, zboss_start/zboss_start_no_autostart, zboss_main/zboss_main_loop_iteration, etc?

    I also see that some parts of your code seem to be from earlier versions of the SDK. You should not use things from different SDK versions together. This might cause errors or unexpected behavior, and we cannot guarantee that things will work as you expect. Some examples are ZB_GET_OUT_BUF_DELAYED, which was replaced with zb_buf_get_out_delayed(zb_callback_t callback) in v4.0.0, and ZB_BUF_FROM_REF, which was deleted in v4.0.0. See Zigbee stack migration guide: v3.2.0 to v4.0.0 for more information regarding stack related changes between the versions.

    Best regards,

    Marte

Related