Keeping state information during Deep sleep

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

Working on BCM20737 I need to keep some state information when the device enters Deep Sleep (HID off). what I need to keep is a pointer and a write buffer with values changing frequently therefore the NVRAM wouldn't help due to limited write cycles.

is there any way to keep this information in some special memory bank or buffer that won't be cleared when the device enters Deep sleep ?

Thanks !

0 Likes
1 Solution
Anonymous
Not applicable

Hi kwang,

sorry for my late reply

there is not much progress since I asked the question, I figured out a way to do my project without needing any of the state bits. but still would be nice if I can use them.

View solution in original post

0 Likes
12 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

My understanding is that the bb and core are off during deep sleep, and you will also lost the ram content. Upon waking up, the application has to be reloaded onto ram and initialized again. That's why state information is not retained. 

0 Likes
Anonymous
Not applicable

That is what I know too, but since even in Deep sleep some parts of the chip are still powered on (the RTC and GPIO logic) I was wondering if there is an auxiliary memory that is retained, just a few bytes would be enough.

0 Likes
Anonymous
Not applicable

Hello sheref.younan

We do not support the NVRAM feature in Deep Sleep mode.

Thanks

JT

0 Likes

> We do not support the NVRAM feature in Deep Sleep mode.

Just to clarify here - what JT means is that no on-chip memory/storage block (RAM or otherwise) is powered on when in deep sleep. So you cannot store anything in it. There are a few bits available, but not enough for a pointer, see bleprofile_ReadNVRAM Return Value

Anonymous
Not applicable

Thanks arvinds ! the mia_setKeepstate1() and mia_getKeepstate1() is exactly what I'm looking for, however when I try to store my values using them the deep sleep operation is disrupted. it seems that they are used internally.

can you confirm which bits are reserved and which are available for user applications ?

Confirmed that two 16 bit registers for mia_setKeepstate0() and mia_getKeepstate1() will accomplish what you need.

Note that mia_setKeepstate0() bit 0 is used by the firmware, but the other 31 bits are available.

sheref.younan jasonrc

0 Likes
Anonymous
Not applicable

mwf_mmfae arvinds

Thank you for your reply, however it seems that there is something missing here. starting from the sample application "rtc_sample" I just added one line after ble_trace0("rtc_sample_create()\n") to set upper 4 bits of Keepstate1, so the code is :

ble_trace0("rtc_sample_create()\n");

mia_setKeepstate1(0xF000);

This code enters and exits deep sleep correctly just once, on the second entry to deep sleep the chip never wakes up again (and I see that the current consumption is high, meaning that it didn't actually enter deep sleep)

jasonrc

0 Likes

Confused.

You were looking for a few NV bits to store some data right?

Now you are saying the chip never wakes up, yet because of the current consumption you are not sure it is even asleep. Does sleep work when you are not setting the upper 4 bits of Keepstate1? Not going to sleep is addressed in a dozen or so other threads on the site.

0 Likes
Anonymous
Not applicable

mwf_mmfae

Yes I'm trying to use setKeepstate1 and now the chip is misbehaving.

same project without the "mia_setKeepstate1(0xF000)" call goes to sleep and wakes after 5 seconds just as the example supposed to work.

Regards

0 Likes
Anonymous
Not applicable

Hello Sheref,

Can you use Keepstate0 bits 15 to 8 and see if this resolves the problem?

Thanks

JT

0 Likes
Anonymous
Not applicable

sheref.younan Is this still an issue?

0 Likes
Anonymous
Not applicable

Hi kwang,

sorry for my late reply

there is not much progress since I asked the question, I figured out a way to do my project without needing any of the state bits. but still would be nice if I can use them.

0 Likes