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.

Create two endpoints in a device

Other Parts Discussed in Thread: CC2530, CC2538, Z-STACK, CC2531

Folks,
I am having one ZC and ZED, in the ZED having 3 sensors and one relay with light. I want to create two endpoints. One for sensors and other for relay(on/off) device. How can i proceed. ZED should send sensors value to ZC and ZC will check the value, if abnormal and send a message to on/off the light to ZED.

  • To create second endpoint, you can make a copy of zclxxx_Init and do everything similar. Use zclSampleLight_Init as a example, you can revise it to zclSensor_Init and fill the following data:

    void zclSensor_Init( byte task_id )
    {
      zclSensor_TaskID = task_id;

      // This app is part of the Home Automation Profile
      zclHA_Init( &zclSensor_SimpleDesc );

      // Register the ZCL General Cluster Library callback functions
      zclGeneral_RegisterCmdCallbacks( Sensor_ENDPOINT, &zclSensor_CmdCallbacks );

      // Register the application's attribute list
      zcl_registerAttrList( Sensor_ENDPOINT, Sensor_MAX_ATTRIBUTES, zclSensor_Attrs );

      // Register the Application to receive the unprocessed Foundation command/response messages
      zcl_registerForMsg( zclSensor_TaskID );
     
      // Register for all key events - This app will handle all key events
      RegisterForKeys( zclSensor_TaskID );

      // Register for a test endpoint
      afRegister( &Sensor_TestEp );
    }

    and revise "zclSampleLight_Init( taskID );" to the following two lines in osalInitTasks().

    zclSampleLight_Init( taskID++ );

    zclSensor_Init( taskID );

    Those are initial steps for your reference. You need some more efforts to add code to serve the function on seconds end point.

  • I have created two endpoints, From The ZED it is working fine, Sensor data is sending Periodically. In the ZC, I having issues. 

    static void zclSampleLight_ProcessInReportCmd( zclIncomingMsg_t *pInMsg )
    {
    zclReportCmd_t *pReportCmd;
    pReportCmd = (zclReportCmd_t *)pInMsg->attrCmd;


    if (pReportCmd->attrList[0].attrID == ATTRID_MS_RELATIVE_HUMIDITY_MEASURED_VALUE)
    {

    int16 hum;
    char val[4];

    hum = *(int16*)pReportCmd->attrList[0].attrData

    if(hum >= 35)

    {

        HalLedSet ( HAL_LED_4, HAL_LED_MODE_ON );

    }

    else

     HalLedSet ( HAL_LED_4, HAL_LED_MODE_OFF);

    sprintf(val,"%d",hum);

    #if defined( LCD_SUPPORTED )

    #ifdef HAL_MCU_CC2530
    HalLcdWriteScreen( "Humi Value", val);


    }


    if (pReportCmd->attrList[0].attrID == ATTRID_MS_TEMPERATURE_MEASURED_VALUE)
    {
    int16 temp;
    char val[4];

    temp = *(int16*)pReportCmd->attrList[0].attrData

    sprintf(val,"%d",temp);

    #if defined( LCD_SUPPORTED )

    #ifdef HAL_MCU_CC2530
    HalLcdWriteScreen( "Temp Value", val);

    #endif
    }
    }
    #endif 

    1)If hum value <35, led 1 is turning off, then it's turned on for next event receive, Even though hum value is <35.

    2)In the ZED, if i comment all temperature related stuff(only one endpoint ie humidity sensor). In the ZC it is entering the in the loop  if (pReportCmd->attrList[0].attrID == ATTRID_MS_TEMPERATURE_MEASURED_VALUE) and displaying the temp value with some junk val.

    This shows that, pReportCmd->attrList[0].attrID whether it is attribute of temperature or Humidity, it's entering the both if condition.

    Did i done mistake or any other stuff need to add in ZC to get a two endpoints value 

  • You should process cluster id of reporting command first in zclSampleLight_ProcessInReportCmd.

  • Dear Yikai Chen,

    could you please give me the steps for creating two endpoints on same cc2530 Zigbee device I am facing some problem

    i have compiled the code ,and try to generate the SerialApp and TransmitApp to work on different end points as per the instruction i have made the changes in Osalinit(),and loop_event handler registration function but did not get the code work as code got compiled successfully but after compilation key_event is not generated as any of devices is not sending or receiving the match_desc_req() so that a link can be established , and i can proceed the data transmission as you know serialApp will start sending the character on terminal and transmitApp give the rate of transmission ,I have compiled the programme so many times and it is not working please help me.give me the steps or proper reference so that I can make two endpoint working,

  • From your descriptions, I don't know how to help. Would you describe your work step by step and point out what your problem is. If you can post your source code, It might be helpful to find the problem.

  • Hello Sir,

    I am suffering from immense problem As I just want to use two endpoint which can be used to run two different application to run simultaneously on same cc 2530 board I have tried it also but code did'nt work can you please help here I am attaching  the code also.

    7120.Source.zip

    please do have a look and correct me. I am in trouble.

  • You can't register key event callback twice, i.e. in both SerialApp_Init and TransmitApp_Init. Since you call SerialApp_Init  before TransmitApp_Init, KEY_CHANGE will only be sent to SerialApp_ProcessEvent.

  • Thanks for reply Sir, I have corrected it, but still I am not able to run Two sample Application Simultaneously

    is it feasible or Not for cc 2530 to run Two different Application on Two endpoints Simultaneously, If yes plz tell me the way  to achieve this.

    thanks & regards

    Manish

  • Actuall, you have run two application in your example. I don' undrstand your problem. Would you describe your application scenerio and why do you think you need two end point?

  • Thanks Sir once again for Your Concern and guidance.

    I want to Run two Application Simultaneously on Each cc 2530 devices SerialApp.c and any one Application Say GenericApp.c Aim is to check whether I can control the Endpoint Application from different Endpoint Application 

    for example I just want to control the different profile application running on some different Endpoint, suppose if i send some character from terminal over the air to another device than on receiving side GenericApp that is running on some other endpoint will start sending some other String eg" MANISH".

    Ultimate Aim Is control multiple endpoint of Another device on which different profile applications Are running

    that what I am trying Is it Feasible?

    If yes suggest me the way of integrating the code for such reqiurement.

    Thank & regards

    Manish. 

  • No, still not get your idea. Please describe your intentions step by step  so I can try to help.

  • Sir,

    As we know one CC 2530 Zigbee(Zsatck) has 0 to 240 endpoints on which we can run application object of different or same profile.i just want to run two application simultaneously on single CC 2530 device on its different endpoints.

    ok now we have one cc 2530 which has SerialApp on one Endpoint say (22) and GenericApp on another endpoint say (40)

    similarly on second device SerialApp on endpoint (22) and GenericApp on endpoint(40) 

    So till now we have two cc 2530 out of which on both we have serialApp and GenericApp running on different endpoints now GenericApp will keep on sending "Hello world" now If i press some character from PC terminal the character will be received by one cc 2530 serialapp running on endpoint(22) will send this character to other cc 2530 over the air which receives this character through the receiving function of serialApp now that character will conrol the  GenericApp on endpoint (40) and now instead of sending "Hello world" it starts sending "MANISH" such kind of implementation I want for such i need code integration  serialApp and GenericApp on same device but on different endpoints and serialapp controlling the GenericApp on the device.

  • Yes, I think it is no problem to do that. I suggest you to following Multi-endpoint device implementation at http://processors.wiki.ti.com/index.php/Multi-endpoint_device_implementation. First, make sure the GenericApp and SerialAPP can run on 2 separate endpoints. Then, try to send event from SerialAPP to GenericAPP when SerialAPP receives data and you want to change the display message on GenericAPP. 

  • Hello Yikai Chen Sir,

    Thanks For all your replies, I have tried that and was working Now I am moving on Home Automation ,I am trying to control multiple light on single device that is CC 2530.what i tried is , I have used two Sample light application and follow the steps that were mentioned in the link you have provided to me.I have used Two endpoints for  samplelight applications endpoint 20 and endpoint 23 ,i have used the same sample light application with renaming it to samplelight1.c,samplelight1.h and samplelight1_data.c and add all these three files in OSAL_Samplelight.c have added the 

    " zcl_samplelight1.h"

    zclsamplelght1_event_loop

    zclsamplelight1_Init();

    but after compiling I am getting these two errors

    zclsamplelght1_event_loop  is "undefined"

    zclsamplelight1_Init(); is declared "implicitely"

    here I am sending my source code to you please find the attachment and one more important thing is  I have tried the same procedure of using two endpoints on single device with switch and Light application on same device but on different endpoint  I have used  endpoint num 20 and 23 respectively on one device CC 2530 and same switch and light application on another cc 2530 device on interchanged endpoint 23 and 20 and this application is working fine i can control the light of one device with switch on another device and vice-versa,

    So please help why I am getting this error in case of sampleLight application in which I am trying two light on single device but on different endpoints.8524.Code.zip

    please find the attachment for the same .

  • Hi Everyone, 

    Thanks for the posts. I was wondering if someone could help me with a similar problem:

    I am using Smart Energy, and I have successfully added two end points to the Load Control Node. I can successfully send a separate load-control-event to each end-point.

    However, when I power up the node, I only get one simple-descriptor response from it, when the ESP sends out the simple-descriptor-request for it.

    Should I not be expecting two simple-descriptor responses, one for each end point? If true, how can I accomplish this?

    My general procedure for adding the other end-point is listed below:

    - Duplicate the loadControl.c file, and rename it and all the names within it to suit a new end-point.

    - Duplicate the loadControl_data.c file, and rename everything for the new end-point.

    - Add the new files above to the loadcontrol workspace.

    - Open loadControl.h and duplicate the various externs and constants as required for the new end-point.

    - Insert newEndPoint_event_loop into tasksArr[].

    - Insert newEndPoint( taskID ) into osalInitTasks().

    Thanks for your time to try and help me.

  • Dear Yikai Chen Hello,

    I have few doubts hope you can resolve these problem

    1.)  Write now I am using CC 2530, I want to know how many Endpoint can be used at a time simultaneously .

    2.) I want to know that, can a Single Switch Application control a device having multiple endpoints where each endpoint is programmed with a light application object.

    3.) Can your CC 2538 support Multiple Endpoint , if Yes how many endpoints can it support if used simultaneously  at a time.

    4.) I have one application on light in which i am using 8 endpoints can i address and Control each of the endpoint independently  with single switch? if possible then could please suggest the way. 

    Thanks & Regards

    Manish Kumar

  • 1. A node may contain any number of endpoints (up to 240).

    2 & 4. It is doable. You just make your switch can send command to different endpoints and it is done.

    3. I don't play with CC2538 but I suppose it is no problem to have multiple endpoint on it. It also can have any number of endpoints up to 240.

  • Sir,

    Thanks for the Guidance Can you please give me some reference or Suggestions to Implement (2) and (4) as written in my previous post I want to do it with out any modification in stack ,

    As In Zstack Zcl API there are no API for sending command to particular endpoint of Light.

    please suggest a way to implement the same.

    Thanks & regards

    Manish Kumar.

  • Hi,

    The following info might help you:

    Do a "find in files" search for the address struct called "afAddrType_t". In this struct, you will notice that the one member is named ".endPoint", and this is how a end-point is addressed. This struct type is found in just about every API that involves the ZCL and sending of data out onto the Zigbee network.
    For example consider this API:

    zclGeneral_SendOnOff_CmdToggle( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr, false, 0 );
    The parameter "zclSampleSw_DstAddr" is of the struct type "afAddrType_t".

    (Note that "SAMPLESW_ENDPOINT" refers to the source end-point value and not the intended destination.)

    The general procedure for adding properly registered end-points is listed below:

    - Duplicate the <application>.c file, and rename it and all the names within it to suit a new end-point.

    - Duplicate the <application>_data.c file, and rename everything for the new end-point.

    - Add the new files above to the <application> workspace.

    - Open <application>.h and duplicate the various externs and constants as required for the new end-point.

    - Insert <application new end point>_event_loop into tasksArr[].

    - Insert <application new end point>( taskID ) into osalInitTasks().

    If this all makes sense, with all this info you should be able to accomplish your objectives in your points (2) and (4). 

    Perhaps Yikai Chen can comment further as he has much more experience than me.

    Oh, and it is most certainly possible to use the cc2538 for multiple end-points, as I have successfully done this.

  • Hi Manish,

    Dan answers you very clearly. I agree with him.

  • Hello Sir,

    I have successfully made two endpoints on light application, and controlled it by Single switch now I am trying to increase the number of endpoints on light side 

    for that i am following the same procedure, but i am able to produce only 16 endpoint on increasing it IAR shows that code is exceeding the memory size,

    I want to add more number of endpoint upto 32, can you please tell me the way , or is it possible in CC2530 for adding upto 32 endpoints 

    If yes please tell me HOW?

    Thanks and Regards

    Manish Kumar

  • I had use 5 end point at most in my application and I am pretty sure that you will hit the memory limits if you wan to use 32 end points on CC2530. If you do need to have so many end points on a device, I suggest you to use CC2538.

  • Thanks Sir,

    I have 1 switch and 12 light(on endpoint 11 to 23) giving on another cc2530 i want to control all the light but that i require binding but on sending the Match_Desc_Req(),

    I am getting only 9 endpoints connected to my switch in response,in epList[ ] ,is it in stack or something how many lights or say endpoint can bind to single switch or an Endpoint,

    if it is in stack How can i change it to 16 or more.as I am planning to control 16 device from single switch.

    Thanks and regards

    Manish Kumar

  • Do you increase NWK_MAX_BINDING_ENTRIES to enlarge binding table array?

  • Hello Sir,

    Thanks for all your Suggestions and Ideas,

    I have One CC2530 on which I am running Light Applications on 5 Endpoints and Controlling them all with Single Switch, Now I just want to know can I control all my lights that are running on 5 Endpoints with Any third Party Device or Say Third Party Switch

    Can this implementation is possible or any other way to do this ?

    Please tell me, As I want my light to get controlled by wulian and Control4 Device(Home Automation  Compatible Switches Only) 

    Thanks & Regards

    Manish Kumar.

  • Yes, you can do it without problem. In my application, I just bind every end point one by one.

  • Hello Sir,

    Its been good to hear that it is possible,

    Right Now I am sending the Link() from Switch and getting the endpoints of light and on each endpoint sending the command,

    Now my question 

    1.) How third party device will send command to each end point if it not programmed for it ?

    2.) How you are binding each end points so that third party switch is sending command on each endpoint and how it is recognizing the endpoint and application running over it ?

    3.) Are all these things in Zstack ?

    4.) You said that you have already implemented  can you tell me the reference or any idea ?

    5.) My aim is just to control my application multiple endpoint light by standard device Switch,because it will only send on off command,

    6.) Third Party device (switch) how it recognize or came to knw on which endpoint to send the command.

    Thanks and regards

    Manish

  • 1. When a light and switch join Zigbee network, you can request their activr end point and supported cluster. 2. After you have thoese infomation, you can use zdp_bindreq to bind light and switch one by one.
  • Hello Sir,

    Thanks for reply,

    1.) This implementation i can do on my Light application  but sir how about the Switch Third Party standard device how can i call up the Active endpoint from that standard device .

    2.) will it be called automatically when the device comes in the network ?

    3.) What is an issue with Match_desc_req() we are getting the Endpoint number from there also .

    4.) Or this is an standard approach fro doing HA

    5.) We only require one Switch application or we need multiple Switch Application on multiple endpoints as you are talking about individual binding.

    As i want to control my device (light Applications which are running on one CC2530 but on different endpoints simultaneously ) with switch of third party what approach should i do for that ?

    Thanks & regards

    Manish 

  • After an ZED joins network, it will send end node announcement and you can start the following steps:

    1. Use ZDP_ActiveEPReq to request all active endpoints on the ZED.

    2. Use ZDP_SimpleDescReq to request Simple Descriptor on each active endpoint.

    3. Use ZDP_BindReq to bind your light and 3rd part switch one by one.

    If you only have on switch and want to control light on different endpoints, you can bind the only switch to each endpoint one by one. In this case, the switch sends on command and all lights on different endpoints will be turned on. If you need to control them separately, you need to have multiple switches and bind them to different endpoints on light. Another possibility is that your 3rd switch also support multiple endpoints then you can bind different endpoints on switch to different endpoints on light one by one.

  • Hello  Yikai Chen Sir,

    Thanks for your help and suggestions I want to implement Mesh Networking using CC2530. So my needs are,

    1.)  I want to access the routing table of the network so that I can get the complete information about the network element say (Network Address, number of devices at what hop away from coordinator or command node it is) so that i can send the data from one (Coordinator ) to any Router or Say (End Device) or vice versa from any node to any node in the Network . 

    2.)  For that I have to have a Network Address or some ID's of all devices in the network.

    So, My questions to you is ?

    1.) How to implement  the Mesh Networking using CC2530?

    2.) How to Access the Routing Table and one more Important thing i need to ask,? Is routing table of Coordinator contains all the Information about the network elements  ?

    is there any reference Document to go through for Implementing it or can you please suggest me anything else to implement the Mesh Networking on Zigbee.

    Thanks and Regards

    Manish Kumar. 

  • 1. You can use SampleLight and SampleSwitch to create a Zigbee mesh network example. Choose One of SampleLight as coordinator and the others to be ZR and ZED. For the network, joins all the device and that's all.

    2. To control or communicate with the devices in Zigbee network, you don't need to know the routing table. You should use network address of devices to do that.If you need to know the routing table, you can refer to the discussion at http://e2e.ti.com/support/low_power_rf/f/158/t/303183.aspx

  • Hello Yikai Chen Sir,

    I have gone through the link given by you, and come to know that network Address will be sufficient to send the data to any remote node.

    Now I have few Questions.

    1.) Suppose I have a Light Coordinator and have mesh network associated with it I want to have a list network Addresses of All devices in the Network So that i can send the Data by selecting the Node's Network address.from Coordinator.

    What to do for having network Address of All devices in the mesh network ?

    I know About Device_Annce() but it will only used or beneficial in Many to One or Star.It is good But will be used for Specific kind of networking which gives network address at Boot up of Remote node.

    I want something same, so  that i can get network address of each and every node at time of network formation or boot up. So that i can send data or bind_req to that node from coordinator by selecting that particular network address. 

    2.) How can i have network address of all devices in the mesh network on Coordinator is it feasible ? if yes can you please tell me any references or way to implement such.

    Thanks and regards

    Manish kumar

  • In my experience, the easiest way to keep all network address is to use end node announcement.

  • Dear YiKai Chen ,

    I have CC2530DK from Texas Instrument for implementing a sensor node.

    I don't know how to work with.

    Please guide me how to start my research work.

  • Hi Amudha,

    What kind of sensor node do you want? I would suggest you to download and install ZStack home 1.2. There are lots of  examples inside and there is a temperature sensor example.

  • Hello Yikai Chen Sir,

    Thanks for all your suggestion I have implemented it successfully,

    Now I want to implement an application for controlling the dimmer light and level control switch that is HA compatible using ZCL library.

    1.) So could you please suggest me the way or references that i should follow for implementing such application .

    2.)My requirement is just to send the level command to Another cc2530 via Rf interface and there on serial I am decoding those levels.

    3.) I just want to implement such Application using HA Zcl Library.

    i just want to know steps or Api or references to refer before implementing such Application

  • You can find some API with prefix zclGeneral_SendLevelControl... in zcl_general.h.

  • Hello Sir,

    Thanks for Reply.

    I too know the API's After going through the documents ,Now I want to know how to write a code for controlling dimmerlight

    is there any reference document to go through or any thing else as i tried it today but it is not working.please suggest a way so that i can implement such solution.

    If you give me reference also that will be good for me or steps also works for me.

    Thanks And Regards 

    Manish Kumar

  • Hi Manish,

    You can revise SampleSwitch to send ZCL level control command. It should be not that hard.

  • Hello Sir 

    Error[Pe223]: function "zclGeneral_SendLevelControlMoveToLevel" declared implicitly C:\Users\Hb\Desktop\NewStack\ZStack-CC2530-2.5.1a\Projects\zstack\HomeAutomation\SampleSwitch\Source\zcl_samplesw.c 265

    this is the Error I am getting

    #if!defined (ZCL_LEVEL_CTRL)
    #define ZCL_LEVEL_CTRL

    zclGeneral_SendLevelControlMoveToLevel( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr,4, 1,false,0);
    #endif

    have done this modification along with device ID and Cluster ID

    may be some where in the stack we have to enable such call but i dont know where so please help.

    thanks and regards

    manish

  • zclGeneral_SendLevelControlMoveToLevel is defined in zcl_general.h. All you need to do is to define ZCL_LEVEL_CTRL in f8wZCL.cfg

  • Hello Sir,

    Thanks a lot have successfully implemented it,is this command is generic for controlling third party device also ?

    can we send this command to any third party device for controlling its level? if yes then ok or else what should we do for controlling third party light Dimmer(that regulates or may change its glowing level).

  • Yes, it is ok to control 3rd party level device.

  • Hello Sir,

    thanks for the Answer I have implemented and  control the Mesh Networking using Zigbee,

    is there any way to change the network topology at RUNTIME by calling any API or anything else if yes can you please give me suggestion or references

    what to do if I want to switch between from  mesh network topology to Star topology can we do it on run time?

    thanks and regards

    manish

  • No, there is no API that is used to change the network topology at RUN TIME.

  • Hello Sir,

    Means we can not change the topology at run time? by any any how.

    thanks and regards 

    manish

  • If you can turn off all router device at run time, it will become star network from mesh network.

  • Hello Sir,

    Thanks for all your suggestions and ideas it helped me a lot, with your help i am able to implement all those things

    Now I want make a single switch that can control the on/off light ,dimmer Light and AC can it be feasible .

    If yes will you please give me some suggestion because as far as i know we have to implement different switch application on different endpoint,

    that can control the device but from different end points.

    can we implement a single application at single endpoint to control light ,dimmer(different level light) and AC control

    if possible please give me some reference or links to go through.

    thanks and regards

    Manish 

  • Hi mannish,

    Yes, you can put them in the same endpoint. Just put all of those cluster in the same descriptor.