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.

Using PM1 on CC2541

Other Parts Discussed in Thread: CC2540, CC2541

We've been having a hard time getting the I2C to work in our project after a wakeup from PM2 or PM3. We need to get something working fast, so we thought using PM1 instead of PM2 or PM3 would be a good thing to try since, according to the CC254X User's Guide, the I2C loses some of its state in PM2 and PM3 but not (apparently) in PM1. Can anyone (ideally from TI) tell me how to force the OSAL to only sleep as deeply as PM1 but never PM2 or PM3? From a quick look at the code for SDK version 1.4.0, it looks like it could be as simple as changing the following code in hal_sleep.c from

#define HAL_SLEEP_OFF CC2540_PM0
#define HAL_SLEEP_TIMER CC2540_PM2
#define HAL_SLEEP_DEEP CC2540_PM3

to

#define HAL_SLEEP_OFF CC2540_PM0
#define HAL_SLEEP_TIMER CC2540_PM1
#define HAL_SLEEP_DEEP CC2540_PM1

?

Thanks,

Gary

  • Hi Gary,

    Could it be related to the issue described in the errata?

    Cheers,
    Fredrik
  • Yes - the issues we're having could definitely be affected by the errata, as well as the fact that the I2C pretty much can't be used in PM2 or PM3 and needs to be reset when coming out of sleep. Let me ask a stupid question - has anyone ever successfully done a project using I2C (with CC2541 in either master or slave mode) using PM3, PM2 or even PM1 for that matter? There are apparently no sample apps in the TI distro that use I2C, so it would be good to know if we're charting known or unknown territory here. 

    Thanks,

    Gary

  • Hi Gary,

    I am guessing we have more CC2541 customers using I2C than not. For an application example you can refer to the SensorTag code.

    Cheers,
    Fredrik
  • Makes sense, since I think I2C is the only difference between CC2541 and CC2540. Good point r.e. SensorTag - at least the first version of it ran on CC2541. But in the SensorTag app the CC2541 acts as an I2C master. Do you (or does anyone) know of an application in which the CC2541 was used as an I2C Slave and in which PM1, PM2 or PM3 was used (successfully)? Would be ideal to have sample code for such an app; next best thing would be for someone to simply say "I did [or know of] a project like that and it worked great", etc.

    Thanks,
    Gary
  • Hi Gary,

    I did not catch that you are operating as I2C slave. That is a less used option :-) . It should work though, but unfortunately we do not have any examples for you.

    Can you be a bit more specific on what issues you are seeing when coming out of power mode? You are aware that all I2C registers are reset in PM2 and PM3 and that you have to reconfigure the module upon wake-up, right? Also keep in mind that the start-up time is significant, you cannot expect to be able to wake up on I2C data being sent from the master.

    The easiest way to stop the device from going to sleep (for testing) is to go to project options -> compiler -> preprocessor tab and remove POWER_SAVING from the defined symbols list.

    Cheers,
    Fredrik