2021-08-18 11:14 PM
Multiple Zigbee examples in STM32Cube_FW_WB applications tree fail to start by triggering assertion failure in APP_ZIGBEE_ConfigEndpoints.
The code under questions is
static void APP_ZIGBEE_ConfigEndpoints(void)
{
struct ZbApsmeAddEndpointReqT req;
struct ZbApsmeAddEndpointConfT conf;
memset(&req, 0, sizeof(req));
/* Endpoint: SW1_ENDPOINT */
req.profileId = ZCL_PROFILE_HOME_AUTOMATION;
req.deviceId = ZCL_DEVICE_ONOFF_SWITCH;
req.endpoint = SW1_ENDPOINT;
ZbZclAddEndpoint(zigbee_app_info.zb, &req, &conf);
assert(conf.status == ZB_STATUS_SUCCESS);
...
}
conf structure is not initialized, and it seems ZbZclAddEndpoint does not touch it at all leaving status member as is, causing the assertion to fail.
This problem is observed in multiple applications, OnOff_{Server,Client}_Distributed, OnOff_Client_Router and OnOff_Server_Coord. Other applications are very likely to have to the same problem.
2021-08-20 08:38 AM
We do not face such issue with our projects. Could you give us a bit more info?
2021-08-20 01:01 PM
STM32CUBEIDE: 1.7.0 on MacOS
Board: P-NUCLEO-WB55-NUCLEO
Wireless stack: stm32wb5x_Zigbee_FFD_fw.bin V1.12.0
Zigbee_OnOff_Server_Coord was selected and started as a project through Example Selector.
Straight out of the box build gave no errors.
Started debugging, trace output gives following messages and the execution stops in the tight loop in _exit.
[M4 APPLICATION] **********************************************************
[M4 APPLICATION] WIRELESS COPROCESSOR FW:
[M4 APPLICATION] VERSION ID = 1.12.0
[M4 APPLICATION] FW Type : FFD Zigbee stack
[M4 APPLICATION] **********************************************************
[M0] [00000000.000][API] Init_ZigbeeStack_Infrastructure
[M4 APPLICATION] APP_ZIGBEE_StackLayersInit
assertion "conf.status == ZB_STATUS_SUCCESS" failed: file "/Users/shinoda/STM32CubeIDE/workspace_20210731/Zigbee_OnOff_Server_Coord/STM32_WPAN/App/app_zigbee.c", line 270, function: APP_ZIGBEE_ConfigEndpoints
Some experiments on values of conf.status in to and out of ZbZclAddEndpoint() shows conf.status is not touched at all. It goes in and comes out unchanged. So the ASSERT is tested against a random value in stack.
2021-08-31 05:25 AM
The issue is not reproduced and we need additional inputs to know when it happens.
The APP_ZIGBEE_ConfigEndpoints() function is heavily used in all examples and no specific issues have been found so far.
On our side, we initialized the parameter conf.status inside the function static void APP_ZIGBEE_ConfigEndpoints(void) and we checked this parameter after a call to ZbZclAddEndpoint(). We can confirm this this parameter is overwritten.