How to add a new DimmableLight application endpoint in JN-AN-1218 miles

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add a new DimmableLight application endpoint in JN-AN-1218 miles

1,234 Views
zgmwork
Contributor II

In JN-AN-1218, add a DimmableLight endpoint. In addition to adding an EndPoint in zpscfg and registering the endpoint with a registration function, how do you modify the program? Now the phenomenon is that the data from the gateway can reach EndPoint, but it does not seem to reach the application layer.

6 Replies

939 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hello Guomiao, I hope you're doing well,

 

To add a new endpoint you'll first need to update your ZigBee Pro Stack configuration file (app.zpscfg, you'll need the ZigBee PRO extension for this). You'll need to create a new Endpoint for your router and configure it with the necessary clusters.

 

Also, you should modify your router's zcl_options.h, changing the #define ZCL_NUMBER_OF_ENDPOINTS value to the number of endpoints you now have. Also, in this file, you can enable cluster functionality to the new endpoints by defining clients in the "Enable Cluster" section of the file.

 

You'll also need to create data structures for your new endpoints in (app_zcl_task.c), as well as, making said device data structures available to other modules by adding them in your app_zcl_task.h file, under the exported variables section.

 

 

Best Regards,

Sebastian

0 Kudos

939 Views
zgmwork
Contributor II

         I would like to add an application endpoint in the JN-AN-1218 mileage, that is, to realize two functions of the same switch light device on one node. An endpoint has been added to"APP_GP.zpscfg", and the number of endpoints in zcl_options.h and the corresponding data structure in other files have been modified.

        Now the phenomenon is:

新增加的这个端点在接收到协调器发来的读写Cluster attributes 命令时能进入“APP_ZCL_vEventHandler“函数,但进入不了端点回调函数“APP_ZCL_cbEndpointCallback”。不知道是哪里还不对

        The new endpoint can enter the "APP_ZCL_vEventHandler" function when it receives the read and write Cluster attributes command from the coordinator, but it cannot enter the endpoint callback function "APP_ZCL_cbEndpoint Callback". I don't know what's wrong.

        Here are some screenshots of configuration parameters in the program 

          app_gp.zpscfg.pngzcl_op.pngsZCLAttribs.pngsLight.pngreports.pngREGSITER_ENDPOINT_1.pngdp.pngAPP_ZCL_vEVENTHANDLER.pngAPP_ZCL_cbEndpointCallback.png

    

0 Kudos

939 Views
zgmwork
Contributor II

       I would like to add an application endpoint in the JN-AN-1218 mileage, that is, to realize two functions of the same switch light device on one node. An endpoint has been added to"APP_GP.zpscfg", and the number of endpoints in zcl_options.h and the corresponding data structure in other files have been modified.

      The problem now is that the new endpoint can enter the "APP_ZCL_vEventHandler" function when it receives the read-write Cluster attributes command from the gateway through the coordinator, but it cannot enter the endpoint callback function "APP_ZCL_cbEndpoint Callback". But the first endpoint can enter normally. I don't know what the problem is.

     Here are some screenshots of the parameters I have modified:

    app_gp.zpscfg.png

   zcl_op.png

sLight.png

sZCLAttribs.png

reports.png

REGSITER_ENDPOINT_1.png

APP_ZCL_vEVENTHANDLER.png

APP_ZCL_cbEndpointCallback.png

dp.png@

0 Kudos

939 Views
Sebastian_Del_Rio
NXP Employee
NXP Employee

Hello Guimiao, I hope you're doing well!,

 

Could you please check to see if the ZCL event handler (vAppHandleAfevent(), located in your app_zlo_light_node.c file) has a condition for your new endpoint? It should include a reference to your new endpoint so it can detect events.

 

Best regards,

Sebastian

0 Kudos

939 Views
zgmwork
Contributor II

The cluster attribute command sent by the gateway can reach "APP_ZCL_vEventHandler" . But the second endpoint callback function is not available.

