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.

Change Channel During RunTime

Other Parts Discussed in Thread: CC2530, Z-STACK

Hi,

Is there any way to change channel during runtime, so the next time a network is restored, it has the new channel?

I've tried to write to NVRAM using SYS_OSAL_NV_WRITE (ID=0x0084) and SOFT RESET afterwards but doesn't seem to change anything.

BR,

Aiman

  • Ryan, the command works like a charm.

  • Do you have any reason why we cannot manipulate _NIB in NV for current CC26xx Z-Stack to change channel like what we used to do in CC253x Z-Stack?

  • Hi YiKai,

    I have not investigated whether it is possible to directly modify the NV NIB's for Zigbee channel after a node has joined or formed a network.  However, doing so silently would disrupt connections between other nodes within a network since they have not been made aware of the channel change.  It is recommend that the network manager layer oversees channel changes and notifies other nodes in the network before switching.  Otherwise it should simply factory reset to create or join a different network on the new channel.

    Regards,
    Ryan

  •  Yes, I know the consequences to revise NIB to change channel and I just use it for testing sleeping end device which will scan channel anyway. I just want to know why CC253x Z-Stack works bot not CC26xx Z-Stack. If you know exact reason, please let me know.

  • ZDO_MGMT_NWK_UPDATE_REQ appears capable of revising the NIB to change channels, although some other APIs (NLME_SetUpdateID, ZMacSetReq, ZDApp_NwkStateUpdateCB) may also be required to achieve your desired functionality.

    //zd_nwk_mgr.c
    
      if ( events & ZDNWKMGR_CHANNEL_CHANGE_EVT )
      {
        // Switch channel
        _NIB.nwkLogicalChannel = ZDNwkMgr_NewChannel;
        ZMacSetReq( ZMacChannel, &ZDNwkMgr_NewChannel );
    
        // Our Channel has been changed -- notify to save info into NV
        ZDApp_NwkStateUpdateCB();
    
        // Reset the total transmit count and the transmit failure counters
        _NIB.nwkTotalTransmissions = 0;
        nwkTransmissionFailures( TRUE );
    
        return ( events ^ ZDNWKMGR_CHANNEL_CHANGE_EVT );
      }
      
    //...
      else if ( Req.scanDuration == 0xFE )
      {
        // Request is to change Channel. The command provide a new active
        // channel as a single channel in the channelMask.
        // Only process when the nwkUpdateId is more recent (accounting for uint8 wraparound)
        if ( Req.nwkUpdateId > _NIB.nwkUpdateId || ( Req.nwkUpdateId == 0 && _NIB.nwkUpdateId == 0xFF ) )
        {
          uint8_t i;
    
          // Set update ID in the Beacon
          NLME_SetUpdateID(Req.nwkUpdateId);
    
          // Find out the new active channel
          for ( i = 0; i < ED_SCAN_MAXCHANNELS; i++ )
          {
            if ( ( (uint32_t)1 << i ) & Req.channelMask )
            {
              break;
            }
          }
    
          if ( _NIB.nwkLogicalChannel != i )
          {
            ZDNwkMgr_NewChannel = i;
    
            // Upon receipt of a Mgmt_NWK_Update_req with a change of channels,
            // the local network manager shall set a timer equal to the
            // nwkNetworkBroadcastDeliveryTime and shall switch channels upon
            // expiration of this timer.  Each node shall also increment the
            // nwkUpdateId parameter and also reset the total transmit count
            // and the transmit failure counters.
            OsalPortTimers_startTimer( ZDNwkMgr_TaskID, ZDNWKMGR_CHANNEL_CHANGE_EVT,
                                ZDNWKMGR_BCAST_DELIVERY_TIME );
          }
        }
      }

    Regards,
    Ryan

  • my question is why we cannot write NV ID of _NIB to revise channel information now in CC26xx Z-stack which used to work in CC2530 Z-stack?

  • Hi YK,

    I can replicate this behavior and believe it is associated with the osal NV driver write operations and read functionality which have changed since legacy CC253X Z-Stack 3.0.2, please allow more time for me to further investigate.

    Regards,
    Ryan

  • Thanks for investigating into this and looking forward to getting answer from you.

  • Apologies as this message appears to have been left unposted...

    I have noticed that after writing a single byte to the ZCD_NV_NIB, SYS_OSAL_NV_READ -> MT_SysOsalNVRead -> osal_nv_read -> osal_nv_read_ex -> readItem -> NVOCMP_readItemApi -> NVOCMP_readItem -> NVOCMP_verifyCRC returns NVINTF_CORRUPT. It appears that MT_SYS_OSAL_NV_WRITE -> MT_SysOsalNVWrite -> osal_nv_write does not appear to consider the offset any longer, thus the incorrect bytes could be written which causes the corruption error which returns a blank NV read.

    Regards,
    Ryan

  • Will you fire a TI internal bug ticket to fix this in the future?

  • Edited my response with updated information.

    I have submitted a ticket with the Zigbee Software Development Team so that they may ensure that the NV driver is being correctly accessed and used by Z-Stack.  This might lead to a solution which is implemented during the first half of 2023.

    If altering the solution is not advisable, then it may be required that the entire NV item contents should be updated at the same time.  In this case I would add such disclosure in the Monitor and Test API to make users aware of this limitation.

    Regards,
    Ryan