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 restart the network scan without turning off

Part Number: CC2530
Other Parts Discussed in Thread: TIMAC

Tool/software:

I use TiMac.

if zigbee coordinator is turned on after the zigbee device is turn on

then the zigbee device cannot find the network.

It is a solution that to restart the zigbee device (HAL_SYSTEM_RESET();).

But this method is not good because all settings are reset.

How can I restart just network scan without HAL_SYSTEM_RESET();?

  • Hi Edan,

    TIMAC is not in of itself a Zigbee stack solution, but it does support the underlying IEEE 802.15.4-2006 Specification.  You should be able to use TIMAC APIs MAC_MlmeScanReq and MAC_MlmeAssociateReq, and the corresponding callback cases MAC_MLME_SCAN_CNF and MAC_MLME_ASSOCIATE_CNF, to perform device scan and association with an existing network.  

    Regards,
    Ryan

  • Thanks for your reply.

    I have tried your advice.

    osal_start_timerEx(MSA_TaskId, MAC_MLME_SCAN_CNF, MSA_WAIT_PERIOD);

    It was able to rescan and join the existing network.
    But all settings are still reset.(all digital output ports are turned off)

    and I tried MAC_MLME_ASSOCIATE_CNF instead of MAC_MLME_SCAN_CNF.
    It seems to be the same as HAL_SYSTEM_RESET().

    I tried MSA_DeviceStartup(); instead of callback cases MAC_MLME_SCAN_CNF and MAC_MLME_ASSOCIATE_CNF
    It allows to rescan for network without resetting the digital port when the zigbee device lose the network.

    How about this?

  • Please use the OSAL timer to call a new event that you define in msa.h and call MSA_ScanReq -> MAC_MlmeScanReq or MSA_AssociateReq -> MAC_MlmeAssociateReq from that event case.  You should not directly enter the MAC_MLME_ASSOCIATE_CNF or MAC_MLME_SCAN_CNF callbacks since they should be only called by the stack based on a radio event, in this case confirming association or scan responses.

    You can also further debug and step through the code to determine the reset reasons and what is causing your digital output port behavior.

    Regards,
    Ryan


  • osal_start_timerEx(MSA_TaskId, MSA_DeviceStartup_EVENT, MSA_WAIT_PERIOD);

    yes ,MSA_ScanReq() has two parameters. but I don't know clear it's value.

    So I used Start_Network(). MSA_ScanReq() is exist in Start_Network();

    <my coding part in MSA_ProcessEvent (msa.c)> 

      if (events & MSA_DeviceStartup_EVENT){
        Start_Network();
        //MSA_DeviceStartup();
      return events ^ MSA_DeviceStartup_EVENT;
      }

    <TiMac original function (msa.c)> : 

    void Start_Network(void){
      if (!msa_IsStarted)
      {
        /* Read IEEE Address from Info Page */
        MAC_READ_CHIP_IEEE_ADDR(msa_ExtAddr);
        
        /* Decide if direct or indirect messaging is used */
        msa_IsDirectMsg = MSA_DIRECT_MSG_ENABLED;
    
        if (msa_IsDirectMsg)
        {
          /* Start the device as an DIRECT messaging device */
          if (msa_BeaconOrder != 15)
            MSA_ScanReq(MAC_SCAN_PASSIVE, MSA_MAC_BEACON_ORDER + 1);
          else
            MSA_ScanReq(MAC_SCAN_ACTIVE, 3);
        }
        else
        {
           /* Start the device as an INDIRECT messaging device and beacon disabled */
           /* Beacon network doesn't work with polling */
           if (!msa_IsStarted)
           {
             msa_IsDirectMsg = FALSE;
             MSA_ScanReq(MAC_SCAN_ACTIVE, 3);
           }
        }
      }
    }

    This result is good.
    What do you think about this?

  • That seems to be a reasonable approach.

    Regards,
    Ryan

  • Thanks for your great guide.