PRIVATE void vAppHandleAfEvent( BDB_tsZpsAfEvent *psZpsAfEvent)
{
 sPDeviceEndpoint sEndpoint;

    DBG_vPrintf(TRACE_LIGHT_NODE, "\nvAppHandleAfEvent  %d\n", psZpsAfEvent->sStackEvent.eType);

 sEndpoint =app_u8GetDeviceEndpoint();
    //if (psZpsAfEvent->u8EndPoint == app_u8GetDeviceEndpoint())
 if ((psZpsAfEvent->u8EndPoint == sEndpoint.index[0])||(psZpsAfEvent->u8EndPoint == sEndpoint.index[1]))
    {
        if ((psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_DATA_INDICATION) ||
            (psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_INTERPAN_DATA_INDICATION) ||
            (psZpsAfEvent->sStackEvent.eType == ZPS_EVENT_APS_ZGP_DATA_INDICATION))
        {
            DBG_vPrintf(TRUE, "\npsZpsAfEvent->u8EndPoint: %d\n", psZpsAfEvent->u8EndPoint);
            DBG_vPrintf(TRUE, "\npsZpsAfEvent->sStackEvent.eType: %d\n", psZpsAfEvent->sStackEvent.eType);

            APP_ZCL_vEventHandler( &psZpsAfEvent->sStackEvent);
         }

    }

The test gateway uses JN-AN-1216-Zigbee-3-0-IoT-ControlBridge .

zgui.png

0 Kudos

939 Views
zgmwork
Contributor II

I've found the problem. The new endpoints are covered by GP endpoints.

/****************************************************************************/
/*             Green Power Cluster - Optional Attributes                 */
/*                                                                          */
/* Add the following #define's to your zcl_options.h file to add optional   */
/* attributes to the Green Power cluster.                                          */
/****************************************************************************/
#ifdef  CLD_GREENPOWER
    #define GP_IEEE_ADDR_SUPPORT
    #define GREENPOWER_END_POINT_ID                 242 //2
    #define GP_NUMBER_OF_TRANSLATION_TABLE_ENTRIES  5
    #define GP_NUMBER_OF_PROXY_SINK_TABLE_ENTRIES       5
    #define CLD_GP_ATTR_ZGPS_COMMISSIONING_WINDOW
    #define CLD_GP_ATTR_ZGP_SHARED_SECURITY_KEY_TYPE
    #define CLD_GP_ATTR_ZGP_SHARED_SECURITY_KEY
    #define CLD_GP_ATTR_ZGP_LINK_KEY
    /* security level */
    #define GP_SECURITY_LEVEL E_GP_ENC_FULL_FC_FULL_MIC
    /* Possible values are  E_GP_NO_KEY, E_GP_ZIGBEE_NWK_KEY, E_GP_ZGPD_GROUP_KEY,
        E_GP_NWK_KEY_DERIVED_ZGPD_GROUP_KEY, E_GP_OUT_OF_THE_BOX_ZGPD_KEY, E_GP_DERIVED_INDIVIDUAL_ZGPD_KEY*/
    #define GP_KEYTPE              E_GP_ZGPD_GROUP_KEY
    #define GP_SHARED_KEY  { 0xC0 , 0xC1 , 0xC2 , 0xC3 , 0xC4 , 0xC5 , 0xC6 , 0xC7 , 0xC8 , 0xC9 , 0xCa , 0xCb , 0xCc , 0xCd , 0xCe , 0xCf}
#undef ZCL_NUMBER_OF_ENDPOINTS
#define ZCL_NUMBER_OF_ENDPOINTS                             3
#undef CLD_GROUPS_MAX_NUMBER_OF_GROUPS
#define CLD_GROUPS_MAX_NUMBER_OF_GROUPS                     4
#define GP_MAX_TRANS_ZB_CMD_PAYLOAD_LENGTH                   2
#endif

Thank you Sebastian.

0 Kudos