cancel
Showing results for 
Search instead for 
Did you mean: 

Zigbee Persistent storage and control issue on STM32WB5MMG

HardWins
Associate II

Hello,

I'm working on a hobby project where I'm trying to control AC via IR signals controlled through Zigbee and Home Assistant. Thus, I'm working on STM32WB5MM-DK, currently experiencing with the zigbee part of the project as the other parts of the project are already functional.

I'm using STM32Cube of course and first tried -- successfully -- to join my Home Assistant zigbee network, this part is working correctly. The fact is that I now want to be able to store the network parameters and then rejoin it after a reboot or reset of the STM32. Good news is that there is a solution: Persistent storage as described in AN5492.

I read the AN5492 and the Zigbee_OnOff_Router_NVM example. My current code is globally a copy/paste of the Zigbee_OnOff_Router_NVM example with one GPIO control in the On/Off callback. The clusters I'm using are Commissioning (Server) and On/Off (Server), both on the same endpoint. While I can still join my network if the NVM is cleared from any Zigbee-related value, once the connection is successful, if I reboot the device, the STM32 can successfuly connect but is only controlable via Zigbee for a short time: Especially between two persistency callback call (see below):

HardWins_0-1727628900060.png

As you can see on this picture, the Zigbee commands On/Off are successful between the two notifications but once the second on is called, it stops responding to any command...

As I didn't read anywhere about a blocking call and the code has no such call, I'm asking for help !

I'm using Zigbee FFD FW V1.19.1 on STM32WB5MMG (STM32WB5MM-DK). The persistency is done exactly like the example, using EEPROM Emulation.

 

I can share my code without problem if needed, the main code I have changed is app_zigbee.c, attached to this post

 

Thank you for reading, and helping !

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @HardWins ,

Please find below an update of your app_zigbee.c file modified with the right config capabilities to enable Rx ON IDLE allowing to receive ON/OFF Command from the Client.

The application has been tested with a WB Nucleo coordinator and it is working as expected.

Regards,

Ouadi 

View solution in original post

16 REPLIES 16
Ouadi
ST Employee

Hi @HardWins,

In your app_zigbee.c file I don't see the part related to the persistence management, is it the right file ? 

Can you describe the status of your network after the second call of persistence callback ? Have you been able to debug and see if there is any hard-fault making the communication not possible ? Need some additional information here.

Kind regards,

Ouadi

Hi @Ouadi ,

You are right, I submitted the wrong file... My apologise for this. Please find attached the correct one this time.

NVM-related functions are defined at the end of the file.

 

Actually, I don't understand why there is this second call... As far as I understand, the first one is caused by the ZbStartupPersist ending with SUCCESS (as described in the ZbStartupPersist function -- zigbee_core_wb.c) but the second one, I can't understand for now.

Why do you mean by "describe the status of the network ?". There is no hardware modification: Both STM32 and coordinator are static, the antennas don't move, the hardware configuration of the network does not change while testing. All other Zigbee peripheral are still responsive, the coordinator is still collecting and sending data to the other peripherals. Does this informations fill your request ? Apparently the only thing the coordinator tells me is that there is no more active endpoints on the device.

 

Thank you !

 

Hello,

Thanks for the updated file.

My question was directed on the software part to know if the device is still active on the network or if there is any leave performed. 

The notification callback is called each time a persistent data change occurs in the Zigbee network, a wireshark capture will be appreciated to further analyze. 

Have you been able to make a breakpoint after this second callback to know if the program is blocked somewhere ?

regards,

Ouadi

Hello,

Please find attached a PCAP with selected packets between coordinator (0x0000) and end-device (0x69d0). As we can see on the picture below (full file attached), the device request seems to timeout for whatever reason.

HardWins_0-1727693762867.png

 

Regarding the breakpoints, I didn't noticed any issue. The sequencer goes back to UTIL_SEQ_Run once the second callback is issued and does not seems to be blocked, looping inside UTIL_SEQ_Run. But as we can see on the PCAP, it does not responds to the On/Off command.

 

Regards,

Hi,

Could you please share the network key to decrypt the packets ?

Regards

Of course:

d7:35:01:45:be:da:a9:b0:7a:0c:95:80:c3:6c:bb:bb

Thanks for the information.

I now understand the reason why the device does not receive all the ON/OFF commands sent from the coordinator.

Indeed, the device is configured as a Sleepy End Device and goes to the sleep mode most of the time and wakes up after the End device timeout to perform the data poll request, during the sleep period, the SED has the radio off and can not receive any packet over the air.

For your case, I recommend to configure your device as a router, you can refer to Zigbee_OnOff_Router_NVM example. 

Best regards,

Ouadi

HardWins
Associate II

Hello,
My device is defined as an "end device" but sleepy mode is "off". I tried with Device Role equal to "router" but the issue is still present.

HardWins_0-1727698666431.png

 

Nevertheless, knowing that the device goes into sleep mode is a good track. How do you see that ? I also tried to switch from "centralized" to "distributed" but the issue is still there.

Thank you

Ouadi
ST Employee

Hello, 

The device remains sleepy even when disabling the sleep mode on CubeMX, we are working on this issue and it will be solved in next release. 

Can you try with this updated file ?

Regards,

Ouadi