Tool/software:
Hello. I have a Zigbee temperature sensor end device and have been encountering communication issues which I assume might be resolved with a board reset.
The issue: the board would randomly disconnect from the coordinator, but remain powered-on and unable to send any data.
My attempt to fix this: should the board disconnect, no more messages should reach the Zigbee stack. Thus, I could use a timer that would trigger a board reset and hope that, upon booting up again, the connection will be restored and things will work again.
However, it seems that I cannot get the timer to correctly reset and it triggers constantly.
I've created a UtilTimer with a period of 5 minutes (in milliseconds) inside zclSampleTemperatureSensor_initializeClocks .
communicationClkHandle = UtilTimer_construct(
&communicationClkStruct,
communicationTimeoutCallback,
communicationResetDuration,
communicationResetDuration, true, 0);
I want it to be reset every stack message I get, thus never trigger the callback (which only lights up an LED for now, so nothing interesting). I've picked zclSampleTemperatureSensor_processZStackMsgs for this and tried a couple of ways to get the timer reset.
static void zclSampleTemperatureSensor_processZStackMsgs(
zstackmsg_genericReq_t *pMsg)
{
UtilTimer_setTimeout(&communicationClkHandle, communicationResetDuration); // does not do anything, callback triggers constantly
switch (pMsg->hdr.event)
...
}
static void zclSampleTemperatureSensor_processZStackMsgs(
zstackmsg_genericReq_t *pMsg)
{
UtilTimer_stop(&communicationClkStruct);
UtilTimer_start(&communicationClkStruct); // same behaviour
switch (pMsg->hdr.event)
...
}
Looking through util_timer.h, I cannot see any other function that seems useful.
How can I reset a timer so that it would only trigger were the board disconnected?