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.

SensorTag Sleep mode or power down mode disable? CC2541

Other Parts Discussed in Thread: TMP006

Where in the Sensor Tag project code to I disable the ability for the device to go into sleep mode.  I'm trying to get an individual project I made working all while using the Sensor Tag code as a template but I want to be able to step through the code or see some things happening without it always going into sleep or power down modes. I just want the thing to run all the time and always transmit out the sensor data.

Thanks !!

  • Hey Christopher,

    To keep the device from sleeping look at the osal_pwrmgr_device() function and the PWRMGR_BATTERY and PWRMGR_ALWAYS_ON #defines. If device power management is set as PWRMGR_BATTERY then the sleep manager will be allowed to enter sleep mode.

    When OSAL is initialized it is set to ALWAYS_ON but if POWER_SAVING is a defined preprocessor symbol then PWRMGR_BATTERY will be used (look at main() in SensorTag_Main.c). To disable sleep go into your Project->Options->C/C++ Compiler->Preprocessor and make sure you remove POWER_SAVING.

    -Matt

  • ok i'll try that

  • I think that worked. It isn't going into power down mode anymore.   On my board i'm getting TMP006 sensor data sometimes in my app and sometimes not.  Do I have to change a lot of code to disable the powering down of each sensor?  is there a way I can just loop through all the 6 sensor's data without powering any one of them down?  Thanks !!

  • I don't know a very easy way to do this off the top of my head. I would start by picking one sensor and seeing if you can get it to always stay on. There are two major things that you will have to change at the very minimum.

    First is that all sensors are disabled until enabled via the characteristics. To see this look at accConfig (declaration in SesnorTag.c with all of the other sensor enabled state variables). it is initially set to ST_CFG_SENSOR_DISABLE. The only time it can be changed to a different state is in accelChangeCB which is called when there is a change in the accel. service. You will need to go through the code and change the behaviour so that it defaults to always enabled. This is an application layer change that doesn't affect the actual on/off of the sensor but instead the state variables in your application that control whether or not you read from the sensors.

    The second thing I see is that when a sesnor value is read using HAL functions, the sesnor is always turned off. For instance, look at readAccData() in SesnorTag.c and subsequently HalAccRead() in hal_acc.c. After reading the values the sensor is always turned off. In this case writing accSesnorOff. You will want to change this if you want the sesnor to be truly on the entire time.

    If you just want to read values from your application I would suggest only making the first change. The sensor will still turn on and off but from the perspective of your application it will never be in a state where it does not perform the read so it will be "always on" for all intents and purposes.

    Hopefully that wasn't super convoluted advice and gives you a place to start from.

    -Matt