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.

CC2530: How to add Touchlink functionality to Z-Stack 3.0.1?

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

I added INTER_PAN, BDB_TL_INITIATOR,BDB_TL_TARGET in my projects, Router as target, EndDevice as initiator, but doesn't work.

I found the touchlink codes are different to Z-Stack 3.0 Sample Application User's Guide.

It uses NLME_DirectJoinRequestWithAddr() instead of targetSendNwkStartRsp().

Touchlink target codes in bdb_touchlink_target.c:

  if ( events & TOUCHLINK_START_NWK_EVT )
  {
    bdbTLNwkStartReq_t *pReq = &(rxReq.nwkStartReq);
    bdbCommissioningProcedureState.bdbCommissioningState = BDB_COMMISSIONING_STATE_TL;

    // Start operating on the new network
    touchLinkStartRtr( &(pReq->nwkParams), pReq->transID );

    // Perform a ZigBee Direct Join in order to allow direct communication
    // via the ZigBee network between the Initiator and the Target (i.e.,
    // create an entry in the neighbor table with the IEEE address and the
    // network address of the Initiator).
    NLME_DirectJoinRequestWithAddr( pReq->initiatorIeeeAddr, pReq->initiatorNwkAddr,
                                    CAPINFO_DEVICETYPE_RFD );

    // return unprocessed events
    return ( events ^ TOUCHLINK_START_NWK_EVT );
  }

 Joining with Touchlink commissioning (FN ZED Initiator and FN ZR Target):

  • Hi one MAN!,

    Can you elaborate on what 'doesn't work'? Are they commissioned together successfully?

    Are you able to provide any sniffer logs?

    When using the CC2530 with Z3.0 and TouchLink enabled, you will run into issues with running out of memory. Optimizations may be required such as disabling the UI by following the steps here: processors.wiki.ti.com/.../Optimizing_Flash_and_RAM_Usage_of_Z-Stack_for_CC2530

    It is highly recommended to use the CC2652R or at the very least the CC2538 if you wish to evaluate this feature of TouchLink.
  • When the initiator sends a "network start request", the target does not respond.

    I've gone through these steps to disable the UI and free RAM.

  • I had done touchlink test using CC2538DK as SampleLight ZR and CC2530DK as SampleSwitch ZED which you can refer to my steps in e2e.ti.com/.../709873 . I can see SampleLight and SampleSwitch is paired but there is problem to send toggle command.
  • Hi YiKai Chen,

    I uses targetSendNwkStartRsp() instead of NLME_DirectJoinRequestWithAddr() .

    Then,the EndDevice(initiator) can Rejoin, but in most cases it is a failure like the following log.

    The initiator changed it's PAN_ID.

  • Hi Hi YiKai Chen,

    I change some codes and get two new logs, one success, another one is leave. See the sniffer logs.

    Initiator:

      //msming
       srcAddr->panId = 0xFFFF;
      //end msming
       return bdbTL_Send_DeviceInfoReq( TOUCHLINK_INTERNAL_ENDPOINT, srcAddr,
                                        &devInfoReq, initiatorSeqNum++ );

    Target:

      //msming
      srcAddr->panId = 0xFFFF;
      //end msming
      return ( touchLink_SendDeviceInfoRsp( TOUCHLINK_INTERNAL_ENDPOINT, srcAddr,
                                      pReq->startIndex, pReq->transID, seqNum ) );

    Touchlink.zip   

  • one Man,

    You shouldn't need to make any modifications to the application, as Touchlink commissioning should work out-of-box, by simply defining INTER_PAN to both projects, BDB_TL_INITIATOR to your desired initiator, and BDB_TL_TARGET to your desired target application.

    The process for joining is as follows:

    The process is as the following:
    - Ensure that either your initiator OR target have NWK Formation enabled. (Optional)
    - For the initiator, enable T.L. INITIATOR in the Configure page.
    - have your Target device enable 'T.L. TARGET' and you should see the timer begin counting down. This will have the target begin searching for initiator's scan requests on the channels listed above.
    - While the Target is counting down, start commission on the initiator.
    - The target should have left any network it was joined to, and either form its own network or join the initiator's network - if the initiator is on a network. (According to the spec)

    Best,
    Sean
  • Sean M,

    Thank you!

    I tried the steps you said, but target did not respond to initiator's "Network start request".
  • Touchlink commission might happen on channel 11, 15, 20, and 25 so you might need to sniff all four channel to get correct sniffer log. By the way, Do you use TI CC2530ZDK to test this?
  • YiKai Chen ,

    I fixed it in the 11 channel.

    I don't have a CC2530DK. I testing touchlink on my board.

    BR,
    Man
  • How do you fix it in the 11 channel?
  •  if ( events & TOUCHLINK_NWK_START_EVT )
      {
        bdbTLNwkStartReq_t *pReq = &(rxReq.nwkStartReq);
    
        // If the PAN Id, Extended PAN Id or Logical Channel are zero then
        // determine each of these parameters
        if ( !nwk_ExtPANIDValid( pReq->nwkParams.extendedPANID ) )
        {
          touchLink_GenerateRandNum( pReq->nwkParams.extendedPANID, Z_EXTADDR_LEN );
        }
        
        if ( pReq->nwkParams.panId == 0 )
        {
          pReq->nwkParams.panId = osal_rand();
        }
    
        if ( pReq->nwkParams.logicalChannel == 0 )
        {//msming
          pReq->nwkParams.logicalChannel = 11;//touchLink_GetRandPrimaryChannel();
          //end
        }
    
        if ( pReq->nwkParams.nwkAddr == 0 )
        {
          pReq->nwkParams.nwkAddr = osal_rand();
        }
         
        // Perform Network Discovery to verify our new network parameters uniqeness
        touchLink_PerformNetworkDisc( (uint32)1 << pReq->nwkParams.logicalChannel );
        //msming
        initiatorRxChannel =  pReq->nwkParams.logicalChannel;//_NIB.nwkLogicalChannel;
       //end
        printf("START_EVT P %04X, TargetAddr %04X, Channel %d\n", rxReq.nwkStartReq.nwkParams.panId, rxReq.nwkStartReq.nwkParams.nwkAddr, initiatorRxChannel);
        // return unprocessed events
        return ( events ^ TOUCHLINK_NWK_START_EVT );
      }

  • Try to set the following TOUCHLINK_SECOND_CHANNEL, TOUCHLINK_THIRD_CHANNEL, and TOUCHLINK_FOURTH_CHANNEL to ( 11 + TOUCHLINK_CH_OFFSET ) instead of manipulate pReq->nwkParams.logicalChannel.

    // TOUCHLINK Channels (standard)
    #define TOUCHLINK_FIRST_CHANNEL ( 11 + TOUCHLINK_CH_OFFSET )
    #define TOUCHLINK_SECOND_CHANNEL ( 15 + TOUCHLINK_CH_OFFSET )
    #define TOUCHLINK_THIRD_CHANNEL ( 20 + TOUCHLINK_CH_OFFSET )
    #define TOUCHLINK_FOURTH_CHANNEL ( 25 + TOUCHLINK_CH_OFFSET )


  • Are you still having issues with your Touchlink devices joining the network? Or have you found a resolution to your issue?
  • Hi Sean M,

    I have solved the problem, but I have found a new one. Can you read Chinese? If you can...

    Please click on : https://e2echina.ti.com/question_answer/wireless_connectivity/zigbee/f/104/t/158924

    Thank you!

  • Glad to hear you solved the issue! Would you mind being able to modify your original post with the solution so that it may be able to help others who may encounter a similar issue in the future?

    As for your other question, unfortunately I am not able to read chinese. If you could re-post your question on this English forum (in English), I may be able to be of further assistance.

    Best,
    Sean
  • Thank you very much!

    The questions are as follows:

    1. When I comment on the following statement, Touch Link will run normally.

    //bdb_StartCommissioning (BDB_COMMISSIONING_MODE_NWK_STEERING);

    packets are as follows:

    if I do not do so,device cannot be connected successfully, packets are as follows:

    https://e2echina.ti.com/cfs-file/__key/communityserver-discussions-components-files/104/Touch-link-fail.JPG

    2. I have compiled "NV_INIT" and "NV_RESTORED", but Initiator and Target can not restore form NV.

    Packet:

    Touchlink Info.zip

  • one Man,

    Are you using a ZNP/Z-Tool for this?

    Is this with using Z-Stack 3.0.1 and a CC2530/CC2538?

    Where is this line you mentioned that you can comment out and it will work?

    From the differences between the success versus fail captures, I see that the Success Capture does not have the 'Touchlink Information.Factory New' bit set and it also has the network address already set to be 0x0002. The failed capture has the factory new bit set and the network address is set to be 0xFFFF.

    Best,
    Sean
  • Sean M,

    I'm not using ZNP/Z-Tool for this.

    Yes, Z-Stack 3.0.1, but Initiator and Target are CC2530.

    It will work when I comment out .

    Best,
    one Man
  • Hi

    Are you still experiencing issues with this, or did you find a resolution in your other post?