¿How can I do to register End devices in different cluster?, for example, if I have 3 End Device and I want to assign one ED in different cluster of the others.
I´m using GenericApp (Zstack), SmartRF 05 EB 1.8.1 and CC2530.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
¿How can I do to register End devices in different cluster?, for example, if I have 3 End Device and I want to assign one ED in different cluster of the others.
I´m using GenericApp (Zstack), SmartRF 05 EB 1.8.1 and CC2530.
Change the code in your one special ZED as shown below in red:
/*********************************************************************
* GLOBAL VARIABLES
*/
// This list should be filled with Application specific Cluster IDs.
const cId_t GenericApp_ClusterList[GENERICAPP_MAX_CLUSTERS] =
{
GENERICAPP_CLUSTERID + 1
};
const SimpleDescriptionFormat_t GenericApp_SimpleDesc =
{
GENERICAPP_ENDPOINT, // int Endpoint;
GENERICAPP_PROFID, // uint16 AppProfId[2];
GENERICAPP_DEVICEID, // uint16 AppDeviceId[2];
GENERICAPP_DEVICE_VERSION, // int AppDevVer:4;
GENERICAPP_FLAGS, // int AppFlags:4;
GENERICAPP_MAX_CLUSTERS, // byte AppNumInClusters;
(cId_t *)GenericApp_ClusterList, // byte *pAppInClusterList;
GENERICAPP_MAX_CLUSTERS, // byte AppNumInClusters;
(cId_t *)GenericApp_ClusterList // byte *pAppInClusterList;
};
Hi Dirty Harry, when you say "one special ZED", I´m not sure what it means, because the GenericApp (my base code) has a EndDeviceEB "profile" but it is general for all my ZED, how can I do to create different code for each ZED?
Also I don´t know if this piece of code:
GENERICAPP_MAX_CLUSTERS, // byte AppNumInClusters;
(cId_t *)GenericApp_ClusterList, // byte *pAppInClusterList;
GENERICAPP_MAX_CLUSTERS, // byte AppNumInClusters;
(cId_t *)GenericApp_ClusterList // byte *pAppInClusterList;
has to be repeated or something is wrong.
You are just noticing a little typo in the comments, which should be this:
GENERICAPP_MAX_CLUSTERS, // byte AppNumInClusters;
(cId_t *)GenericApp_ClusterList, // byte *pAppInClusterList;
GENERICAPP_MAX_CLUSTERS, // byte AppNumOutClusters;
(cId_t *)GenericApp_ClusterList // byte *pAppOutClusterList;
If and when you have any doubt, go to the source, which in this case is the definition of the SimpleDescriptionFormat_t type:
// Simple Description Format Structure
typedef struct
{
uint8 EndPoint;
uint16 AppProfId;
uint16 AppDeviceId;
uint8 AppDevVer:4;
uint8 Reserved:4; // AF_V1_SUPPORT uses for AppFlags:4.
uint8 AppNumInClusters;
cId_t *pAppInClusterList;
uint8 AppNumOutClusters;
cId_t *pAppOutClusterList;
} SimpleDescriptionFormat_t;
Hi Dirty Harry, now I´m trying to send diferent messages to the clusters (2 clusters), I create one cluster GENERICAPP_CLUSTERID) and other (GENERICAPP_CLUSTERID +1), but when I try to send a message to GENERICAPP_CLUSTERID+1, the message is not send, I just can send the message to GENERICAPP_CLUSTERID (I´m using AF_dataRequest() to send the message, and I use the right cluster in each case).
ZigBee is not a trivial specification, even to begin with, but now over the years it has become quite complex. Nevertheless, you are lacking some very basic understanding of the most fundamental aspects of ZigBee addressing - as a very loose comparison, endpoints and cluster Id's are like the final addressing of ports or sockets in internet protocol. So please search this forum - it is full of discussions about endpoints, cluster ids, bi-directional communication, etc. You can read the ZigBee spec or excerpts from it. There is a ZigBee training on the Wiki pages found from this forum. Etc.
Dear Leonardo
Let's clarify your question first. Do you want three end devices of different types or you want them as the same type. If they are the same type, you just use their short address respectively to send them messages. If they are different types, then you need to create different clusters.
Regards!
Hi Yikai, I need 3 different end device so I need 3 cluster (one for each one), I need to send data from each ZED to my coordinator (ZCO), and then, the ZCO process the Data and return a new data to each ZED. I can send the first data of one ZED to my ZCO and capture the data in ZCO, but when I send the return data from ZCO to my ZED (using the short Address of my ZED) I can´t captura that. So I have 2 questions.
1. ¿How can I do to create 3 clusters?
2. ¿How can I do to read data in ZED side?
Dears,
I do not use ZED and ZCO but I suppose you can create your own cluster directly. You can check zcl_event_loop() in ZCL.c to see if you can receive this private cluster here. If yes, just add osal_msg_send( zcl_Your_TaskID, msgPtr ); in zcl_event_loop() to forward message to application layer.
Regards!
Hi Yikai, it´s Ok, I create two clusters, but my problem receiving the message in End Device side still. I´m doing this:
void GenericApp_MessageMSGCB (afIncomingMSGPacket_t *pkt){
switch (pkt -> clusterId)
{
case GENERICAPP_CLUSTERID :
if (GenericApp_NwkState == DEV_ZB_COORD){
uint16 var1 = ((uint16) pkt -> cmd.Data[0]);
uint16 mult1 = var1*2;
//create buffer... + send message using AF_DataRequest()
}
if (GenericApp_NwkState == DEV_END_DEVICE){
uint16 var2 = ((uint16) pkt -> cmd.Data[0]);
HalLcdWriteStringValue ("Var2", var2, 16, HAL_LCD_LINE_1);
}
.................... other code..
do you have any idea about I can´t receive data in end device side?
Dears,
You need to modify zcl_event_loop in zcl.c. Please add the red part into your code. Remember to change ZCLYour_TaskID to your own task ID.
uint16 zcl_event_loop( uint8 task_id, uint16 events )
{
uint8 *msgPtr;
(void)task_id; // Intentionally unreferenced parameter
if ( events & SYS_EVENT_MSG )
{
msgPtr = osal_msg_receive( zcl_TaskID );
while ( msgPtr != NULL )
{
uint8 dealloc = TRUE;
if ( *msgPtr == AF_INCOMING_MSG_CMD )
{
extern byte zclYour_TaskID;
osal_msg_send( zclYour_TaskID, msgPtr );
rawAFMsg = (afIncomingMSGPacket_t *)msgPtr;
zclProcessMessageMSG( rawAFMsg );
rawAFMsg = NULL;
}
else if ( zcl_RegisteredMsgTaskID != TASK_NO_TASK )
{
// send it to another task to process.
osal_msg_send( zcl_RegisteredMsgTaskID, msgPtr );
dealloc = FALSE;
}
// Release the memory
if ( dealloc )
{
osal_msg_deallocate( msgPtr );
}
// Next
msgPtr = osal_msg_receive( zcl_TaskID );
}
// return unprocessed events
return (events ^ SYS_EVENT_MSG);
}
// Discard unknown events
return 0;
}
Regards!
Hii Yikai Chen,
I am using GenericApp sample project of the Zstack V 2.5.1 to create my application. The same problem exists for me too. The end device does not respond to the message packet received. In my sample project there does not exist zcl.c file....So where and what changes do i need to make??
Thank You,
Pragya Agrawal
Hi Yikai Chen,
I also had another doubt. GenericApp uses same clusterid for sending and receiving data. So when a device sends data over the clusterid GENERICAPP_CLUSTERID, then how can I ensure that the device intended to receive the message does not simultaneously send the message but actually receive the sent packets over the clusterid GENERICAPP_CLUSTERID.
Thank You,
Pragya Agrawal
Hi Pragya,
I am sorry for the mistake. There is no zcl.c in GenericApp sample. You can set "GenericApp_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent;" in your AF_DataRequest parameter to send message from end device to coordinator after binding.