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.

CC2530: Power conserve problem in end device!

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK,

Hi everyone.

I have release smart system with coordinator and end device(use Battery) but they have many issues.

I have some problems are as following:

1. After coordinator is power off and power on , end device can't rejoin to coordinator soon.

2. In 1) , power conserve in end device is high.

I want to lowest power conserve of end device with coordinator's status and coordinator communication with sleeping end device anytime.

Please help me.

Thanks in advance.

Piao

  • Which Z-Stack version do you use? Do you enable NV_RESTORE on your coordinator and end device?
  • Hi YiKai Chen.

    Thanks for your reply.

    I have use z-stack 2.5.1a and enable NV_RESTORE.

    Best regards.

    Piao
  • Hi YiKai Chen.

    I gonna append my project status.

    To save power of end device , I have use following code.

    #if !defined(ZDO_COORDINATOR)
    if ( events & SAMPLEAPP_WAIT_TOUCH_MSG_EVT)
    {
    delay1ms(10);
    InitKey(1);// GPIO Interrupt Enable (RX Pin of UART)
    halSleep(1 * 1000);//1s
    InitKey(0);// GPIO Interrupt Disable
    osal_start_timerEx( SampleApp_TaskID, SAMPLEAPP_WAIT_TOUCH_MSG_EVT, 100);//g_nWakeTimeOut);
    return (events ^ SAMPLEAPP_WAIT_TOUCH_MSG_EVT);
    }
    #endif

    I didn't use "POWER SAVING" because I did think that "power saving" not run well.

    I want to your opinion.

    Best regards.

    Piao
  • Z-Stack 2.5.1a is obsolete stack. I would suggest you to use latest Z-Stack to fix rejoin issue. For end device power consumption, you should enable POWER_SAVING to conserved power.

  • Hi YiKai Chen.

    Thanks for your reply.

    I have one question.

    When coordinator is power off,end device is able to conserve power?

    I hope your reply.

    Best regards.

    Piao
  • Hi YiKai Chen.

    If it use POWER SAVING, What is value of POLL RATE to reduce power consumption?

    Please help me.

    Piao
  • It will automatically stop poll rate
  • Hi,

    Z-Stack 3.0.1 for CC2530 uses a round-robin style super-loop to execute pending tasks within the system. If you are unsure what this means you can Google around for more information. The important part though is if you have the POWER_SAVING flag included in your build, when there are no pending tasks in the system (i.e. none of the task 'events' variables have any bits set in their bitmask), the OSAL layer will automatically put the device into low power mode. You can think of the poll rate like an "event" in the system. If your poll rate is set to 1000, the device will set the corresponding bit in the 'events' flag for the NWK layer every 1 second and this will wake up the device from power saving mode to send a data poll, then it will go back to sleep until the next event. So, if you extend your poll rate, you device will wake up less often and therefore it will save more power.

    If your end device is a direct child of a coordinator (or router for that matter) and you were to power that coordinator/router off, the end device would "Orphan" as soon as it tries to poll its missing parent and then it would start searching for a new parent, this is the intended behavior of an end device that loses its parent device in a Zigbee network.
  • Hi Jason.

    Thanks for your reply.

    I have understand fully your opinion.

    Sorry, I have one question.

    If coordinator or router is power off,How is power consumption of end device that find itself parent?

    Best regards.

    Piao
  • In Z-Stack 3.0, ZED would only send one beacon request to find parent. If it cannot find new parent to join, ZED would go to sleep mode which only consumes few micro Amps and application can do rescan later according to your own decision.
  • Hi YiKai Chen and Jason.

    I have port my project with z-stack 3.0.

    And I have use "POWER SAVING" and "POLL RATE = 1000".

    Then Standby current of my board(use CC2530 + RFX2401C) is about 1360uA.

    I have start from Generic App project.

    Please help me.

    Best regards.
    Piao
  • If you set POLL RATE = 10000 and check current consumption during device not polling, what current consumption do you see?
  • Hi YiKai Chen.

    Thanks for your quick reply.

    I have forgot that enable HAL_PA_LNA.

    I have enable HAL_PA_LNA and set POLL_RATE = 1000, standby current is 465uA.

    So I set again POLL_RATE = 10000,standby current is 192uA.

    Best regards.

    Piao
  • Hi YiKai Chen.

    Sorry my mistake reply.

    I have test wrong value of standby current.

    Either POLL_RATE = 1000 or POLL_RATE = 10000 , Standby current is 189uA.

    Piao
  • It sounds reasonable. To further reduce the sleeping power, I think you should check your HW.
  • Thank you very much.

    You are good.

    I will do your opinion.

    Best regards.

    Piao.
  • Hi YiKai Chen.

    I have port my project from z-stack 2.5.1 a to z-stack 3.0.1.
    But End device can't join to coordinator.
    End device don't send beacon request too.

    I hope your opinion.

    Thanks in advance.

    Piao
  • Do you call bdb_StartCommissioning to make device starting to send beacon requests?
  • Yes. YiKai Sir.
    I have put last of zclGenericApp_Init().
    bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_FORMATION | BDB_COMMISSIONING_MODE_NWK_STEERING | BDB_COMMISSIONING_MODE_FINDING_BINDING | BDB_COMMISSIONING_MODE_INITIATOR_TL);
  • This should make ZED send beacon requests. Do you have button on your ZED? If so, can you use button to trigger bdb_StartCommissioning instead of putting it in zclGenericApp_Init

  • I haven't button in my board.
    So I tried as following but result is same.
    In zclGenericApp_Init, I put osal_start_timerEx( zclEasenLock_TaskID, EASENLOCK_START_BDB_COMMISSIONING, 2000 );

    ....

    if ( events & EASENLOCK_START_BDB_COMMISSIONING )
    {

    bdb_StartCommissioning( BDB_COMMISSIONING_MODE_NWK_FORMATION |
    BDB_COMMISSIONING_MODE_NWK_STEERING |
    BDB_COMMISSIONING_MODE_FINDING_BINDING |
    BDB_COMMISSIONING_MODE_INITIATOR_TL );

    return ( events ^ EASENLOCK_START_BDB_COMMISSIONING );
    }
    ....
  • I put "bdb_StartCommissioning(BDB_COMMISSIONING_MODE_NWK_STEERING );" in Generic_Init to test and I can see it sends one beacon request.
  • Hi YK Chen Sir.
    You are right.
    I have test your opinion in zigbee development kit.

    I saw one beacon request.

    I gonna test more.

    Thanks your reply.

    Best regards.
  • Hi YK Chen Sir.

    I have test coord and end device.

    But End device sent to coord beacon request only.

    I attached sniffer log file.

    I don't know reason for it.

    Would you please explain to me for this?

    Please help me.

    Piao
  • I see a device keeps joining coordinator again and again. What coordinator do you use in this test?
  • I have build CoordinatorEB configuration and EndDeviceEB configration in same project.
  • This issue is usually caused by end device doesn't enable security and try to join a security enable coordinator. I suggest you to check this first.
  • YK Chen Sir.

    Cool! You are genius!

    I have forgot that I have changed "xSECURE = 1" in end device.

    Would you please explain to me Why you think so you see my sniffer log file?

    Thanks again.

    Best regards.

    Piao
  • My experiences told me that is the problem.
  • Hi YK Chen Sir.

    Sorry for disturb to you.

    I am testing coordinator and end device by using z-stack 3.0.1 now.

    Between Coordinator and end device was connected.

    In the end device is sending data request packet to coordinator.

    So When I press button,coordinator send "ABCDE" packet to end device.

    But In end device get nothing.

    Pls help me.

    Piao
  • sniffer_log2.psd

    I attached my sniffer log file.

    Please refer this.

  • Hi YK Chen Sir.

    Sorry for disturb to you.

    I am testing coordinator and end device by using z-stack 3.0.1 now.

    Between Coordinator and end device was connected.

    In the end device is sending data request packet to coordinator.

    So When I press button,coordinator send "ABCDE" packet to end device.

    But In end device get nothing.

    Pls help me.
    Thanks in advance. Piao
  • Do you still use GenericApp?
  • Yes. I customized GenericApp project.

    When I press button, Coord call as following function.

    SendToEndDevice(0);

    .....

    static uint8 SendToEndDevice(uint16 shortAddr)
    {
    int nRet = RET_FAILED;
    uint8 data[5] = "ABCDE";
    if(shortAddr == 0x0000)
    {
    //BroadCast
    EasenLock_Periodic_DstAddr.addrMode = (afAddrMode_t)AddrBroadcast;
    EasenLock_Periodic_DstAddr.endPoint = EasenLock_ENDPOINT;
    EasenLock_Periodic_DstAddr.addr.shortAddr = 0xFFFF;
    }
    else
    {
    //Unicast
    EasenLock_Periodic_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    EasenLock_Periodic_DstAddr.endPoint = EasenLock_ENDPOINT;
    EasenLock_Periodic_DstAddr.addr.shortAddr = shortAddr;
    }

    if ( AF_DataRequest( &EasenLock_Periodic_DstAddr, &EasenLock_epDesc,
    EasenLock_PERIODIC_CLUSTERID,
    10,
    (uint8 *)data,
    &EasenLock_TransID,
    0,
    AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {
    nRet = RET_SUCCESS;
    }

    return nRet;
    }
  • Why do you only have 5 bytes in data but the length byte in AF_DataRequest is 10?
  • Sorry.

    I changed contents of data[] because end device don't receive "ABCDEFGHIJ".

    I tried several case.

    But the result is same.

    Piao
  • If you use the same code, can the message be delivered from device to coordinator? If yes, can you provide sniffer log to show me the result?
  • Hi YK Chen Sir.

    Thanks for your reply.

    I attached sniffer log file.

    Coordinator send "ABCDE" to end device.

    sniffer_log3.psd

    Please help me.

    Piao

  • Sorry , YK Chen Sir.

    I have misunderstand your idea.

    I Will upload sniffer fie.

    Piao
  • I don't see end device sends anything to coordinator in your sniffer_log3.psd.
  • Hi YiKai Chen Sir.

    I uploaded again sniffer log file.

    sniffer_log4.psd

     Following is code send from End device to coord.

    static uint8 SendToCoord(void)
    {
    int nRet = RET_FAILED;
    uint8 data[6] = "UVWXYZ";

    //Unicast
    EasenLock_Periodic_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;
    EasenLock_Periodic_DstAddr.endPoint = EasenLock_ENDPOINT;
    EasenLock_Periodic_DstAddr.addr.shortAddr = 0x00;

    if ( AF_DataRequest( &EasenLock_Periodic_DstAddr, (endPointDesc_t *)&EasenLock_epDesc,
    EasenLock_PERIODIC_CLUSTERID,
    6,
    (uint8 *)data,
    &EasenLock_TransID,
    0/*AF_EN_SECURITY*/,
    AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
    {
    nRet = RET_SUCCESS;
    }

    HalLedSet(HAL_LED_1, HAL_LED_MODE_OFF);
    return nRet;
    }

    Piao

  • Yes, I can see the message is send from end device to coordinator now. If you use the same code to send message from coordinator to device, what do you see in sniffer?
  • Hi YK Chen Sir.

    I changed my code that coord and end device send equal data.

    static uint8 SendToEndDevice(uint16 shortAddr)

    {

       int nRet = RET_FAILED;

       uint8 data[5] = "ABCDE";

       if(shortAddr == 0x0000)

       {

           //BroadCast

           EasenLock_Periodic_DstAddr.addrMode = (afAddrMode_t)AddrBroadcast;

           EasenLock_Periodic_DstAddr.endPoint = EasenLock_ENDPOINT;

           EasenLock_Periodic_DstAddr.addr.shortAddr = 0xFFFF;

       }

       else

       {

           //Unicast

           EasenLock_Periodic_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;

           EasenLock_Periodic_DstAddr.endPoint = EasenLock_ENDPOINT;

           EasenLock_Periodic_DstAddr.addr.shortAddr = shortAddr;

       }

       if ( AF_DataRequest( &EasenLock_Periodic_DstAddr, &EasenLock_epDesc,

                          EasenLock_PERIODIC_CLUSTERID,

                          5,

                          (uint8 *)data,

    &EasenLock_TransID,

    0,

                          AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )

       {

           nRet = RET_SUCCESS;

       }

       return nRet;

    }

    static uint8 SendToCoord(void)

    {

       int nRet = RET_FAILED;

       uint8 data[5] = "ABCDE";

       //Unicast

       EasenLock_Periodic_DstAddr.addrMode = (afAddrMode_t)Addr16Bit;

       EasenLock_Periodic_DstAddr.endPoint = EasenLock_ENDPOINT;

       EasenLock_Periodic_DstAddr.addr.shortAddr = 0x00;

       if ( AF_DataRequest( &EasenLock_Periodic_DstAddr, (endPointDesc_t *)&EasenLock_epDesc,

                  EasenLock_PERIODIC_CLUSTERID,

                  5,

                  (uint8 *)data,

                  &EasenLock_TransID,

                  0/*AF_EN_SECURITY*/,

                  AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )

       {

           nRet = RET_SUCCESS;

       }

        HalLedSet(HAL_LED_1, HAL_LED_MODE_OFF);

       return nRet;

    }

    I attached sniffer log file.

    sniffer_log5.psd

    Piao

  • In your sniffer log, I can see end device receives "ABCDE" from coordinator.
  • Hi YK Chen Sir.

    Sorry , I can't see in my sniffer log fielyou saw .

    Would you please point to me in my sniffer file?

    Piao
  • And Then in my project didn't occur AF_INCOMING_MSG_CMD event.
  • Hi YK Chen Sir.

    Thanks for your fully advise again.

    I analyzed my sniffer log file too.

    But my result isn't equal with your result.

    What is my error?

    Would you please explain to me difference?

    And I have debug in my code, I got event for "AF_INCOMING_MSG_CMD".

    ///////////////////////////////////////

    if ( events & SYS_EVENT_MSG )
    {
    while ( (MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( EasenLock_TaskID )) )
    {
    printf("Receive SYSTEM EVETS = %d\n", MSGpkt->hdr.event);
    switch ( MSGpkt->hdr.event )
    {
    case ZCL_INCOMING_MSG:
    // Incoming ZCL Foundation command/response messages
    printf("ZCL Receive Message\n");
    zclEasenLock_ProcessIncomingMsg( (zclIncomingMsg_t *)MSGpkt );
    break;

    // Received when a messages is received (OTA) for this endpoint
    case AF_INCOMING_MSG_CMD:
    printf("Receive Message\n"); // 
    break;

    case AF_DATA_CONFIRM_CMD:
    break;

    case KEY_CHANGE:
    EasenLock_HandleKeys( ((keyChange_t *)MSGpkt)->state, ((keyChange_t *)MSGpkt)->keys );
    break;

    Please help me.

    Best regards.

    Piao