2024-01-18 11:59 PM - edited 2024-01-19 12:08 AM
Hello,
I have still connection problem to Tuya gateway. Simple OnOff application can connect to Tuya gateway, but when I try to connect STM32WB5MM-DK as a temperature sensor, connection fails.
Connection to Tuya gateway succeeds with STM32WB5MM-DK example OnOff_Server_Coordinator and On/Off button comes visible on SmartLife app. But with temperature sensor application connection won't work. The application things that it has succeed to connect, but nothing comes visible in SmartLife app. Little display shows "Join ok". According to Wireshark logs, temperature sensor won't reply to gateway's read attributes request where it wants to read basic attributes:
Command: Read Attributes (0x00)
Attribute: Manufacturer Name (0x0004)
Attribute: ZCL Version (0x0000)
Attribute: Application Version (0x0001)
Attribute: Model Identifier (0x0005)
Attribute: Power Source (0x0007)
Attribute: Unknown (0xfffe)
OnOff application responds for that, but not quite like should. Anyway connection succeed.
Connection shoud go according to that specification:
【Zigbee Popular Science Series】 - 3 Network Access Process - Tuya Developer Forum (tuyaos.com)
I attached three Wireshark log; WB5MM_OnOff__Server_Coord, WB5MM_TempMeas_Server_Coord and Nedis_capture. In both Server_Coord applications, I changed starttype --> join and also channel change to WPAN_2400MHZ.
I'am not shure is that the reason why connection fail, but this is at least first difference.
Solved! Go to Solution.
2024-02-01 01:56 AM
Another point, I noticed that you have configured your device to use a distributed network, which is not correct in your case, Tuya gateway use a centralized network and plays the role of the coordinator ( Trust Center)
This leads to a conflict in the TC key exchange between your device and coordinator as in a distributed network there is no TC link key exchanged.
I have updated your file with a router configuration.
Please give it a try and keep me informed of the result. Thanks
BR,
Ouadi
2024-02-01 03:33 AM
Hello,
In both of those versions (3 and 4) startupControl is ZbStartTypeJoin. In original Server_Coord version it was ZbStartTypeForm. Version 4 seems to work same way. The reason why I think device is not connected is that Smartlife app won't find my end device. As I stated ealier OnOff server works and Smartlife app finds it as OnOff light switch and it also works.
Esko
2024-02-01 11:41 PM - edited 2024-02-01 11:55 PM
Hello,
I tested again with example application WB5MM_OnOff_Server_Coord. I works fine. Strange thing is that it reports basic cluster info without basic cluster setup. With this application comes also error for writing attribut 0xffde, so it is not the issue, which prevents joining. I have to say, that joining don't go according what is stated in Tuya networking guide. There is no node descriptor request from server device.
Here is basic cluster info which comes without any modification into app_zigbee.c.
Frame 54: 124 bytes on wire (992 bits), 124 bytes captured (992 bits) on interface COM18, id 0
IEEE 802.15.4 TAP
IEEE 802.15.4 Data, Dst: 0x0000, Src: 0xe5c2
ZigBee Network Layer Data, Dst: 0x0000, Src: 0xe5c2
ZigBee Application Support Layer Data, Dst Endpt: 1, Src Endpt: 17
ZigBee Cluster Library Frame, Command: Read Attributes Response, Seq: 23
Frame Control Field: Profile-wide (0x18)
Sequence Number: 23
Command: Read Attributes Response (0x01)
Status Record, String: STMicroelectronics
Attribute: Manufacturer Name (0x0004)
Status: Success (0x00)
Data Type: Character String (0x42)
String: STMicroelectronics
Status Record, Uint8: 8
Attribute: ZCL Version (0x0000)
Status: Success (0x00)
Data Type: 8-Bit Unsigned Integer (0x20)
Uint8: 8 (0x08)
Status Record, Uint8: 49
Attribute: Application Version (0x0001)
Status: Success (0x00)
Data Type: 8-Bit Unsigned Integer (0x20)
Uint8: 49 (0x31)
Status Record, String: STM32WB
Attribute: Model Identifier (0x0005)
Status: Success (0x00)
Data Type: Character String (0x42)
String: STM32WB
Status Record
Attribute: Power Source (0x0007)
Status: Success (0x00)
Data Type: 8-Bit Enumeration (0x30)
Power Source: DC source (0x04)
I added Wireshark capture also. The modifications into app_zigbee.c file were only these:
zigbee_app_info.startupControl = ZbStartTypeJoin;
// Set the TC address to be distributed. */
config.security.trustCenterAddress = ZB_DISTRIBUTED_TC_ADDR;
// Using the Uncertified Distributed Global Key (d0:d1:d2:d3:d4:d5:d6:d7:d8:d9:da:db:dc:dd:de:df)
memcpy(config.security.distributedGlobalKey, sec_key_distrib_uncert, ZB_SEC_KEYSIZE);
config.channelList.count = 1;
config.channelList.list[0].page = 0;
config.channelList.list[0].channelMask = WPAN_CHANNELMASK_2400MHZ;
Next I try to modify WB5MM_OnOff_Server_Coord so, that it is temperature sensor server instead of OnOff server.
2024-02-02 01:12 AM
Hello,
The join process works fine also with Temperature application according to the logs and Wireshark capture, From WB device side, I don't observe any issue which may disturb the join, no leave request is sent after the association.
For me the investigation should be directed on the Tuya side to know why the SmartLife app does not display the device after a successful join.
Kind regards,
Ouadi
2024-02-04 11:01 PM
Hello,
Yes, it looks like device correctly joins, but something still missing. I'll ask from Tuya supoort can they find the reason. Thand you for all help Ouadi!
Regards, Esko
2024-04-18 06:08 AM
Hi,
I read your comments and I wonder what is the ioc file should be to use Zigbee server/client model. Is there specific pins that I have to use Zigbee on STM32WB5MMG processor? Or it is working internally connected, so we do not need to set up any pins to use zigbee. My intension is send/receive between two Zigbee network using STM32WB5MMG processors. I am not sure how to set the ioc file from STM32CubeIDE tool.
thanks in advance,
2024-04-18 06:10 AM
Hi Ouadi,
Can I know how
1. setting the ioc setting to use Zigbee send/receive?
2. How to call APIs to use Zigbee network from main() function? What is the include files and is there any simple example to send/receive data via Zigbee using STM32WB5MMG processors?
thanks in advance,
2024-04-19 03:46 AM
Hi @YJ99,
To activate Zigbee using CubeMX tool, you need to enable :
Then you can activate Zigbee under Middleware -> STM32_WPAN
After generating your Zigbee project, you have to implement the right APIs to design your custom application.
You can refer to our Github repo following this link Zigbee Project Examples containing a variety of Zigbee applications that may help you to get started with Zigbee.
For any other question, I suggest to create a new post.
Best regards,
Ouadi
2024-04-20 09:34 AM
Hello,
Sorry for late answer. I didn't use the CubeMX tool at all. I just modified ready made example project. Status of this issue is such that I am experimenting with esb32-c6 same thing. The structure of clusters is different in a esb32 zigbee example. It responds to the active endpoint request and joining to the Zigbee network works but binding is still problem. I'll return to this issue.
Esko
2024-09-28 12:21 PM
Hi Esko,
I have found this topic because I am standing at the same point rn: I could connect my On/Off project to Tuya/Smartlife, but with any other functionality I cannot achieve this. The MCU however thinks it joined the network.
Could you solve this problem and could you share your solution?
I assume an alternative would be to use somethin else than Tuya, maybe Zigbee2mqtt with HA, since it seems that this is a Tuya/Smartlife issue?