Data Retentive usage

Questions for programming 8051 microcontrollers in C or assembly using SDCC

Data Retentive usage

Postby baruch » Wed Dec 10, 2014 6:39 am

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.
baruch
 
Posts: 14
Joined: Mon Nov 17, 2014 10:15 am

Re: Data Retentive usage

Postby brennen » Wed Dec 10, 2014 2:29 pm

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!
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm

Re: Data Retentive usage

Postby baruch » Wed Dec 10, 2014 3:08 pm

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.
baruch
 
Posts: 14
Joined: Mon Nov 17, 2014 10:15 am

Re: Data Retentive usage

Postby Vittaly » Wed Jan 14, 2015 12:19 pm

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?
Vittaly
 
Posts: 7
Joined: Wed Jan 14, 2015 12:12 pm

Re: Data Retentive usage

Postby baruch » Fri Jan 23, 2015 1:21 pm

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.
baruch
 
Posts: 14
Joined: Mon Nov 17, 2014 10:15 am

Re: Data Retentive usage

Postby mahesh2000 » Tue Dec 27, 2016 5:05 pm

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!
mahesh2000
 
Posts: 1
Joined: Tue Dec 27, 2016 4:55 pm

Re: Data Retentive usage

Postby brennen » Fri Dec 30, 2016 4:31 pm

Are you talking about the nRF24LE1 or some other 8051 microcontroller?
brennen
Site Admin
 
Posts: 395
Joined: Sun Aug 17, 2008 2:15 pm


Return to 8051 Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron