2020-06-16 05:43 PM
My goal is to have a coordinator connected to sleepy end devices. The coordinator will periodically request measurements from the end devices. It seems like all the examples have requests going from the nodes to the coordinator, so I'm having trouble reversing it for my implementation.
Right now I'm using the Zigbee_PressMeas application example from STM32Cube_FW_WB_V1.6.0 as a base. I want a custom callback on the client when the server issues a request, which will cause the client to take a measurement and respond.
This is my client code in app_zigbee.c from APP_ZIGBEE_ConfigEndpoints(void:(
// Cluster Setup
zigbee_app_info.press_meas_client = ZbZclPressMeasServerAlloc(zigbee_app_info.zb, SW1_ENDPOINT, ZCL_PRESSURE_MIN, ZCL_PRESSURE_MAX);
assert(zigbee_app_info.press_meas_client != NULL);
zigbee_app_info.press_meas_client->report = &zcl_press_meas_press_client_report;
// Find the Attribute Object
struct ZbZclAttrListEntryT pressure_attribute_entry;
struct ZbZclAttrT pressure_attribute;
pressure_attribute_entry = *(ZbZclAttrFind(zigbee_app_info.press_meas_client, ZCL_PRESS_MEAS_ATTR_MEAS_VAL));
pressure_attribute = *(pressure_attribute_entry.info);
// Print to verify the Attribute
printf("\r\nPressure_Attr ID Number: %d\r\n", pressure_attribute.attributeId);
// Assign a callback function
pressure_attribute.callback = &APP_ZIGBEE_custom_pressure_read_cb;
// Register the Cluster
ZbZclClusterEndpointRegister(zigbee_app_info.press_meas_client);
I think it's ignoring my custom callback and simply using the default request handler.
Thanks!
2020-06-23 04:39 PM
It looks like I didn't have my attribute flags set to enable read requests. I got my code to work after adding custom attributes on the client side. Set the client attribute read flag and callback address. Then call a ReadReq() from the server.
2020-07-04 08:07 AM
Since I can't seem to post new topics to create my own question I will hijack your thread, sorry about that = )
I have acquired a P-NUCLEO-STM32WB55 board and am trying to develop a sensor+actuator network with it.
The sensor+actuator part is done and I would now like to connect the end-node to a coordinator to send and receive messages.
From what I gathered I can use Zigbee or OpenThread, for range reasons (>50m). However the examples are specific to EWARM or KEIL platforms. Can you point me to some examples for the provided STM32CubeIDE, some way to import those projects or another approach altogether?
Examples on how to create basic network interaction using STM32CubeIDE will also be greatly appreciated =)
Cheers!
2020-07-06 08:39 AM
I'm assuming you've downloaded the STM32WBCube software? (https://www.st.com/en/embedded-software/stm32cubewb.html). There is only one Zigbee application with a STM32CubeIDE example (OnOff_Server_Coord). However we found it's easy to use this project as a base and swap the other example main and app_zigbee files to get the other examples working.
To get the OnOff_Server_Coord working:
To get the Zigbee_OnOff_Client_Distrib working:
2020-11-26 06:11 AM
Hello. I can't post new topics too...
This one was quite encouraging for me, but I still not working.
My goal :
I'd like to read the device temperature (cluster server) (for exemple) only when a attribute read request is received (from client cluster). For this scenario, I don't want my device reading periodically the temperature to update the server cluster attribute.
Quite close from MCope.1 use case.
In AN5498 §3.2.3, this is perfectly what I want to do : install a callback when the attribute is accessed.
But I was not able to find how to configure the cluster to call the callback once's I wrote it.
Are there any examples from the API (I did not found any) ? or from anyone ?
I read this current topic, seems clear, but I was not able to adapt the solution inside my code (older API ?)
/* Temperature */
zigbee_app_info.temperature_server_1 = ZbZclDevTempServerAlloc(zigbee_app_info.zb, SW1_ENDPOINT);
assert(zigbee_app_info.temperature_server_1 != NULL);
// Find the Attribute Object
struct ZbZclAttrListEntryT temperature_attribute_entry; // COMPILE ERROR ZbZclAttrListEntryT not existing (even after text search inside API repository)
struct ZbZclAttrT temperature_attribute;
temperature_attribute_entry = *(ZbZclAttrFind(zigbee_app_info.temperature_server_1, ZCL_DEV_TEMP_CURRENT)); // COMPILE ERROR ZbZclAttrFind not existing (even after text search inside API repository)
temperature_attribute = *(temperature_attribute_entry.info);
// Assign a callback function
temperature_attribute.callback = &APP_ZIGBEE_ReadTemperatureRequest_cb;
temperature_attribute.flags = ZCL_ATTR_FLAG_CB_READ; // to activate callback when the attribute is read by the client cluster
ZbZclClusterEndpointRegister(zigbee_app_info.temperature_server_1);
Thanks !
Pascal