Page 1 of 1

Data Retentive usage

PostPosted: Wed Dec 10, 2014 6:39 am
by baruch
I wanted to save others the pain I had to make use of the Data Retentive feature of the nRF24LE1. The Data Retentive means that the first 512 bytes of the XDATA space are kept across the memory retentive sleep modes and enable keeping state between sleeps.

It appears that in order for this to work you need to build with --no-xinit-opt so that the initial code will not zero out the memory space. This also means you can no longer rely on the variables to have zero by default for the globals since there is nothing that will zero them out.

Re: Data Retentive usage

PostPosted: Wed Dec 10, 2014 2:29 pm
by brennen
I can definitely see this being the case if you're using a sleep mode that requires the microcontroller to reset when it wakes up. If the microcontroller is using a sleep mode that doesn't reset on wakeup, however, you *shouldn't* have to worry about this, since you won't run back through the C startup code in that case that would initialize the memory space. But definitely a helpful post!

Re: Data Retentive usage

PostPosted: Wed Dec 10, 2014 3:08 pm
by baruch
That's true. In the nRF24LE1 the simple suspend case doesn't return to reset but rather continues from where it stopped and then there is no need to worry about this issue at all. For the last sleep mode (Deep Sleep) it doesn't help anyway since memory is not retained at all and the device returns as a complete reset. For the two before last sleep modes there is memory retention but no register retention and that's where I wanted to be. I wanted to have the deepest possible sleep (~3 microamp) and still keep state for the operation and also to get the timers working.

I spent quite a bit of time to figure this out and there was no other mention of this so I wanted to share this finding.

Re: Data Retentive usage

PostPosted: Wed Jan 14, 2015 12:19 pm
by Vittaly
baruch wrote:I wanted to have the deepest possible sleep (~3 microamp) and still keep state for the operation and also to get the timers working.

Dear baruch, was your unvestigations successfull? How I know, in deep sleep mode timers and RTC doesn't works... Right now I'm trying to implement Memory retention mode timers on, but power consumption is ~45 uA. So, it's quite big. Did you successfully realised some of the power saving modes and what current do you have?

Re: Data Retentive usage

PostPosted: Fri Jan 23, 2015 1:21 pm
by baruch
I don't have a good way to measure the low power draw so I can't know if it works or not. I believe I got the code to work but since I can't measure it I've left it for now until I find the equipment to measure the power draw.

Re: Data Retentive usage

PostPosted: Tue Dec 27, 2016 5:05 pm
by mahesh2000
hi, this is very confusing. i have 1536 bytes of xdata RAM (i.e. 0x600 = 1024 + 512). what part of this is data retentive and how do ensure that my data stays in that part? thanks!

Re: Data Retentive usage

PostPosted: Fri Dec 30, 2016 4:31 pm
by brennen
Are you talking about the nRF24LE1 or some other 8051 microcontroller?