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.

CC2531: Z-Stack sampleswitch example dont work as expected.

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

Hello together

I actually try to get the Z-Stack sample switch demo up and running on my custom board!
I am actually using Z-Stack 1.2.2 (start small...) and out of that the sampleswitch example
from Projects\zstack\HomeAutomation\SampleSwitch\CC2530DB

I have ported the HAL_Keys.c definitions to be compatible with my board.
The function on the Line number ~440 in the file zcl_samplesw.c (in IAR within the App folder. otherwise within the Source folder)
gets called after i press my button.
zclGeneral_SendOnOff_CmdToggle( SAMPLESW_ENDPOINT, &zclSampleSw_DstAddr, FALSE, 0 );
unfortunately i cannot see any data in wireshark (with the sniffer connected) comming from my button press. 
The module itself does register correctly to the coordinator. Communication itself is working properly.

I am looking for a absolute minimum example with a button and optionally a LED which can get enabled over the air.
Does anyone got an idea, why my actual implementation could fail?

Thanks!
  • I suspect you don’t do binding successfully. Please attach your sniffer log.

  • Hi

    Thanks for your reply.

    Here you can find the Log:

    https://pastebin.com/DUavkRvs

    Here you can find the full pcapng file

    http://bit.do/SniffDetails

    00:12:4b:00:0f:ea:70:d6

    is the device which does not send any switch commands

    Thank you for your support

  • Hi Claudio,

    I agree with YK that binding is the most probable cause.  Is the ZC running a SampleLight application?  Is ZCL_EZMODE defined in your project?  Have you successfully operated these examples in the past?  Also, why not evaluate Z-Stack 3.0.2 with BDB commissioning?  Please note that my firewall prevents access to your sniffer logs, please upload them directly to the E2E thread if possible.

    Regards,
    Ryan

  • Thanks for your answer.

    I have made it available through a url-shortener to keep crawlers away from the URL behind.

    Actual settings are:

    HOLD_AUTO_START - Disabled (xHOLD_AUTO_START)
    ZTOOL_P1 - Disabled (xZTOOL_P1)
    LCD_SUPPORTED=DEBUG - Disabled (xLCD_SUPPORTED=DEBUG)
    ZCL_EZMODE - Disabled (xZCL_EZMODE)

    Other settings are as in the original

    I have disabled EZMODE since i am using a coordinator and dont want that devices connect to each other without a coordinator.

    Whenever i try to upload the file to the forum it shows me the file as a big image and when i click "reply" it says that an error has occured.

    SniffDetails.zip

  • Your explanation for disabling EZMODE does not make since, but as you have disabled it then you will have to share your manual bind process.  A bind is required to send the message formed by zclGeneral_SendOnOff_CmdToggle.

    Regards,
    Ryan

  • Hi Ryan

    Thanks for your answer.

    Ok, then perhaps i misunderstood the meaning of the EZMODE.
    Should i activate it again? I thought the EZMODE allows connections between two devices without coordinator.

    (i have just tried to enable EZMODE and pressed the button... Still no avtivity on wireshark)

    Also, why not evaluate Z-Stack 3.0.2 with BDB commissioning?

    Because my concentrator is based on 1.2.2. Therefore i thought to avoid some, for me actually unknown, potential problems, i better use 1.2.2
    If i understood the theory of operation, i will try to use 3.0.2.

    Have you successfully operated these examples in the past?

    No.. This is the first time.

    Is the ZC running a SampleLight application?

    The ZC is a Zigbee2MQTT Concentrator. which is based on the ZNP Project.

    but as you have disabled it then you will have to share your manual bind process.  A bind is required to send the message formed by zclGeneral_SendOnOff_CmdToggle.


    I would be happy to share the process with you. Do you mean the messages from wireshark?
    Cause there is not activity at all during my button press.

    Thanks

    ## EDIT

    I have changed

    NLME_SetPollRate( ZDApp_SavedPollRate );

    in ZDApp.c

    to

    NLME_SetPollRate( 0);

    Otherwise there is every 2 seconds a Data Request and a ACK on Wireshark.
    What is this polling good for?

    Thanks

  • Hi Claudio,

    EZ-Mode provides an ability to easily bind (connect) two devices together for normal communication, whether the devices are currently on a ZigBee network or not. It includes both the ability for network steering, and finding and binding.

    If your ZC is based on the ZNP then it does not have the on/off light application layer necessary for creating a bind with EZ-Mode.  I once again have to emphasize that you need to modify your SampleSwitch application to manually create a local bind from the switch endpoint to a light endpoint.  Or you should be using AF_DataRequest for general ZCL messages not tied to a specific cluster/endpoint.  I suggest you further review the Z-Stack documentation and APIs.  A SLA Lab on this topic was developed for SimpleLink devices, you can reference but not use it directly for the CC2530: http://dev.ti.com/tirex/explore/node?node=AJeGnyIqlkquNAYMtLtovQ__pTTHBmu__LATEST 

    Regards,
    Ryan

  • Thank you for your quick answer.

    Ok isee, i mixed up some very different things.

    One last question to you.

    Ive found this project:

    https://github.com/dzungpv/dnckatsw00x

    Is the ZCL_ReportCommand the code you mentioned?

    //report state for button 1
      zclSampleLightSeqNumState++;
      zclReportCmd_t rptcmd;
      rptcmd.numAttr = 1;
      rptcmd.attrList[0].attrID = ATTRID_ON_OFF;
      rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;
      rptcmd.attrList[0].attrData = (void *)(&zclSampleLight_OnOff);
    
      // Set destination address to indirect
      zclSampleLight_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
      zclSampleLight_DstAddr.addr.shortAddr = 0;
      zclSampleLight_DstAddr.endPoint=1;
      zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT,&zclSampleLight_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_SERVER_CLIENT_DIR, true, zclSampleLightSeqNumState );
      //report state for button 2
      zclSampleLightSeqNumState++;
      zclReportCmd_t rptcmd;
      rptcmd.numAttr = 1;
      rptcmd.attrList[0].attrID = ATTRID_ON_OFF;
      rptcmd.attrList[0].dataType = ZCL_DATATYPE_BOOLEAN;
      rptcmd.attrList[0].attrData = (void *)(&zclSampleLight_OnOff1);
    
      // Set destination address to indirect
      zclSampleLight_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
      zclSampleLight_DstAddr.addr.shortAddr = 0;
      zclSampleLight_DstAddr.endPoint=1;
      zcl_SendReportCmd(SAMPLELIGHT_ENDPOINT+1,&zclSampleLight_DstAddr, ZCL_CLUSTER_ID_GEN_ON_OFF, &rptcmd, ZCL_FRAME_SERVER_CLIENT_DIR, true, zclSampleLightSeqNumState );

    Or in other words. Am i on the right way when i use his project as a base?

    Thanks

  • Yes, zcl_SendReportCmd is the API to send zcl report.

  • zcl_SendReportCmd is not the same as AF_DataRequest (it resides a layer upstream before eventually calling it) but the important part is that, contrary to the comments in the code excerpt, indirect addressing (afAddrMode_t)AddrNotPresent; is not used since a bind has not been created.  The code excerpt implies a report command sent directly to short address 0x0000, also known as the Zigbee coordinator, intended for endpoint 0x01.

    Regards,
    Ryan

  • Thanks for all your answers.

    I got it working with using the ZigUp example as a base...