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.

ZStack 2.5.1a 深度睡眠问题

Other Parts Discussed in Thread: Z-STACK

查了许多资料,发现TI zstack 进入睡眠好像没有完整的案例,特别是低功耗,非常零散,现在电流有300uA,都不知道有没有进入低功耗,外部有两个按钮采用上拉电阻,中断触发方式,一个LED 灯,LED 灯是高电平驱动点亮,求教,按照他们说的编译选项,都做了,

NWK_AUTO_POLL
xZTOOL_P1
xMT_TASK
xMT_SYS_FUNC
xMT_ZDO_FUNC
xLCD_SUPPORTED=DEBUG
POWER_SAVING
xNV_RESTORE
xNV_INIT
xHOLD_AUTO_START

/****************************************
 * The following are for End Devices only
 ***************************************/

-DRFD_RCVC_ALWAYS_ON=FALSE

/* The number of milliseconds to wait between data request polls to the coordinator. */
-DPOLL_RATE=0

/* This is used after receiving a data indication to poll immediately
 * for queued messages...in milliseconds.
 */
-DQUEUED_POLL_RATE=0
/* This is used after receiving a data confirmation to poll immediately
 * for response messages...in milliseconds
 */
-DRESPONSE_POLL_RATE=0

/* This is used as an alternate response poll rate only for rejoin request.
 * This rate is determined by the response time of the parent that the device
 * is trying to join.
 */
-DREJOIN_POLL_RATE=440

void osal_pwrmgr_init( void )
{
  pwrmgr_attribute.pwrmgr_device =PWRMGR_BATTERY; // Default to no power conservation.
  pwrmgr_attribute.pwrmgr_task_state = 0;            // Cleared.  All set to conserve
}

没有osal_start_timeEX 事件,

两个按键P00 P01 都是下降沿触发中断,

   /* Enable/Disable Interrupt or */
    Hal_KeyIntEnable = interruptEnable;
 
    /* Register the callback fucntion */
    pHalKeyProcessFunction = cback;
 
    /* Determine if interrupt is enable or not */
   //Rising/Falling edge configuratinn */
      IEN1|=0x20;//开启P0端口中断
      
      P0IEN|=0x03;
      
      magneticSensorLastState=HAL_KEY_SW_OFF;
      
      PICTL &= ~(HAL_KEY_SW_1_EDGEBIT);    /* Clear the edge bit */
      /* For falling edge, the bit must be set. */
    /*#if (HAL_KEY_SW_1_EDGE == HAL_KEY_FALLING_EDGE)
        PICTL |= HAL_KEY_SW_1_EDGEBIT;--//产生中断
      #endif*/
 
    //传感器接口
     PICTL &= ~(HAL_KEY_SW_2_EDGEBIT);    /* Clear the edge bit */
      /* For falling edge, the bit must be set. */
     /* #if (HAL_KEY_SW_2_EDGE == HAL_KEY_FALLING_EDGE)
        PICTL |= HAL_KEY_SW_2_EDGEBIT;//产生中断
      #endif*/
      
      /* Interrupt configuration:
       * - Enable interrupt generation at the port
       * - Enable CPU interrupt
       * - Clear any pending interrupt
       */
      HAL_KEY_SW_1_ICTL |= HAL_KEY_SW_1_ICTLBIT;
      HAL_KEY_SW_1_IEN |= HAL_KEY_SW_1_IENBIT;
      HAL_KEY_SW_1_PXIFG = ~(HAL_KEY_SW_1_BIT);
      
      //传感器接口
      HAL_KEY_SW_2_ICTL |= HAL_KEY_SW_2_ICTLBIT;
      HAL_KEY_SW_2_IEN |= HAL_KEY_SW_2_IENBIT;
      HAL_KEY_SW_2_PXIFG = ~(HAL_KEY_SW_2_BIT);
      
      P0INP&=~(1<<0);   // P0_0定义为上下拉模式
      P0INP&=~(1<<1);   // P0_1定义为上下拉模式
      P2INP&=~(1<<5);  //上拉

      /* Interrupt configuration:
       * - Enable interrupt generation at the port
       * - Enable CPU interrupt
       * - Clear any pending interrupt
       */
      /* Do this only after the hal_key is configured - to work with sleep stuff */
      if (HalKeyConfigured == TRUE)
      {
        osal_stop_timerEx( Hal_TaskID, HAL_KEY_EVENT);  /* Cancel polling if active */
      }
 
   
 
    /* Key now is configured */
    HalKeyConfigured = TRUE;

不知道电流怎么一直在300uA左右,