HW: CC2530
SW: Z-Stack 3.0.2
Compiler: IAR 10.30
Coordinator: Zigbee2MQTT
THE BASICS:
I am working with some CC2530 devices that act as End Devices and connect to a network provided by Zigbee2MQTT. They are simple switches with two buttons:
P2.0 is used for Commissioning.
P0.1 is used as a switch.
Both pins use interrupts.
THE CASE:
I used the GenericApp as the foundation for the project and then incorporated parts from the SampleSwitch to enable the switch function. It works perfectly. After a fresh flash and when I start the Commissioning process, the device successfully joins the network, is interviewed, and paired. It also sends the on/off commands - everything is good.
static void zclGenericApp_HandleKeys( byte shift, byte keys ) { if ( keys & HAL_KEY_SW_1 ) { bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING); } if ( keys & HAL_KEY_SW_6 ) { if (isToggleSet1) { zclGeneral_SendOnOff_CmdOn( GENERICAPP_ENDPOINT, &zclGenericApp_DstAddr, FALSE, bdb_getZCLFrameCounter() ); } else { zclGeneral_SendOnOff_CmdOff( GENERICAPP_ENDPOINT, &zclGenericApp_DstAddr, FALSE, bdb_getZCLFrameCounter() ); } isToggleSet1 = !isToggleSet1; } if ( keys & HAL_KEY_SW_5 ) { } }
However, the End Devices are battery-powered and need to go into Power Saving mode. To achieve this, I did the following:
Enabled POWER_SAVING as a compiler option.
In f8wConfig.cfg, the setting RFD_RCVC_ALWAYS_ON is set to FALSE.
THE PROBLEM:
After flashing the device with these settings and initiating the Commissioning process, the process starts but suddenly stops. According to the logs, the device joins the network but fails the interview:
2023-10-24 19:38:15 Zigbee2MQTT started! 2023-10-24 19:38:36 Device '0x00124b00279e698d' joined 2023-10-24 19:38:36 MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x00124b00279e698d","ieee_address":"0x00124b00279e698d"},"type":"device_joined"}' 2023-10-24 19:38:36 MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":{"friendly_name":"0x00124b00279e698d"},"type":"device_connected"}' 2023-10-24 19:38:36 Starting interview of '0x00124b00279e698d' 2023-10-24 19:38:36 MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0x00124b00279e698d","ieee_address":"0x00124b00279e698d","status":"started"},"type":"device_interview"}' 2023-10-24 19:38:36 MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"interview_started","meta":{"friendly_name":"0x00124b00279e698d"},"type":"pairing"}' 2023-10-24 19:40:54 Failed to interview '0x00124b00279e698d', the device has not been successfully paired.
I doubt the problem is related to Zigbee2MQTT, as it functions perfectly without Power Saving. The issue must be related to my code somewhere, even though I used the standard sample applications with minimal customization.
I suspect the device goes into power saving mode before the Commissioning process is finished. However, I have no idea why this is happening. I am completely stuck.
As a last resort, I kindly ask for your help.
Please ask for any code snippets, files, etc., that could help identify the problem. Just to clarify, I don't have access to a sniffer.
A link to where the source files can be seen: