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.

CC2652P: Detect I/O state change from Z-Stack

Part Number: CC2652P
Other Parts Discussed in Thread: Z-STACK, CCSTUDIO, , ENERGYTRACE, LAUNCHXL-CC1352P1

I have imported and modified the zed_sw application as: Z_POWER_TEST added, POWER_TEST_POLL_ACK added, CUI_DISABLE is used, xBOARD_DISPLAY_USE_UART is used, optimization set to 3, radio settings are at 60000 ms at 0 dBm, POWER_SOURCE_BATTERY is used. That achieves 10 uA.  That is good enough for now. Automatic network join works nicely.

There is one simple thing I would like to do. The zigbee end device has some button type (open or close) I/O to handle. Power consumption is crucial - looking for the least overhead.

After going through docs and threads, it looks some advice is needed:

1. I saw hal_key.c what supposed to have HalKeyExitSleep() in an old forum entry - not sure if that still exists and/or relevant. If so, then the question is that how to import that and then ensure it executes some code made for the case when zigbee sleep exit was caused by a keypress.

2. Using sensor controller is probably an alternative approach, although it is not clear how to interrupt Z-Stack sleep once triggered.

3. What I really would like to do (without increasing power consumption more than absolutely necessary, and which is cheaper of those):

a) get notified on button state change and send a message to the controller and go back to sleep. Easily done from an added thread, but expensive. Or

b) check button status every time when zigbee wakes up at POLL rate (60000 ms) and test current button status against last known and send message to controller if there was a change (delay is okay). Ideally, without modifying Z-Stack code, just by a callback or such. This feels the most efficient but unsure how to add some extra code to the networking cycle. Is it possible at all? Or

c) Use sensor controller, set variables based on button change, wake-up Z-Stack... and again the same situation: either another thread and semaphore is required (a) or adding some code to be executed in the zigbee thread (b).

The problem is power consumption. As soon as I add just one more thread to get the button callback (like 10 lines of code), 10 uA goes to 500 uA what shrinks battery life to an unusable level. 

Summary: how to implement an on-off switch with 1-2 buttons to use as much power as in the reference documentation while sending occasional open / close messages to the controller, like 5-10 per day?

  • Actually zed_sw implements BTN-1 and using interrupt and you can refer to its implementation.

  • Thank you for the reply.

    Unfortunately this is not helping with the power consumption issue.

    The referred code section is part of CUI what needs to be disabled for getting closer to the reference power consumption. Adding one more event loop in any form to handle an I/O state change increases it drastically; be it a callback or a periodical check.

    What is the best way to add code to be executed after Z-Stack event loop that checked for incoming messages - so no other event loop nor wake up from sleep is required?

  • Z-Stack event loop should be triggered by timer event or interrupt service only to save power consumption.

  • Hi Sandor,

    Thank you for referencing the Power Configuration section of the Z-Stack User's Guide.  Even after using CUI_DISABLE to remove overhead, you should be able to extract the sections of zcl_sampleapps_ui.c that concern CONFIG_BTN_LEFT/RIGHT and the Button TI Driver.  In this way you would be able to recover this particular GPIO functionality while keeping the LED/UART features disabled.  You should not consider hal_key.c as it concerns deprecated solution implementations.  Using this will still allow nearly the same power consumption numbers you observed previously.

    Regards,
    Ryan

  • Hi Ryan,

    I am clueless. All I did with ccstudio 12.2.0:

    - Import zed_sw

    - Open zed_sw.syscfg -> Z-Stack / Power Management all to 60000 and switch device to CC2652P1FSIP (our chip is a CC2652P1), some transfer happened by the dev env

    - Set Build / Arm Compiler / Optimization to 3

    - Set Predefined Symbols: xBOARD_DISPLAY_USE_UART, CUI_DISABLE, Z_POWER_TEST, POWER_TEST_POLL_ACK

    - In zcl_samplesw_data.c set zclSampleSw_PowerSource = POWER_SOURCE_BATTERY;

    - Built the project

    - Quit ccstudio, disconnected XDS-110

    - Reconnected XDS-110 and choose from Flash Programmer 2: CC2652P under XDS-110

    - CC26XX/CC13XX Force Mass Erase

    - Selected the .out file and uploaded to CC2652P, Verify: Readback -> Success!

    - Ejected / unpowered XDS-110, Quit from Flash Programmer 2, Reloaded ccstudio

    - Reconnected XDS-110 with the CC2652P with TMS/TCK removed

    - Ran EnergyTrace using CR2032 and AA batteries and 5 minutes. CR2032 result is 14 days, AA battery life is 1 year and 1 month.

    - I added the button handler as per the example in CUI_DISABLE and re-tested. CR2032 result is 14 days, AA battery life is 3 months.

    Is it possible that there is some hardware design issue why power consumption is higher than normal or shall these be the results anyways?


    I remember seeing many people having problem with power consumption for CC13XX/CC26XX - read most forum posts - and I do not recall any happy "Yes, it is solved" kind of answer. Should I just order dev kits from other manufacturers - as it looks like there is no resolution?

    Thank you,

    Sandor

  • The issue could likely be the example you are starting with, since the LAUNCHXL-CC1352P1 should be the basis of CC2652P1 development in accordance with the Migration Guide.  You can evaluate the gpiostandby example to confirm that you are evaluating EnergyTrace correctly, or use a standalone power analyzer or multimeter equipment to measure current consumption.  Please state your number in milli or micro Amps, you should expect ~ 1 micro Amp for either the zed_sw or gpiostandby if you project and hardware are set up properly.

    Regards,
    Ryan