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.

Z-Stack Mesh 1.0.0终端问题

Other Parts Discussed in Thread: Z-STACK, CC2530

Z-Stack Mesh 1.0.0终端启动问题

终端一直是DEV_INIT状态,协议栈未修改什么?

怎么才能让终端开始加协调器?

  • 移除預編譯的HOLD_AUTO_START選項
  • 使用HOLD_AUTO_START选项,那么工程就会禁止自动启动ZDApp事件处理循环中的ZDO_NETWORK_INIT事件,也就是上电后不自动调用ZDOInitDevice(),需要通过外部事件,或者用户自己调用这个函数
  • 默认是HOLD_AUTO_START。你自己手动控制ZDOInitDevice(0)
  • GenericApp例程里预编译没有HOLD_AUTO_START
    我自己加上了xHOLD_AUTO_START还是一直DEV_INIT
    NWK_AUTO_POLL
    ZTOOL_P1
    MT_TASK
    MT_SYS_FUNC
    MT_ZDO_FUNC
    xLCD_SUPPORTED=DEBUG
    xPOWER_SAVING
    xHOLD_AUTO_START
  • 調試一下看看程序卡在那吧
  • Z-Stack Mesh 1.0.0例程,协调器和终端分别通过按键触发下面的函数
    发现终端一直无法入网?怎么回事?
    // Initiate an End Device Bind Request for the mandatory endpoint
    dstAddr.addrMode = Addr16Bit;
    dstAddr.addr.shortAddr = 0x0000; // Coordinator
    ZDP_EndDeviceBindReq( &dstAddr, NLME_GetShortAddr(),
    GenericApp_epDesc.endPoint,
    GENERICAPP_PROFID,
    GENERICAPP_MAX_CLUSTERS, (cId_t *)GenericApp_ClusterList,
    GENERICAPP_MAX_CLUSTERS, (cId_t *)GenericApp_ClusterList,
    FALSE );
  • 调试发现终端运行到下面的else里,
    这是官方的例程,我没改什么啊,默认就是HOLD的?
    else//运行到这里
    {
    ZDOInitDevice( ZDO_INIT_HOLD_NWK_START );
    // Blink LED to indicate HOLD_START
    HalLedBlink ( HAL_LED_4, 0, 50, 500 );
    }


    void ZDApp_Init( uint8 task_id )
    {
    // Save the task ID
    ZDAppTaskID = task_id;

    // Initialize the ZDO global device short address storage
    ZDAppNwkAddr.addrMode = Addr16Bit;
    ZDAppNwkAddr.addr.shortAddr = INVALID_NODE_ADDR;
    (void)NLME_GetExtAddr(); // Load the saveExtAddr pointer.

    // Check for manual "Hold Auto Start"
    ZDAppCheckForHoldKey();

    // Initialize ZDO items and setup the device - type of device to create.
    ZDO_Init();

    // Register the endpoint description with the AF
    // This task doesn't have a Simple description, but we still need
    // to register the endpoint.
    afRegister( (endPointDesc_t *)&ZDApp_epDesc );

    #if defined( ZDO_USERDESC_RESPONSE )
    ZDApp_InitUserDesc();
    #endif // ZDO_USERDESC_RESPONSE

    // Start the device?
    if ( devState != DEV_HOLD )
    {
    ZDOInitDevice( 0 );
    }
    else//运行到这里
    {
    ZDOInitDevice( ZDO_INIT_HOLD_NWK_START );
    // Blink LED to indicate HOLD_START
    HalLedBlink ( HAL_LED_4, 0, 50, 500 );
    }

    // Initialize the ZDO callback function pointers zdoCBFunc[]
    ZDApp_InitZdoCBFunc();

    ZDApp_RegisterCBs();

    #if !defined ( ZDP_BIND_SKIP_VALIDATION )
    #if defined ( REFLECTOR )
    ZDApp_InitPendingBind();
    #endif
    #endif
    } /* ZDApp_Init() */
  • 把在ZDApp_Init里面的ZDAppCheckForHoldKey();這一行去掉再試試
  • 可以了,原来是被按键HOLD住了,
    ZDP_EndDeviceBindReq和ZDP_MatchDescReq是做什么用的?
  • ZDP_EndDeviceBindReq和ZDP_MatchDescReq是做綁定用的
  • 你可以通过下面的文章初步了解什么是绑定,具体请看demo里面的使用和code。
    www.cnblogs.com/.../5604018.html
  • 什么样的情况下需要绑定?
    我们这边的应用就是协调器给终端发私有的数据,典型的星型拓扑
    绑定了有什么好处?
    绑定的实现两个函数都要用到吗?ZDP_EndDeviceBindReq和ZDP_MatchDescReq
  • 比如說light/switch,使用绑定比較方便,你的應用聽起來不需要用绑定
  • 终端设置为非睡眠状态
    xPOWER_SAVING
    -DRFD_RCVC_ALWAYS_ON=TRUE
    请问如果把协调器断电,终端如何知道网已经断了,有没有什么好的办法?
    如果在定时器里定期的去POLL,用什么函数?
  • 如果你是设置为-DRFD_RCVC_ALWAYS_ON=TRUE 不会poll ,也就是无法得知。 你可以定时发送一个消息去给到coordinator。
  • 终端第一次上电时,LED乱闪不停(不是按照我的程序去动作的),
    等待入网后,LED就是按照我的程序去动作了,
    请问例程默认的,LED有哪些地方被调用了,ZDApp.c和GenericApp.c里面的LED我已经注释了,
    可是上电时还是LED乱闪,不知道其他有什么文件调用了LED,请指教?
  • 据我所致LEDBLINK就是在你的说的ZDApp.c和GenericApp.c调用,建议你去search 一下工程,不好意思。
  • 按照协议栈的定义,LED数量最大是8个,多个8个的LED该怎么定义?
    下面是协议栈的定义,最大8个(对应8位),如果是9个LED,怎么定义?
    /* LEDS - The LED number is the same as the bit position */
    #define HAL_LED_1 0x01
    #define HAL_LED_2 0x02
    #define HAL_LED_3 0x04
    #define HAL_LED_4 0x08
  • 不用协议栈的 LED 代码,自己写就好了。

  • CC2530 协议栈里home 1.2.2 如何通过软件去复位CC2530?什么函数?
  • SystemResetSoft
x 出现错误。请重试或与管理员联系。