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.

regarding sleep mode of the nodes

Other Parts Discussed in Thread: CC2530, Z-STACK

hello everyone ! ! ! 

when a node wakes from sleep mode will it need to start binding mechanism again ?? 

  • If you enable NV_RESTORE in your project, there is no need to do binding again.

  • thank you sir !!! 

  • hi Chen,

               when a node wake up, and set the LED light for 2s。

               is that i need set a microwait( )after LED=ON???

    thanks

  • Would you show me how you sen LED light for 2 seconds?

  • i have not success to make the LED light on 2S。

     

    i set up a EVENT every 10s , and when EVENT happen, i put a code in the processing to let LED always light

    although i have receive the uart msg,   the LED was not always light on but flash actually

    so i curious about how to set the LED light until 2s ? Is that put a microwait(2000); after 

    HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON );

        if ( events & BATTERY_CHECK_EVT )
      {
          uint16 BatteryValue;
          char str[7];
             
          HalAdcSetReference(HAL_ADC_REF_125V);

          BatteryValue = HalAdcRead (HAL_ADC_CHANNEL_5, HAL_ADC_RESOLUTION_12);
     
    #ifdef UartShow     
          sprintf(str,"ADC:%d",BatteryValue);
          HalUARTWrite(0,str,8);
    #endif   
         
        osal_start_timerEx( zclZoneVibration_TaskID, BATTERY_CHECK_EVT,10000 ); //86400000 days
        HalLedSet ( HAL_LED_2, HAL_LED_MODE_ON );
        return ( events ^ BATTERY_CHECK_EVT );
         
      }

  • You can try to call HalLedBlink ( HAL_LED_1, 1, 80, 2500 ); when you want to turn on LED for 2 seconds.

  • hi 陈

            在节能作态下,这个设置没有用,LED 就是很快速的闪了一下,然后又灭了。

           但是非节能的状态下 ,就有效!

           1.是不是节能状态下,zstack 会对 P10口进行操作呢?

           2. 要么就是 节能状态下, LED 都没有完成常亮 的功能,  节能设置就把CC2530 关了,不然他把事做完在休眠,但是又说不通,为什么串口就可以把数据发完呢???

               节能设置 醒来后, 工作多久 是谁规定???是设置参数,参数一到,不管三七二十一 就把机器关闭

               还是说把事情做完了,在关闭器件呢???? 

  • Please describe your problem in English to benefit others.

    When device goes to sleeping mode, it would turn off LED for power saving. You can remove HalLedEnterSleep() and HalLedExitSleep() in halSleep() of hal_sleep.c to avoid this. Try and see if it works.

  • Yes , i will !

              it seems that LED is working normally at (POWER SAVING) PM2 mode as remove those function。

              but i always afarid that does the ZED really go into sleep ?Maybe  i need more test...

              anyway,why does the ZED can't wait for LED light on 2s before go into sleep?

              it is hard for believe that ZED can't wait all task Finnished to sleep !!!!

             

              if really like that ,how long does the ZED working from wake up to sleep ?

              how can we control it to work as long as we want???

  • If Z-Stack doesn't do this and your application don't turn off LED, CC2530 would never goes to sleep.

  • Z-Stack doesn't do this and your application don't turn off LED????? 

    if  Z-Stack doesn't do this and My App turn on LED then turn off LED after 2s, does the CC2530 go into sleep after 2s?

    or  do you mean i should accept one state of this issue

    whether  accept the LED could not be under control  ,flash in  random

    or accept the device could not working in PM2?

  • You misunderstand my replies. I mean that if you forget turn off LED and HalSleep doesn't turn off for you, it will wate power.

  • Hi chen :

                  i am curious about your meaning,forget  turn off LED ?

                  if i put a LED light ON in one event happen,is that mean i need to put HalLEDset(HAL_LED_ALL,HAL_LED_MODE_OFF) after the LED light ON ?  just like  that ;

                 if(event_happen)

                {

                    HalLedBlink ( HAL_LED_2, 1, 80, 2500);                   // light on  2S

                    HalLedSet ( HAL_LED_2, HAL_LED_MODE_OFF );// turn off LED

                } 

    but actually, the LED was light in a short time as like have not turn on 。。。。。could you please tecah me why? 

    and there is a question about ZDO_STATE in PM2.

    if there is a network,and ZED join success, everything was going well。but when network close ,it was so strange。

    although i Have config the NV_RESTORE, but when the ZED wake up from sleep,it seems that the ZDO_STATE_CHANGE was happen,because i saw the LED_2 was blink again and again,the UART was sending MSG every 1s,as i think the NWK_STATE failed MSG should be update in the second time when ZED wake up。。。

     case ZDO_STATE_CHANGE:
              zclZoneVibration_NwkState = (devStates_t)(MSGpkt->hdr.status);

             // LED4 blink 5times when ZDO_state_Change
    #ifdef LEDShow 
          HalLedBlink ( HAL_LED_2, 1, HAL_LED_DEFAULT_DUTY_CYCLE, HAL_LED_DEFAULT_FLASH_TIME );
    #endif 

              // now on the network
              if ( (zclZoneVibration_NwkState == DEV_ZB_COORD) ||
                   (zclZoneVibration_NwkState == DEV_ROUTER)   ||
                   (zclZoneVibration_NwkState == DEV_END_DEVICE) )
              {
            // when node is network reset the poll rate for save power
                  NLME_SetPollRate(60000);//ms 50s wake up
                  NLME_SetQueuedPollRate(100);//ms
                  NLME_SetResponseRate(100);//ms
    #ifdef UartShow
                HalUARTWrite(0,"Deveice on the network\n", sizeof("Deveice on the network\n"));
    #endif
    #ifdef ZCL_EZMODE
                zcl_EZModeAction( EZMODE_ACTION_NETWORK_STARTED, NULL );
    #endif // ZCL_EZMODE
              }
              else // lose the network
              {

                  NLME_SetPollRate(1000);//ms 1s wake up
                  NLME_SetQueuedPollRate(100);//ms
                  NLME_SetResponseRate(100);//ms
    #ifdef UartShow
                HalUARTWrite(0,"Deveice lose the network\n", sizeof("Deveice lose the network\n"));
    #endif    
              }
              break;

                 

    if  we want to sign two LED  MODE to showing  the its network state  one time, 

    when the ZED first time join network success ,light LED_2  2S, then turn OFF

    when the ZED first time  lose the network ,blink LED_2 2 times, and turn OFF,

    it is hard logic to put the code in zstack , how could we do?         

  • In ZDO_STATE_CHANGE, 

    if ( (zclZoneVibration_NwkState == DEV_ZB_COORD) ||
                   (zclZoneVibration_NwkState == DEV_ROUTER)   ||
                   (zclZoneVibration_NwkState == DEV_END_DEVICE) )
              {

                HalLedBlink ( HAL_LED_2, 1, 80,2500);

              }

    else if (zclZoneVibration_NwkState == DEV_NWK_ORPHAN)

              {

                HalLedBlink ( HAL_LED_2, 2, 50,1000);

              }

     

  • thanks Chen,

            if coding like upstairs,Are you forget to turn off the LED after blinking?

  • When you use blink function, LED will return to original status. In other words, LED will be off after blink if it is ON before blink.