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.

MESH1.0,上电后无法进入GenericApp_ProcessEvent()

协议栈:mesh1.0

预编译:开启了NV和禁止自动加网。

NV_RESTORE
HOLD_AUTO_START

在void GenericApp_Init( uint8 task_id )中

#if defined ( HOLD_AUTO_START )
//ZDOInitDevice(0);  注释掉该部分,没有注释的时候,上电会自动寻网,这样和开没开 HOLD_AUTO_START有区别?

#endif

因为我这边复位后,功耗一直在8ma,所以仿真了一下,在if ( events & SYS_EVENT_MSG )设置断点。发现跑起来后并没有进入这里,除非有事件发生比如按键触发。

后面再预编译里HOLD_AUTO_START改为xHOLD_AUTO_START就可以正常了。

但是,我的程序要求是上面不主动寻网,等待触发才寻网的。

  • 目前的问题主要就是:我的休眠部分写在if ( events & SYS_EVENT_MSG )里面,而问题是上电或者退网复位并没有进入这里,这就没法执行到休眠了。导致功耗下不来。
  • 把休眠部分写在GenericApp_Init裡面不就好了
  • 不能在 GenericApp_Init() 初始化函数里用事件定时器来定时触发休眠事件吗?

  • 打开HOLD_AUTO_START,然后把你的 ZDOInitDevice(0) 放在你的按键处理里面,就可以不会上电之后一直在扫网
  • 感谢回复,可以了。在init开个定时osal_start_timerEx()解决了。
  • 可以的,谢谢回复。目前降下来了。
  • 是的,目前的做法就是屏蔽了协议栈init原本的那块,然后再独立触发入网。
    其实就是顺带对协议栈中的一个疑问,为什么开了HOLD_AUTO_START,他还要在init里面写
    #if defined ( HOLD_AUTO_START )
    ZDOInitDevice(0);
    #endif
  • 你自己加上去的吧,还是别人给你的。

    在原始的demo 里面没有。
    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)AddrNotPresent;
    GenericApp_DstAddr.endPoint = 0;
    GenericApp_DstAddr.addr.shortAddr = 0;

    // 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
    }
  • 是的,应该是之前的同事加的。我对比了初始协议栈确实没有。感谢您了。