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.

cc2538(当协调器)和cc2530(当终端)进行简单的无线通讯时,双方使用的都是基于mesh协议栈的,一开始通讯没问题,但当通讯几个小时后无线通讯会断且不能自己恢复,必须手动重启其中一个或两个才能恢复通讯,拷机测试了n多次都是这个现象。(使用的都是mesh包里的GeneralApp工程)

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

您好:

cc2538(当协调器)和cc2530(当终端)进行简单的无线通讯时,双方使用的都是基于mesh协议栈的,一开始通讯没问题,但当通讯几个小时后无线通讯会断且不能自己恢复,必须手动重启其中一个或两个才能恢复通讯,拷机测试了n多次都是这个现象。(使用的都是mesh包里的GeneralApp工程)

麻烦可以帮忙解决一下。

  • 建議抓包看看具體的狀況是怎樣才能確認問題

  • 环境是否有干扰?最好提供下通讯断掉这部分的抓包数据,以帮助分析
  • 环境没有干扰的。协调器使用的是广播模式,定时500ms发送,终端接收到数据会会单播给协调器,然后协调器通过串口打印出来。周而复始重复上述的步骤。但隔几小时后通讯断,抓包抓不到数据,但是将终端重启一下通讯又会恢复正常了。
  • 建議协调器用單播模式送訊息給终端設備

  • 单播模式也试过的,也是这个现象,通讯几个小时候就会断,重启终端才可以
  • 如果使用原始GeneralApp例程做測試,還會有通讯几个小时候就会断的問題嗎?
  • 是的,用的是mesh原始例程,自己加了500ms的定时广播发送,以及串口打印
  • 是的,用的是mesh原始例程,自己加了500ms的定时广播发送,以及串口打印
  • 请问下协调器和终端的预编译选项需要填写哪些,哪位大神可以贴出来下。就是针对mesh包的简单无线通讯。协调器是广播,终端是单播。
  • 要不要試試先把串口打印取消看看問題還會不會發生
  • 我这边昨天串口取消了,拷机了几个小时后又断了,还有招不大哥?
  • 請問你拷机了几个小时后断了?我剛用Z-Stack mesh 1.0.0的GenericApp改了個跟你描述一樣的例程正在跑,我看看幾小時候會不會有問題

  • z-mesh1.0对吧,我写个程序试一下,大概会实验2小时。
  • 我改的Z-Stack mesh 1.0.0的GenericApp已經跑了一個多小時了,暫時還沒有看到問題
  • 我的目前也没有问题,有可能是不是客户的板子的硬件的问题,比如说晶振之类的。
  • 我测试了两个小时没有遇见问题,建议您尝试更换一下板子试试.
  • 两个小时是不会有问题的,基本上是四个小时以上会出现这个问题。还有请问您一下你用的是mesh协议麽。
  • 再问您下您的实验环境也是2538和2530两个呢,可不可以把您的两个例程发我一下的,想一一的排除问题。包括软件的和硬件的
  • 我用cc2538(当协调器)和cc2530(当终端),用的是z-stack mesh 1.0.0裡的GenericApp例程,目前跑了2個半小時左右都沒有問題

  •      能麻烦您多拷机一段时间麽。我这边基本上都是拷机一天的。

          我这边的程序也是在例程上改的,2538是500ms广播发一次,2530收到后会单播给2538,收到数据后都会闪灯。还有我把2530的-DFRD-RCVC_ALWAYS_ON=TRUE这样设置的。

  • 我cc2530的-DFRD-RCVC_ALWAYS_ON=FALSE,但是應該不影響結果
  • 我之前也是false的,发现通讯不是很流畅,就改为true了

  • 您可以加我微信麽,13971468728.感觉这样交流好慢的
  • 我沒有使用微信
  • 嗯好的,能麻烦您例程可以提供一下麽,我想先排除一下软件的原因,目前环境只有一套。992248582@qq.com,这是我的邮箱。

  • 我写死了zed向zc发送hello world 没有去绑定,手动写的endpoint. 这部分是zed ,你zc就把定时器那部分去掉就行.

    /******************************************************************************
      Filename:       GenericApp.c
      Revised:        $Date: 2014-09-07 13:36:30 -0700 (Sun, 07 Sep 2014) $
      Revision:       $Revision: 40046 $
    
      Description:    Generic Application (no Profile).
    
    
      Copyright 2004-2014 Texas Instruments Incorporated. All rights reserved.
    
      IMPORTANT: Your use of this Software is limited to those specific rights
      granted under the terms of a software license agreement between the user
      who downloaded the software, his/her employer (which must be your employer)
      and Texas Instruments Incorporated (the "License"). You may not use this
      Software unless you agree to abide by the terms of the License. The License
      limits your use, and you acknowledge, that the Software may not be modified,
      copied or distributed unless embedded on a Texas Instruments microcontroller
      or used solely and exclusively in conjunction with a Texas Instruments radio
      frequency transceiver, which is integrated into your product. Other than for
      the foregoing purpose, you may not use, reproduce, copy, prepare derivative
      works of, modify, distribute, perform, display or sell this Software and/or
      its documentation for any purpose.
    
      YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
      PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
      INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
      NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
      TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
      NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
      LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
      INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
      OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
      OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
      (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
    
      Should you have any questions regarding your right to use this Software,
      contact Texas Instruments Incorporated at www.TI.com.
    ******************************************************************************/
    
    /*********************************************************************
      This application isn't intended to do anything useful - it is
      intended to be a simple example of an application's structure.
    
      This application periodically sends a "Hello World" message to
      another "Generic" application (see 'txMsgDelay'). The application
      will also receive "Hello World" packets.
    
      This application doesn't have a profile, so it handles everything
      directly - by itself.
    
      Key control:
        SW1:  changes the delay between TX packets
        SW2:  initiates end device binding
        SW3:
        SW4:  initiates a match description request
    *********************************************************************/
    
    /*********************************************************************
     * INCLUDES
     */
    #include "OSAL.h"
    #include "AF.h"
    #include "ZDApp.h"
    #include "ZDObject.h"
    #include "ZDProfile.h"
    
    #include "GenericApp.h"
    #include "DebugTrace.h"
    
    #if !defined( WIN32 ) || defined( ZBIT )
      #include "OnBoard.h"
    #endif
    
    /* HAL */
    #include "hal_lcd.h"
    #include "hal_led.h"
    #include "hal_key.h"
    #include "hal_uart.h"
    
    /* RTOS */
    #if defined( IAR_ARMCM3_LM )
    #include "RTOS_App.h"
    #endif
    
    /*********************************************************************
     * MACROS
     */
    
    /*********************************************************************
     * CONSTANTS
     */
    
    /*********************************************************************
     * TYPEDEFS
     */
    
    /*********************************************************************
     * GLOBAL VARIABLES
     */
    // This list should be filled with Application specific Cluster IDs.
    const cId_t GenericApp_ClusterList[GENERICAPP_MAX_CLUSTERS] =
    {
      GENERICAPP_CLUSTERID
    };
    
    const SimpleDescriptionFormat_t GenericApp_SimpleDesc =
    {
      GENERICAPP_ENDPOINT,              //  int Endpoint;
      GENERICAPP_PROFID,                //  uint16 AppProfId[2];
      GENERICAPP_DEVICEID,              //  uint16 AppDeviceId[2];
      GENERICAPP_DEVICE_VERSION,        //  int   AppDevVer:4;
      GENERICAPP_FLAGS,                 //  int   AppFlags:4;
      GENERICAPP_MAX_CLUSTERS,          //  byte  AppNumInClusters;
      (cId_t *)GenericApp_ClusterList,  //  byte *pAppInClusterList;
      GENERICAPP_MAX_CLUSTERS,          //  byte  AppNumInClusters;
      (cId_t *)GenericApp_ClusterList   //  byte *pAppInClusterList;
    };
    
    // This is the Endpoint/Interface description.  It is defined here, but
    // filled-in in GenericApp_Init().  Another way to go would be to fill
    // in the structure here and make it a "const" (in code space).  The
    // way it's defined in this sample app it is define in RAM.
    endPointDesc_t GenericApp_epDesc;
    
    /*********************************************************************
     * EXTERNAL VARIABLES
     */
    
    /*********************************************************************
     * EXTERNAL FUNCTIONS
     */
    
    /*********************************************************************
     * LOCAL VARIABLES
     */
    byte GenericApp_TaskID;   // Task ID for internal task/event processing
                              // This variable will be received when
                              // GenericApp_Init() is called.
    
    devStates_t GenericApp_NwkState;
    
    byte GenericApp_TransID;  // This is the unique message ID (counter)
    
    afAddrType_t GenericApp_DstAddr;
    
    // Number of recieved messages
    static uint16 rxMsgCount;
    
    // Time interval between sending messages
    static uint32 txMsgDelay = GENERICAPP_SEND_MSG_TIMEOUT;
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    static void GenericApp_ProcessZDOMsgs( zdoIncomingMsg_t *inMsg );
    static void GenericApp_HandleKeys( byte shift, byte keys );
    static void GenericApp_MessageMSGCB( afIncomingMSGPacket_t *pckt );
    static void GenericApp_SendTheMessage( void );
    
    #if defined( IAR_ARMCM3_LM )
    static void GenericApp_ProcessRtosMessage( void );
    #endif
    
    /*********************************************************************
     * NETWORK LAYER CALLBACKS
     */
    
    /*********************************************************************
     * PUBLIC FUNCTIONS
     */
    
    /*********************************************************************
     * @fn      GenericApp_Init
     *
     * @brief   Initialization function for the Generic App Task.
     *          This is called during initialization and should contain
     *          any application specific initialization (ie. hardware
     *          initialization/setup, table initialization, power up
     *          notificaiton ... ).
     *
     * @param   task_id - the ID assigned by OSAL.  This ID should be
     *                    used to send messages and set timers.
     *
     * @return  none
     */
    void GenericApp_Init( uint8 task_id )
    {
      GenericApp_TaskID = task_id;
      GenericApp_NwkState = DEV_INIT;
      GenericApp_TransID = 0;
    
      // Device hardware initialization can be added here or in main() (Zmain.c).
      // If the hardware is application specific - add it here.
      // If the hardware is other parts of the device add it in main().
    //
      GenericApp_DstAddr.addrMode = (afAddrMode_t)Addr16Bit; 
      GenericApp_DstAddr.endPoint = GENERICAPP_ENDPOINT;
      GenericApp_DstAddr.addr.shortAddr = 0x0000;
    
      // Fill out the endpoint description.
      GenericApp_epDesc.endPoint = GENERICAPP_ENDPOINT;
      GenericApp_epDesc.task_id = &GenericApp_TaskID;
      GenericApp_epDesc.simpleDesc
                = (SimpleDescriptionFormat_t *)&GenericApp_SimpleDesc;
      GenericApp_epDesc.latencyReq = noLatencyReqs;
    
      // Register the endpoint description with the AF
      afRegister( &GenericApp_epDesc );
    
      // Register for all key events - This app will handle all key events
      RegisterForKeys( GenericApp_TaskID );
    
      // Update the display
    #if defined ( LCD_SUPPORTED )
      HalLcdWriteString( "GenericApp", HAL_LCD_LINE_1 );
    #endif
    
      ZDO_RegisterForZDOMsg( GenericApp_TaskID, End_Device_Bind_rsp );
      ZDO_RegisterForZDOMsg( GenericApp_TaskID, Match_Desc_rsp );
    
    #if defined( IAR_ARMCM3_LM )
      // Register this task with RTOS task initiator
      RTOS_RegisterApp( task_id, GENERICAPP_RTOS_MSG_EVT );
    #endif
    }
    
    /*********************************************************************
     * @fn      GenericApp_ProcessEvent
     *
     * @brief   Generic Application Task event processor.  This function
     *          is called to process all events for the task.  Events
     *          include timers, messages and any other user defined events.
     *
     * @param   task_id  - The OSAL assigned task ID.
     * @param   events - events to process.  This is a bit map and can
     *                   contain more than one event.
     *
     * @return  none
     */
    uint16 GenericApp_ProcessEvent( uint8 task_id, uint16 events )
    {
      afIncomingMSGPacket_t *MSGpkt;
      afDataConfirm_t *afDataConfirm;
    
      // Data Confirmation message fields
      byte sentEP;
      ZStatus_t sentStatus;
      byte sentTransID;       // This should match the value sent
      (void)task_id;  // Intentionally unreferenced parameter
    
      if ( events & SYS_EVENT_MSG )
      {
        MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( GenericApp_TaskID );
        while ( MSGpkt )
        {
          switch ( MSGpkt->hdr.event )
          {
            case ZDO_CB_MSG:
              GenericApp_ProcessZDOMsgs( (zdoIncomingMsg_t *)MSGpkt );
              break;
    
            case KEY_CHANGE:
              GenericApp_HandleKeys( ((keyChange_t *)MSGpkt)->state, ((keyChange_t *)MSGpkt)->keys );
              break;
    
            case AF_DATA_CONFIRM_CMD:
              // This message is received as a confirmation of a data packet sent.
              // The status is of ZStatus_t type [defined in ZComDef.h]
              // The message fields are defined in AF.h
              afDataConfirm = (afDataConfirm_t *)MSGpkt;
    
              sentEP = afDataConfirm->endpoint;
              (void)sentEP;  // This info not used now
              sentTransID = afDataConfirm->transID;
              (void)sentTransID;  // This info not used now
    
              sentStatus = afDataConfirm->hdr.status;
              // Action taken when confirmation is received.
              if ( sentStatus != ZSuccess )
              {
                // The data wasn't delivered -- Do something
              }
              break;
    
            case AF_INCOMING_MSG_CMD:
              GenericApp_MessageMSGCB( MSGpkt );
              break;
    
            case ZDO_STATE_CHANGE:
              GenericApp_NwkState = (devStates_t)(MSGpkt->hdr.status);
              if ( (GenericApp_NwkState == DEV_ZB_COORD) ||
                   (GenericApp_NwkState == DEV_ROUTER) ||
                   (GenericApp_NwkState == DEV_END_DEVICE) )
              {
                // Start sending "the" message in a regular interval.
                osal_start_timerEx( GenericApp_TaskID,
                                    GENERICAPP_SEND_MSG_EVT,
                                    500 );
              }
              break;
    
            default:
              break;
          }
    
          // Release the memory
          osal_msg_deallocate( (uint8 *)MSGpkt );
    
          // Next
          MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( GenericApp_TaskID );
        }
    
        // return unprocessed events
        return (events ^ SYS_EVENT_MSG);
      }
    
      // Send a message out - This event is generated by a timer
      //  (setup in GenericApp_Init()).
      if ( events & GENERICAPP_SEND_MSG_EVT )
      {
        // Send "the" message
        GenericApp_SendTheMessage();
    
        // Setup to send message again
        osal_start_timerEx( GenericApp_TaskID,
                            GENERICAPP_SEND_MSG_EVT,
                            500 );
    
        // return unprocessed events
        return (events ^ GENERICAPP_SEND_MSG_EVT);
      }
    
    #if defined( IAR_ARMCM3_LM )
      // Receive a message from the RTOS queue
      if ( events & GENERICAPP_RTOS_MSG_EVT )
      {
        // Process message from RTOS queue
        GenericApp_ProcessRtosMessage();
    
        // return unprocessed events
        return (events ^ GENERICAPP_RTOS_MSG_EVT);
      }
    #endif
    
      // Discard unknown events
      return 0;
    }
    
    /*********************************************************************
     * Event Generation Functions
     */
    
    /*********************************************************************
     * @fn      GenericApp_ProcessZDOMsgs()
     *
     * @brief   Process response messages
     *
     * @param   none
     *
     * @return  none
     */
    static void GenericApp_ProcessZDOMsgs( zdoIncomingMsg_t *inMsg )
    {
      switch ( inMsg->clusterID )
      {
        case End_Device_Bind_rsp:
          if ( ZDO_ParseBindRsp( inMsg ) == ZSuccess )
          {
            // Light LED
            HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );
          }
    #if defined( BLINK_LEDS )
          else
          {
            // Flash LED to show failure
            HalLedSet ( HAL_LED_4, HAL_LED_MODE_FLASH );
          }
    #endif
          break;
    
        case Match_Desc_rsp:
          {
            ZDO_ActiveEndpointRsp_t *pRsp = ZDO_ParseEPListRsp( inMsg );
            if ( pRsp )
            {
              if ( pRsp->status == ZSuccess && pRsp->cnt )
              {
               
    
                // Light LED
                HalLedSet( HAL_LED_4, HAL_LED_MODE_ON );
              }
              osal_mem_free( pRsp );
            }
          }
          break;
      }
    }
    
    /*********************************************************************
     * @fn      GenericApp_HandleKeys
     *
     * @brief   Handles all key events for this device.
     *
     * @param   shift - true if in shift/alt.
     * @param   keys - bit field for key events. Valid entries:
     *                 HAL_KEY_SW_4
     *                 HAL_KEY_SW_3
     *                 HAL_KEY_SW_2
     *                 HAL_KEY_SW_1
     *
     * @return  none
     */
    static void GenericApp_HandleKeys( uint8 shift, uint8 keys )
    {
      zAddrType_t dstAddr;
    
      // Shift is used to make each button/switch dual purpose.
      if ( shift )
      {
        if ( keys & HAL_KEY_SW_1 )
        {
        }
        if ( keys & HAL_KEY_SW_2 )
        {
        }
        if ( keys & HAL_KEY_SW_3 )
        {
        }
        if ( keys & HAL_KEY_SW_4 )
        {
        }
      }
      else
      {
        if ( keys & HAL_KEY_SW_1 )
        {
    #if defined( SWITCH1_BIND )
          // We can use SW1 to simulate SW2 for devices that only have one switch,
          keys |= HAL_KEY_SW_2;
    #elif defined( SWITCH1_MATCH )
          // or use SW1 to simulate SW4 for devices that only have one switch
          keys |= HAL_KEY_SW_4;
    #else
       
    #endif
        }
    
        if ( keys & HAL_KEY_SW_2 )
        {
         
        }
    
        if ( keys & HAL_KEY_SW_3 )
        {
        }
    
        if ( keys & HAL_KEY_SW_4 )
        {
      
        }
      }
    }
    
    /*********************************************************************
     * LOCAL FUNCTIONS
     */
    
    /*********************************************************************
     * @fn      GenericApp_MessageMSGCB
     *
     * @brief   Data message processor callback.  This function processes
     *          any incoming data - probably from other devices.  So, based
     *          on cluster ID, perform the intended action.
     *
     * @param   none
     *
     * @return  none
     */
    static void GenericApp_MessageMSGCB( afIncomingMSGPacket_t *pkt )
    {
      switch ( pkt->clusterId )
      {
        case GENERICAPP_CLUSTERID:
          rxMsgCount += 1;  // Count this message
          HalLedSet ( HAL_LED_4, HAL_LED_MODE_BLINK );  // Blink an LED
    #if defined( LCD_SUPPORTED )
          HalLcdWriteString( (char*)pkt->cmd.Data, HAL_LCD_LINE_1 );
          HalLcdWriteStringValue( "Rcvd:", rxMsgCount, 10, HAL_LCD_LINE_2 );
    #elif defined( WIN32 )
          WPRINTSTR( pkt->cmd.Data );
    #endif
          break;
      }
    }
    
    /*********************************************************************
     * @fn      GenericApp_SendTheMessage
     *
     * @brief   Send "the" message.
     *
     * @param   none
     *
     * @return  none
     */
    static void GenericApp_SendTheMessage( void )
    {
      char theMessageData[] = "Hello World";
    
      if ( AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc,
                           GENERICAPP_CLUSTERID,
                           (byte)osal_strlen( theMessageData ) + 1,
                           (byte *)&theMessageData,
                           &GenericApp_TransID,
                           AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
      {
        // Successfully requested to be sent.
      }
      else
      {
        // Error occurred in request to send.
      }
    }
    
    #if defined( IAR_ARMCM3_LM )
    /*********************************************************************
     * @fn      GenericApp_ProcessRtosMessage
     *
     * @brief   Receive message from RTOS queue, send response back.
     *
     * @param   none
     *
     * @return  none
     */
    static void GenericApp_ProcessRtosMessage( void )
    {
      osalQueue_t inMsg;
    
      if ( osal_queue_receive( OsalQueue, &inMsg, 0 ) == pdPASS )
      {
        uint8 cmndId = inMsg.cmnd;
        uint32 counter = osal_build_uint32( inMsg.cbuf, 4 );
    
        switch ( cmndId )
        {
          case CMD_INCR:
            counter += 1;  /* Increment the incoming counter */
                           /* Intentionally fall through next case */
    
          case CMD_ECHO:
          {
            userQueue_t outMsg;
    
            outMsg.resp = RSP_CODE | cmndId;  /* Response ID */
            osal_buffer_uint32( outMsg.rbuf, counter );    /* Increment counter */
            osal_queue_send( UserQueue1, &outMsg, 0 );  /* Send back to UserTask */
            break;
          }
    
          default:
            break;  /* Ignore unknown command */
        }
      }
    }
    #endif
    
    /*********************************************************************
     */
    

  • 下面是我針對GenericApp例程的修改
    1. GenericApp.h裡面修改 #define GENERICAPP_SEND_MSG_TIMEOUT 500
    2. 修改GenericApp.c裡面GenericApp_Init()的下面3行
    GenericApp_DstAddr.addrMode = (afAddrMode_t)AddrBroadcast;
    GenericApp_DstAddr.endPoint = GENERICAPP_ENDPOINT;
    GenericApp_DstAddr.addr.shortAddr = 0xFFFF;

    到目前為止已經測試近3個半小時,程序依然在執行沒有問題
  • 您这边终端是定时发的麽,不是收到协调器广播的数据再回的么?

  • 不是,我就是從协调器和终端來广播
  • 好的哥,请问下你那边通讯断了呢,要是没断可以多拷机一会麽

  • 通讯没断,繼續拷机中
  • 还有就是您修改的这个参数GENERICAPP_SEND_MSG_TIMEOUT 500 ,是做什么用的,我这边没用到也没动过
  • 就是讓協調器与終端設備500ms作一次广播

  • 我刚才发现了一个现象,就是我通讯一段时间后,发现程序进入到case ZDO_STATE_CHANGE: 这里,这时候通讯就断了。但是过了几秒程序又进入到这里然后通讯又自己恢复了。我是用指示灯判断进入到那里的,我想问下这种情况正常麽,就是无线有时虽然会断,只要能够立即恢复,这样算断网麽?

  • 如果是終端設備程序进入到case ZDO_STATE_CHANGE,就是終端設備與协调器失聯後又重新入網了,算断网了
  • 正常情况下会出现这种情况麽,我换了块2530刚发现的

  • 之前我说的断网是完全没反应的,得靠重启才行
  • 如果你说的断网是完全没反应的,得靠重启才行,那就不是。正常情况下不会出现这种情况
  • 这就好奇怪了,我这边总是会出现这种情况,好郁闷啊,刚换了一个新板子,就出现断了重新恢复情况,现在我完全无法定位软件还是硬件了。。

  • 大哥你那边是怎样判断通讯断没断的?

  • 我这边终端的预编译选项中有NWK_AUTO_POLL,在协调器广播的情况,终端加这条预编译会有影响麽。这条预编译的意思好像是终端向协调器请求数据的,在广播的情况下不知道终端需不需要

  • 基本上程序裡面ZDO_STATE_CHANGE就可以檢查通讯狀態是不是断的,另外也可以用抓包來確認,這樣聽起來你的硬體應該是有問題的
  • 嗯呢,我今晚在拷机一晚上,看看会不会出现起不来的情况,要是不出现就可以确定是硬件的问题了

  • 我拷机到目前都是正常的
  • 有几个小时了的?有时候拷机一夜才会出现

  • SDK里面那个demo我和YK都试过了,给你一个方向试一下硬件,你写一个定时器去闪烁一个led,如果不能通信的时候看一下你那个led灯是否还在闪烁,判断MCU是否还在正常工作,我怀疑是你的晶振不稳。
  • 我目前的程序里有闪灯的,当通讯断时,灯还是定时闪的。

  • 那说明MCU没有死,你去看一下ZDO_STATE_CHANGE是否改变以及最后提供抓包文件,你先测试一下,最好能提供抓包文件。
  • 我这边是用cc debugger+cc2530,通过smartrf  studio抓包的,通讯断时这边抓不到任何数据。没有使用packet  sniffer抓包