Reply by Scott Henion May 17, 20052005-05-17
At 12:09 PM 5/17/2005, you wrote:

>Hi,
>
> Excellent, your code is working perfectly on
>RCM3010. I tried your code. RCM3010 is having only
>slow SRAM. I succeed to restore the variables even
>after the power failure. I used "Protected" keyword &
>_sysIsSoftreset(). Thanks for a sample code.
> Could you tell me about, How many no. of variable I
>can restore in the battery back up SRAM?
> In RABBITBIOS.c it is mentioned as BBRAMDATASIZE is
>Zero. Please, tell me HOW many variables I can
>restore from the battery back up SRAM? Is there any
>setting to do this?
>
>With regards,

On the 3010 all RAM is battery backed. You don't need the protected keyword
or use _sysIsSoftReset(). I use it on boards without it.

The protected is used to restore multi-byte variables if the system is
reset in the middle of an update. It slows code down as it has to make 2
copies of the data. I prefer to use simpler measures.

All of RAm is battery backed on the 3010. Even memory xalloc()'ed. I use
87k of battery-backed data on a RCM2200 (128k RAM). Same code runs on the
3010 or 3700.

The is a bios option to clear RAM on start up. This is normally disabled.
Otherwise, all RAM on boards witout fast RAM is untouched on a reset.
<Scott>

------
| Scott G. Henion| shenion@shen... |
| Consultant | Stone Mountain, GA |
| SHDesigns | PGP Key 0xE98DDC48 |
| http://www.shdesigns.org/rabbit/ |
------ --
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.11 - Release Date: 5/16/2005


Reply by Prashant Y May 17, 20052005-05-17
Hi,

Excellent, your code is working perfectly on
RCM3010. I tried your code. RCM3010 is having only
slow SRAM. I succeed to restore the variables even
after the power failure. I used "Protected" keyword &
_sysIsSoftreset(). Thanks for a sample code.
Could you tell me about, How many no. of variable I
can restore in the battery back up SRAM?
In RABBITBIOS.c it is mentioned as BBRAMDATASIZE is
Zero. Please, tell me HOW many variables I can
restore from the battery back up SRAM? Is there any
setting to do this?

With regards,

Prashant.
--- Prashant Y <pra_shant3000@pra_...> wrote:
> Hi,
>
> Thanks for giving a sample code .
>
> With regards,
>
> Prashant.
>
> Andy <ajpriv@ajpr...> wrote:
> Hi All,
>
> I have been following this subject with interest. I
> have been trying to
> get the SRAM on RCM3300 to retain its content when
> the power is
> switched off.
>
> I am using RCM3300 prototyping board for
> development, which already has
> a battery connected to the VBAT-EXT pin on the
> RCM3300 module. The
> battery is 3.0 V.
>
> In my software I used protected keyword when
> declaring variables that I
> want to back-up. However, the SRAM seems to lose its
> content when I
> unplugged the power. The RTC seems to retain the
> time, when power is
> removed.
>
> I attached sample test code below. What did I do
> wrong?
********************************************************************
>
> #use rcm33xx.lib
>
> protected char nvram[16];
> protected char ch;
>
> main()
> {
> unsigned long Clock;
> struct tm Time;
>
> brdInit();
>
> _sysIsSoftReset();
>
> printf( "Content of nvram after power-up: %s\n",
> nvram );
> printf( "Content ch after power-up: %d\n", ch );
>
> ch = 123;
> strcpy( nvram, "New content");
>
> printf( "Content of nvram: %s\n", nvram );
> printf( "Content of ch: %d\n", ch );
>
> while(1){
> costate{
> // wait 1 second before displaying time
> waitfor( DelaySec( 1 ) ) ;
>
> Clock = read_rtc();
> mktm( &Time, Clock );
>
> printf( "Time: %02d:%02d:%02d\n",
> Time.tm_hour,
> Time.tm_min, Time.tm_sec );
> }
> }
> }
****************************************************************
>
>
> --- Mike van Meeteren <mike@mike...> wrote:
> > At 06:06 PM 5/11/2005 +0000, you wrote:
> > >
> > >Hi Friends,
> > >
> > > Is there any 3.3V battery backup facility for
> SRAM of RCM3010?
> > >I think, 3.3V battery backup is only available
> for RTC, in RCM3010.
> > >I need a RCM module with battery backed facility
> for SRAM.
> > > Please, tell me ,such RCM modules with 3.3V
> battery backup for
> > >both SRAM & RTC. Also tell me ,what extra
> hardware & control
> > signals
> > >are required to give a battery back up for SRAM
> & RTC.
> >
> > 3010 has battery backed ram, I use it. Only
> hardware you need is a
> > 3v
> > battery, holder, and 1.4K resistor, hooked to the
> VBAT_EXT pin on the
> > core
> > module.
> >
> >
> Yahoo! Mail
> Stay connected, organized, and protected. Take the
> tour:
> http://tour.mail.yahoo.com/mailtour.html >
> ---------------------------------
> Yahoo! Groups Links
>
> To > __________________________________________________
>
__________________________________



Reply by Nathan Johnston May 16, 20052005-05-16

Andy,

 

Those “compiler switches” are looked after for you. Basically it’s checking that your using a RCM that has fast SRAM and that you’re compiling to flash, run in RAM.

 

This thread seems to have gone down a couple of paths. If you are the person working with the RCM3010 I would not recommend you do your development on an RCM with fast RAM because you will waste a lot of time with battery backed issues that won’t affect you with the RCM3010…

 

Regards,

Nathan

 

-----Original Message-----
From: r...@yahoogroups.com [mailto:r...@yahoogroups.com] On Behalf Of Andy
Sent:
Tuesday, 17 May 2005 10:37 AM
To: r...@yahoogroups.com
Subject: RE: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in RCM3010?

 

Hi Nathan,

Thanks for the reply.

I am actually doing my development on RCM3300 using DC 8.51. I had a
brief look in the BIOS.C and it seems that the BBROOTDATASIZE is only
set to 0x1000, when the following compiler switches are defined. 

---------------
#if (FAST_RAM_COMPILE && (RUN_IN_RAM_CS =0x2))      // Only if we have a
battery-backed RAM on CS1
  #define BBROOTDATASIZE 0x1000      // Size of battery-backed data
  #define BBROOTDATAORG STACKORG-0x1      // battery-backed root data org

...

#else
  #define BBROOTDATASIZE 0x0      // Default to zero (does not exist)
#endif
------------------

There is  a patch for DC 8.51 on Z-World website, but not for DC 8.61.
I assume the bug is still not fixed.

I also found out the work-around like you said in your reply. It is
just a bit of a hassle to go through tens of thousand of lines to make
the changes, when the code was already stable. Well, at least there is
a work-around.

Regards,
Andy --- Nathan Johnston <n...@dominion.net.au> wrote:

> Andy,

> BBROOTDATASIZE will be set to 0 because you are using an RCM3010
> which
> doesn't have fast SRAM, so the bbram keyword is just (well supposed
> to
> be -> see next paragraph) ignored. The RCM3010 shouldn't even let you
> combine to flash run in RAM, i.e. it should give you an error saying
> it
> is not supported with this RCM. For an RCM3010 all you need to do is
> ensure VBAT is properly connected, then define your variables as
> static...

> You have discovered a bbram bug which I reported to ZWorld last
> August,
> and they acknowledged it was a bug. It was with Dynamic C 8.61. I
> would
> hope they have fixed it in more recent versions but I have not tested
> it. Out of interest, what version of Dynamic C are you using?

> This is the program I sent to ZWorld which highlights the bug (and
> shows
> work around).

> Regards,
> Nathan


> //Demonstrates problem copying bbram struct members using pointers

> struct testStruct
> {
>             char charVar;
> };

> bbram static struct testStruct bbramTest, bbramTest2;
> struct testStruct nonbbramTest;

> void main()
> {
>             //bbram static struct testStruct *src, *dst;
> //Tried this incase pointers to bbram must be static but still same
> problem
>    struct testStruct *src, *dst;

>    //Set variable to some initial value
>    bbramTest.charVar = 1;

>    //Copy from bbram to non bbram (no pointers)
>    nonbbramTest.charVar bbramTest.charVar;

>    //Copy from non bbram to bbram (no pointers)
>    bbramTest.charVar nonbbramTest.charVar;

>    //Repeat process above using pointers
>    src = &bbramTest;
>    dst = &nonbbramTest;

>    //Copy bbram into non bbram using pointers
>    dst->charVar src->charVar;

>    src = &nonbbramTest;
>    dst = &bbramTest;

>    //Copy non bbram into bbram using pointers
>    //** Gives erroneous pointer assignment exception! **
>    dst->charVar src->charVar;

>    src = &bbramTest;
>    dst = &bbramTest2;

>    //Copy bbram into bbram using pointers
>    //** Gives erroneous pointer assignment exception! **
>    dst->charVar src->charVar;
> }
> -----Original Message-----
> From: r...@yahoogroups.com
> [mailto:r...@yahoogroups.com]
> On Behalf Of Andy
> Sent:
Monday, 16 May 2005 8:37 PM
> To: r...@yahoogroups.com
> Subject: RE: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in
> RCM3010?

> Oops, Yahoo decided to send my reply before I finished writing it.
>
> Let me start again.
>
> In my code I have a (global) struct. I pass the address of the struct
> to a function. When I tried to assign a value to a member of the
> struct in the function I got "Run Time Error: Erroneous Pointer
> Assignment".
>
> //Sample code
>
> typedef struct _importantData{
>   char Text[10];
>   word Val;
> }IMPORTANT_DATA;
>
> bbram IMPORTANT_DATA ImpData;
>
>
> void Initialise( IMPORTANT_DATA *pData )
> {
>   pData->Val = 100;
> }
>
>
> void main()
> {
>   Initialise( &ImpData );
> }
>
> This does not happen if ImpData is declared without "bbram" keyword.
>
> Can anyone explain what's going on here?
>
> Regards,
> Andy
>
>
>
> --- Nathan Johnston <n...@dominion.net.au> wrote:
> > What do you mean by "Using the other compiler switches does not
> seem
> > to
> > enable the BBROOTDATA area"?
> > 
> > I recently needed to (re-)investigate how bbram worked again so I
> > might
> > as well share my findings seeing as there is no documentation
> > available
> > on this...
> > 
> > The amount of bbram is controlled by BBROOTDATASIZE in the bios. If
> > you
> > increase this you will end up losing some root data space due to
> how
> > this space is mapped into the logical address range. The rest of
> the
> > battery backed ("slow") SRAM is available in xmem, however only
> > physical
> > addresses above 0x80000 (in RCM3200 anyway) are battery backed. In
> > more
> > recent versions of Dynamic C (above 8.30?) there is an _xalloc
> > function
> > that allows you to specify whether you want the xmem area being
> > allocated to be battery backed or not. For earlier versions you
> just
> > need to be smart with your xalloc/avail calls.
> > 
> > The memory_usage.c sample program is really good tool to see what
> is
> > going on when you start playing with this stuff...
> > 
> > Regards,
> > Nathan
> > 
> > -----Original Message-----
> > From: r...@yahoogroups.com
> > [mailto:r...@yahoogroups.com]
> > On Behalf Of Andy
> > Sent:
Friday, 13 May 2005 8:55 PM
> > To: r...@yahoogroups.com
> > Subject: Re: [rabbit-semi] 3.3 V--
Battery-Back up for Static RAM
> in
> > RCM3010?
> > 
> > Thanks to Scott and every one else who replied to my post.
> >
> > I managed to get the SRAM on the RCM3300 to retain its content by
> > using
> > the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch
> > and
> > bbram keyword. Using the other compiler switches does not seem to
> > enable the BBROOTDATA area.
> >
> > Regards,
> > Andy 
> >
> >
> > --- Scott Henion <s...@shdesigns.org> wrote:
> > > At
04:31 AM 5/12/2005, you wrote:
> > >
> > > >Hi All,
> > > >
> > > >I have been following this subject with interest. I have been
> > trying
> > > to
> > > >get the SRAM on RCM3300 to retain its content when the power is
> > > >switched off.
> > > >
> > > >I am using RCM3300 prototyping board for development, which
> > already
> > > has
> > > >a battery connected to the VBAT-EXT pin on the RCM3300 module.
> The
> > > >battery is 3.0 V.
> > > >
> > > >In my software I used protected keyword when declaring variables
>
=== message truncated ===
           
Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and more. Check it out!
http://discover.yahoo.com/mobile.html



Reply by Andy May 16, 20052005-05-16
Hi Nathan,

Thanks for the reply.

I am actually doing my development on RCM3300 using DC 8.51. I had a
brief look in the BIOS.C and it seems that the BBROOTDATASIZE is only
set to 0x1000, when the following compiler switches are defined.

---------------
#if (FAST_RAM_COMPILE && (RUN_IN_RAM_CS == 0x2)) // Only if we have a
battery-backed RAM on CS1
#define BBROOTDATASIZE 0x1000 // Size of battery-backed data
#define BBROOTDATAORG STACKORG-0x1 // battery-backed root data org

...

#else
#define BBROOTDATASIZE 0x0 // Default to zero (does not exist)
#endif
------------------

There is a patch for DC 8.51 on Z-World website, but not for DC 8.61.
I assume the bug is still not fixed.

I also found out the work-around like you said in your reply. It is
just a bit of a hassle to go through tens of thousand of lines to make
the changes, when the code was already stable. Well, at least there is
a work-around.

Regards,
Andy --- Nathan Johnston <nathanj@nath...> wrote:

> Andy,
>
> BBROOTDATASIZE will be set to 0 because you are using an RCM3010
> which
> doesn't have fast SRAM, so the bbram keyword is just (well supposed
> to
> be -> see next paragraph) ignored. The RCM3010 shouldn't even let you
> combine to flash run in RAM, i.e. it should give you an error saying
> it
> is not supported with this RCM. For an RCM3010 all you need to do is
> ensure VBAT is properly connected, then define your variables as
> static...
>
> You have discovered a bbram bug which I reported to ZWorld last
> August,
> and they acknowledged it was a bug. It was with Dynamic C 8.61. I
> would
> hope they have fixed it in more recent versions but I have not tested
> it. Out of interest, what version of Dynamic C are you using?
>
> This is the program I sent to ZWorld which highlights the bug (and
> shows
> work around).
>
> Regards,
> Nathan > //Demonstrates problem copying bbram struct members using pointers
>
> struct testStruct
> {
> char charVar;
> };
>
> bbram static struct testStruct bbramTest, bbramTest2;
> struct testStruct nonbbramTest;
>
> void main()
> {
> //bbram static struct testStruct *src, *dst;
> //Tried this incase pointers to bbram must be static but still same
> problem
> struct testStruct *src, *dst;
>
> //Set variable to some initial value
> bbramTest.charVar = 1;
>
> //Copy from bbram to non bbram (no pointers)
> nonbbramTest.charVar = bbramTest.charVar;
>
> //Copy from non bbram to bbram (no pointers)
> bbramTest.charVar = nonbbramTest.charVar;
>
> //Repeat process above using pointers
> src = &bbramTest;
> dst = &nonbbramTest;
>
> //Copy bbram into non bbram using pointers
> dst->charVar = src->charVar;
>
> src = &nonbbramTest;
> dst = &bbramTest;
>
> //Copy non bbram into bbram using pointers
> //** Gives erroneous pointer assignment exception! **
> dst->charVar = src->charVar;
>
> src = &bbramTest;
> dst = &bbramTest2;
>
> //Copy bbram into bbram using pointers
> //** Gives erroneous pointer assignment exception! **
> dst->charVar = src->charVar;
> }
> -----Original Message-----
> From: rabbit-semi@rabb...
> [mailto:rabbit-semi@rabb...]
> On Behalf Of Andy
> Sent: Monday, 16 May 2005 8:37 PM
> To: rabbit-semi@rabb...
> Subject: RE: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in
> RCM3010?
>
> Oops, Yahoo decided to send my reply before I finished writing it.
>
> Let me start again.
>
> In my code I have a (global) struct. I pass the address of the struct
> to a function. When I tried to assign a value to a member of the
> struct in the function I got "Run Time Error: Erroneous Pointer
> Assignment".
>
> //Sample code
>
> typedef struct _importantData{
> char Text[10];
> word Val;
> }IMPORTANT_DATA;
>
> bbram IMPORTANT_DATA ImpData; > void Initialise( IMPORTANT_DATA *pData )
> {
> pData->Val = 100;
> } > void main()
> {
> Initialise( &ImpData );
> }
>
> This does not happen if ImpData is declared without "bbram" keyword.
>
> Can anyone explain what's going on here?
>
> Regards,
> Andy >
> --- Nathan Johnston <nathanj@nath...> wrote:
> > What do you mean by "Using the other compiler switches does not
> seem
> > to
> > enable the BBROOTDATA area"?
> >
> > I recently needed to (re-)investigate how bbram worked again so I
> > might
> > as well share my findings seeing as there is no documentation
> > available
> > on this...
> >
> > The amount of bbram is controlled by BBROOTDATASIZE in the bios. If
> > you
> > increase this you will end up losing some root data space due to
> how
> > this space is mapped into the logical address range. The rest of
> the
> > battery backed ("slow") SRAM is available in xmem, however only
> > physical
> > addresses above 0x80000 (in RCM3200 anyway) are battery backed. In
> > more
> > recent versions of Dynamic C (above 8.30?) there is an _xalloc
> > function
> > that allows you to specify whether you want the xmem area being
> > allocated to be battery backed or not. For earlier versions you
> just
> > need to be smart with your xalloc/avail calls.
> >
> > The memory_usage.c sample program is really good tool to see what
> is
> > going on when you start playing with this stuff...
> >
> > Regards,
> > Nathan
> >
> > -----Original Message-----
> > From: rabbit-semi@rabb...
> > [mailto:rabbit-semi@rabb...]
> > On Behalf Of Andy
> > Sent: Friday, 13 May 2005 8:55 PM
> > To: rabbit-semi@rabb...
> > Subject: Re: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM
> in
> > RCM3010?
> >
> > Thanks to Scott and every one else who replied to my post.
> >
> > I managed to get the SRAM on the RCM3300 to retain its content by
> > using
> > the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch
> > and
> > bbram keyword. Using the other compiler switches does not seem to
> > enable the BBROOTDATA area.
> >
> > Regards,
> > Andy
> >
> >
> > --- Scott Henion <shenion@shen...> wrote:
> > > At 04:31 AM 5/12/2005, you wrote:
> > >
> > > >Hi All,
> > > >
> > > >I have been following this subject with interest. I have been
> > trying
> > > to
> > > >get the SRAM on RCM3300 to retain its content when the power is
> > > >switched off.
> > > >
> > > >I am using RCM3300 prototyping board for development, which
> > already
> > > has
> > > >a battery connected to the VBAT-EXT pin on the RCM3300 module.
> The
> > > >battery is 3.0 V.
> > > >
> > > >In my software I used protected keyword when declaring variables
>
=== message truncated ===

Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and more. Check it out!
http://discover.yahoo.com/mobile.html



Reply by Nathan Johnston May 16, 20052005-05-16

Andy,

 

BBROOTDATASIZE will be set to 0 because you are using an RCM3010 which doesn’t have fast SRAM, so the bbram keyword is just (well supposed to be -> see next paragraph) ignored. The RCM3010 shouldn’t even let you combine to flash run in RAM, i.e. it should give you an error saying it is not supported with this RCM. For an RCM3010 all you need to do is ensure VBAT is properly connected, then define your variables as static…

 

You have discovered a bbram bug which I reported to ZWorld last August, and they acknowledged it was a bug. It was with Dynamic C 8.61. I would hope they have fixed it in more recent versions but I have not tested it. Out of interest, what version of Dynamic C are you using?

 

This is the program I sent to ZWorld which highlights the bug (and shows work around).

 

Regards,

Nathan

 

 

//Demonstrates problem copying bbram struct members using pointers

 

struct testStruct

{

            char charVar;

};

 

bbram static struct testStruct bbramTest, bbramTest2;

struct testStruct nonbbramTest;

 

void main()

{

            //bbram static struct testStruct *src, *dst;            //Tried this incase pointers to bbram must be static but still same problem

   struct testStruct *src, *dst;

 

   //Set variable to some initial value

   bbramTest.charVar = 1;

 

   //Copy from bbram to non bbram (no pointers)

   nonbbramTest.charVar = bbramTest.charVar;

 

   //Copy from non bbram to bbram (no pointers)

   bbramTest.charVar = nonbbramTest.charVar;

 

   //Repeat process above using pointers

   src = &bbramTest;

   dst = &nonbbramTest;

 

   //Copy bbram into non bbram using pointers

   dst->charVar = src->charVar;

 

   src = &nonbbramTest;

   dst = &bbramTest;

 

   //Copy non bbram into bbram using pointers

   //** Gives erroneous pointer assignment exception! **

   dst->charVar = src->charVar;

 

   src = &bbramTest;

   dst = &bbramTest2;

 

   //Copy bbram into bbram using pointers

   //** Gives erroneous pointer assignment exception! **

   dst->charVar = src->charVar;

}

-----Original Message-----
From: r...@yahoogroups.com [mailto:r...@yahoogroups.com] On Behalf Of Andy
Sent:
Monday, 16 May 2005 8:37 PM
To: r...@yahoogroups.com
Subject: RE: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in RCM3010?

 

Oops, Yahoo decided to send my reply before I finished writing it.

Let me start again.

In my code I have a (global) struct. I pass the address of the struct
to a function. When I tried to assign a value to a member of the
struct in the function I got "Run Time Error: Erroneous Pointer
Assignment".

//Sample code

typedef struct _importantData{
  char Text[10];
  word Val;
}IMPORTANT_DATA;

bbram IMPORTANT_DATA ImpData; void Initialise( IMPORTANT_DATA *pData )
{
  pData->Val = 100;
} void main()
{
  Initialise( &ImpData );
}

This does not happen if ImpData is declared without "bbram" keyword.

Can anyone explain what's going on here?

Regards,
Andy
--- Nathan Johnston <n...@dominion.net.au> wrote:
> What do you mean by "Using the other compiler switches does not seem
> to
> enable the BBROOTDATA area"?

> I recently needed to (re-)investigate how bbram worked again so I
> might
> as well share my findings seeing as there is no documentation
> available
> on this...

> The amount of bbram is controlled by BBROOTDATASIZE in the bios. If
> you
> increase this you will end up losing some root data space due to how
> this space is mapped into the logical address range. The rest of the
> battery backed ("slow") SRAM is available in xmem, however only
> physical
> addresses above 0x80000 (in RCM3200 anyway) are battery backed. In
> more
> recent versions of Dynamic C (above 8.30?) there is an _xalloc
> function
> that allows you to specify whether you want the xmem area being
> allocated to be battery backed or not. For earlier versions you just
> need to be smart with your xalloc/avail calls.

> The memory_usage.c sample program is really good tool to see what is
> going on when you start playing with this stuff...

> Regards,
> Nathan

> -----Original Message-----
> From: r...@yahoogroups.com
> [mailto:r...@yahoogroups.com]
> On Behalf Of Andy
> Sent:
Friday, 13 May 2005 8:55 PM
> To: r...@yahoogroups.com
> Subject: Re: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in
> RCM3010?

> Thanks to Scott and every one else who replied to my post.
>
> I managed to get the SRAM on the RCM3300 to retain its content by
> using
> the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch
> and
> bbram keyword. Using the other compiler switches does not seem to
> enable the BBROOTDATA area.
>
> Regards,
> Andy 
>
>
> --- Scott Henion <s...@shdesigns.org> wrote:
> > At
04:31 AM 5/12/2005, you wrote:
> >
> > >Hi All,
> > >
> > >I have been following this subject with interest. I have been
> trying
> > to
> > >get the SRAM on RCM3300 to retain its content when the power is
> > >switched off.
> > >
> > >I am using RCM3300 prototyping board for development, which
> already
> > has
> > >a battery connected to the VBAT-EXT pin on the RCM3300 module. The
> > >battery is 3.0 V.
> > >
> > >In my software I used protected keyword when declaring variables
> > that I
> > >want to back-up. However, the SRAM seems to lose its content when
> I
> > >unplugged the power. The RTC seems to retain the time, when power
> is
> > >removed.
> > >
> > >I attached sample test code below. What did I do wrong?
> >
> > The 3200, 3300 and 3800 have fast and slow ram. The fast RAM is not
> > backed
> > up, the slow RAM is. By default all variables go in the fast RAM.
> > Modules
> > that don't have fast RAM have all variables backed up by default.
> >
> > Look at the "bbram" keyword. There is a sample in:
> > ..\Samples\RestartVars\BatteryRAM\bbvars.c
> >
> > <Scott>
> > ------
> >
> > | Scott G. Henion| s...@shdesigns.org |
> > |   Consultant   |  
Stone Mountain, GA  |
> > |   SHDesigns    |   PGP Key 0xE98DDC48  |
> > |     http://www.shdesigns.org           |
> > ------
> > today's fortune
> > mophobia, n.:
> >          Fear of being verbally abused by a Mississippian.
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.11.9 - Release Date:
> 5/12/2005
> >
> >
> >
>
>
>            
> __________________________________
>
>
>
> ________________________________
>
> > .
>            
Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and more. Check it out!
http://discover.yahoo.com/mobile.html



Reply by Prashant Y May 16, 20052005-05-16
Hi,
 
     Thanks for giving a sample code  . 
 
With regards,
 
Prashant.

Andy <a...@yahoo.com> wrote:
Hi All,

I have been following this subject with interest. I have been trying to
get the SRAM on RCM3300 to retain its content when the power is
switched off.

I am using RCM3300 prototyping board for development, which already has
a battery connected to the VBAT-EXT pin on the RCM3300 module. The
battery is 3.0 V.

In my software I used protected keyword when declaring variables that I
want to back-up. However, the SRAM seems to lose its content when I
unplugged the power. The RTC seems to retain the time, when power is
removed.

I attached sample test code below. What did I do wrong?

********************************************************************

#use rcm33xx.lib           

protected char nvram[16];
protected char ch;

main()
{
    unsigned long Clock;
    struct tm Time;

    brdInit();

    _sysIsSoftReset();

    printf( "Content of nvram after power-up: %s\n", nvram );
    printf( "Content ch after power-up: %d\n", ch );

    ch = 123;
    strcpy( nvram, "New content");

    printf( "Content of nvram: %s\n", nvram );
    printf( "Content of ch: %d\n", ch );

    while(1){
          costate{
            // wait 1 second before displaying time
            waitfor( DelaySec( 1 ) ) ;

            Clock = read_rtc();
              mktm( &Time, Clock );

            printf( "Time: %02d:%02d:%02d\n", Time.tm_hour,
Time.tm_min, Time.tm_sec );
         }
    }
}

****************************************************************--- Mike van Meeteren <m...@fastec.com> wrote:
> At 06:06 PM 5/11/2005 +0000, you wrote:
>  >
>  >Hi Friends,
>  >
>  >   Is there any 3.3V battery backup facility for SRAM of RCM3010?
>  >I think, 3.3V battery backup is only available for RTC, in RCM3010.
>  >I need a RCM module with battery backed facility for SRAM.
>  >   Please, tell me ,such RCM modules with 3.3V battery backup for
>  >both SRAM & RTC. Also tell me ,what extra hardware & control
> signals
>  >are required to give a battery back up for SRAM & RTC.
>
> 3010 has battery backed ram, I use it.  Only hardware you need is a
> 3v
> battery, holder, and 1.4K resistor, hooked to the VBAT_EXT pin on the
> core
> module.

           
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

__________________________________________________

Reply by Andy May 16, 20052005-05-16
Oops, Yahoo decided to send my reply before I finished writing it.

Let me start again.

In my code I have a (global) struct. I pass the address of the struct
to a function. When I tried to assign a value to a member of the
struct in the function I got "Run Time Error: Erroneous Pointer
Assignment".

//Sample code

typedef struct _importantData{
char Text[10];
word Val;
}IMPORTANT_DATA;

bbram IMPORTANT_DATA ImpData; void Initialise( IMPORTANT_DATA *pData )
{
pData->Val = 100;
} void main()
{
Initialise( &ImpData );
}

This does not happen if ImpData is declared without "bbram" keyword.

Can anyone explain what's going on here?

Regards,
Andy
--- Nathan Johnston <nathanj@nath...> wrote:
> What do you mean by "Using the other compiler switches does not seem
> to
> enable the BBROOTDATA area"?
>
> I recently needed to (re-)investigate how bbram worked again so I
> might
> as well share my findings seeing as there is no documentation
> available
> on this...
>
> The amount of bbram is controlled by BBROOTDATASIZE in the bios. If
> you
> increase this you will end up losing some root data space due to how
> this space is mapped into the logical address range. The rest of the
> battery backed ("slow") SRAM is available in xmem, however only
> physical
> addresses above 0x80000 (in RCM3200 anyway) are battery backed. In
> more
> recent versions of Dynamic C (above 8.30?) there is an _xalloc
> function
> that allows you to specify whether you want the xmem area being
> allocated to be battery backed or not. For earlier versions you just
> need to be smart with your xalloc/avail calls.
>
> The memory_usage.c sample program is really good tool to see what is
> going on when you start playing with this stuff...
>
> Regards,
> Nathan
>
> -----Original Message-----
> From: rabbit-semi@rabb...
> [mailto:rabbit-semi@rabb...]
> On Behalf Of Andy
> Sent: Friday, 13 May 2005 8:55 PM
> To: rabbit-semi@rabb...
> Subject: Re: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in
> RCM3010?
>
> Thanks to Scott and every one else who replied to my post.
>
> I managed to get the SRAM on the RCM3300 to retain its content by
> using
> the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch
> and
> bbram keyword. Using the other compiler switches does not seem to
> enable the BBROOTDATA area.
>
> Regards,
> Andy > --- Scott Henion <shenion@shen...> wrote:
> > At 04:31 AM 5/12/2005, you wrote:
> >
> > >Hi All,
> > >
> > >I have been following this subject with interest. I have been
> trying
> > to
> > >get the SRAM on RCM3300 to retain its content when the power is
> > >switched off.
> > >
> > >I am using RCM3300 prototyping board for development, which
> already
> > has
> > >a battery connected to the VBAT-EXT pin on the RCM3300 module. The
> > >battery is 3.0 V.
> > >
> > >In my software I used protected keyword when declaring variables
> > that I
> > >want to back-up. However, the SRAM seems to lose its content when
> I
> > >unplugged the power. The RTC seems to retain the time, when power
> is
> > >removed.
> > >
> > >I attached sample test code below. What did I do wrong?
> >
> > The 3200, 3300 and 3800 have fast and slow ram. The fast RAM is not
> > backed
> > up, the slow RAM is. By default all variables go in the fast RAM.
> > Modules
> > that don't have fast RAM have all variables backed up by default.
> >
> > Look at the "bbram" keyword. There is a sample in:
> > ..\Samples\RestartVars\BatteryRAM\bbvars.c
> >
> > <Scott>
> > ------
> >
> > | Scott G. Henion| shenion@shen... |
> > | Consultant | Stone Mountain, GA |
> > | SHDesigns | PGP Key 0xE98DDC48 |
> > | http://www.shdesigns.org |
> > ------
> > today's fortune
> > mophobia, n.:
> > Fear of being verbally abused by a Mississippian.
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.11.9 - Release Date:
> 5/12/2005
> >
> >
> >
> __________________________________
> > ________________________________
>
> > .
>
Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and more. Check it out!
http://discover.yahoo.com/mobile.html



Reply by Andy May 16, 20052005-05-16
When I compiled the sample code bbvars.c using the "Code and BIOS in
Flash", it looked like the BBROOTDATASIZE was set to 0. Hence, the
variables are stored in non-bb SRAM.

In your experience working with BBRAM, have you come across the
follwoing problem?

In my code I have a (global) struct. I pass the address of the struct
to a function. When I tried to assigned a value to a member of the
struct in the function I got "Run Time Error: Erroneous Pointer
Assignment". For example:

struct Data{

--- Nathan Johnston <nathanj@nath...> wrote:
> What do you mean by "Using the other compiler switches does not seem
> to
> enable the BBROOTDATA area"?
>
> I recently needed to (re-)investigate how bbram worked again so I
> might
> as well share my findings seeing as there is no documentation
> available
> on this...
>
> The amount of bbram is controlled by BBROOTDATASIZE in the bios. If
> you
> increase this you will end up losing some root data space due to how
> this space is mapped into the logical address range. The rest of the
> battery backed ("slow") SRAM is available in xmem, however only
> physical
> addresses above 0x80000 (in RCM3200 anyway) are battery backed. In
> more
> recent versions of Dynamic C (above 8.30?) there is an _xalloc
> function
> that allows you to specify whether you want the xmem area being
> allocated to be battery backed or not. For earlier versions you just
> need to be smart with your xalloc/avail calls.
>
> The memory_usage.c sample program is really good tool to see what is
> going on when you start playing with this stuff...
>
> Regards,
> Nathan
>
> -----Original Message-----
> From: rabbit-semi@rabb...
> [mailto:rabbit-semi@rabb...]
> On Behalf Of Andy
> Sent: Friday, 13 May 2005 8:55 PM
> To: rabbit-semi@rabb...
> Subject: Re: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in
> RCM3010?
>
> Thanks to Scott and every one else who replied to my post.
>
> I managed to get the SRAM on the RCM3300 to retain its content by
> using
> the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch
> and
> bbram keyword. Using the other compiler switches does not seem to
> enable the BBROOTDATA area.
>
> Regards,
> Andy > --- Scott Henion <shenion@shen...> wrote:
> > At 04:31 AM 5/12/2005, you wrote:
> >
> > >Hi All,
> > >
> > >I have been following this subject with interest. I have been
> trying
> > to
> > >get the SRAM on RCM3300 to retain its content when the power is
> > >switched off.
> > >
> > >I am using RCM3300 prototyping board for development, which
> already
> > has
> > >a battery connected to the VBAT-EXT pin on the RCM3300 module. The
> > >battery is 3.0 V.
> > >
> > >In my software I used protected keyword when declaring variables
> > that I
> > >want to back-up. However, the SRAM seems to lose its content when
> I
> > >unplugged the power. The RTC seems to retain the time, when power
> is
> > >removed.
> > >
> > >I attached sample test code below. What did I do wrong?
> >
> > The 3200, 3300 and 3800 have fast and slow ram. The fast RAM is not
> > backed
> > up, the slow RAM is. By default all variables go in the fast RAM.
> > Modules
> > that don't have fast RAM have all variables backed up by default.
> >
> > Look at the "bbram" keyword. There is a sample in:
> > ..\Samples\RestartVars\BatteryRAM\bbvars.c
> >
> > <Scott>
> > ------
> >
> > | Scott G. Henion| shenion@shen... |
> > | Consultant | Stone Mountain, GA |
> > | SHDesigns | PGP Key 0xE98DDC48 |
> > | http://www.shdesigns.org |
> > ------
> > today's fortune
> > mophobia, n.:
> > Fear of being verbally abused by a Mississippian.
> >
> >
> > --
> > No virus found in this outgoing message.
> > Checked by AVG Anti-Virus.
> > Version: 7.0.308 / Virus Database: 266.11.9 - Release Date:
> 5/12/2005
> >
> >
> >
> __________________________________
> > ________________________________
>
> > .
>

__________________________________________________




Reply by Nathan Johnston May 15, 20052005-05-15

What do you mean by “Using the other compiler switches does not seem to enable the BBROOTDATA area”?

 

I recently needed to (re-)investigate how bbram worked again so I might as well share my findings seeing as there is no documentation available on this…

 

The amount of bbram is controlled by BBROOTDATASIZE in the bios. If you increase this you will end up losing some root data space due to how this space is mapped into the logical address range. The rest of the battery backed (“slow”) SRAM is available in xmem, however only physical addresses above 0x80000 (in RCM3200 anyway) are battery backed. In more recent versions of Dynamic C (above 8.30?) there is an _xalloc function that allows you to specify whether you want the xmem area being allocated to be battery backed or not. For earlier versions you just need to be smart with your xalloc/avail calls.

 

The memory_usage.c sample program is really good tool to see what is going on when you start playing with this stuff…

 

Regards,

Nathan

 

-----Original Message-----
From: r...@yahoogroups.com [mailto:r...@yahoogroups.com] On Behalf Of Andy
Sent:
Friday, 13 May 2005 8:55 PM
To: r...@yahoogroups.com
Subject: Re: [rabbit-semi] 3.3 V-- Battery-Back up for Static RAM in RCM3010?

 

Thanks to Scott and every one else who replied to my post.

I managed to get the SRAM on the RCM3300 to retain its content by using
the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch and
bbram keyword. Using the other compiler switches does not seem to
enable the BBROOTDATA area.

Regards,
Andy  --- Scott Henion <s...@shdesigns.org> wrote:
> At 04:31 AM 5/12/2005, you wrote:
>
> >Hi All,
> >
> >I have been following this subject with interest. I have been trying
> to
> >get the SRAM on RCM3300 to retain its content when the power is
> >switched off.
> >
> >I am using RCM3300 prototyping board for development, which already
> has
> >a battery connected to the VBAT-EXT pin on the RCM3300 module. The
> >battery is 3.0 V.
> >
> >In my software I used protected keyword when declaring variables
> that I
> >want to back-up. However, the SRAM seems to lose its content when I
> >unplugged the power. The RTC seems to retain the time, when power is
> >removed.
> >
> >I attached sample test code below. What did I do wrong?
>
> The 3200, 3300 and 3800 have fast and slow ram. The fast RAM is not
> backed
> up, the slow RAM is. By default all variables go in the fast RAM.
> Modules
> that don't have fast RAM have all variables backed up by default.
>
> Look at the "bbram" keyword. There is a sample in:
> ..\Samples\RestartVars\BatteryRAM\bbvars.c
>
> <Scott>
> ------
>
> | Scott G. Henion| s...@shdesigns.org |
> |   Consultant   |   Stone Mountain, GA  |
> |   SHDesigns    |   PGP Key 0xE98DDC48  |
> |     http://www.shdesigns.org           |
> ------
> today's fortune
> mophobia, n.:
>          Fear of being verbally abused by a Mississippian.
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005
>
>
>            
__________________________________




Reply by Andy May 13, 20052005-05-13
Thanks to Scott and every one else who replied to my post.

I managed to get the SRAM on the RCM3300 to retain its content by using
the "Compile Code and BIOS to FLASH and Run in RAM" compiler switch and
bbram keyword. Using the other compiler switches does not seem to
enable the BBROOTDATA area.

Regards,
Andy --- Scott Henion <shenion@shen...> wrote:
> At 04:31 AM 5/12/2005, you wrote:
>
> >Hi All,
> >
> >I have been following this subject with interest. I have been trying
> to
> >get the SRAM on RCM3300 to retain its content when the power is
> >switched off.
> >
> >I am using RCM3300 prototyping board for development, which already
> has
> >a battery connected to the VBAT-EXT pin on the RCM3300 module. The
> >battery is 3.0 V.
> >
> >In my software I used protected keyword when declaring variables
> that I
> >want to back-up. However, the SRAM seems to lose its content when I
> >unplugged the power. The RTC seems to retain the time, when power is
> >removed.
> >
> >I attached sample test code below. What did I do wrong?
>
> The 3200, 3300 and 3800 have fast and slow ram. The fast RAM is not
> backed
> up, the slow RAM is. By default all variables go in the fast RAM.
> Modules
> that don't have fast RAM have all variables backed up by default.
>
> Look at the "bbram" keyword. There is a sample in:
> ..\Samples\RestartVars\BatteryRAM\bbvars.c
>
> <Scott>
> ------
>
> | Scott G. Henion| shenion@shen... |
> | Consultant | Stone Mountain, GA |
> | SHDesigns | PGP Key 0xE98DDC48 |
> | http://www.shdesigns.org |
> ------
> today's fortune
> mophobia, n.:
> Fear of being verbally abused by a Mississippian. > --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.9 - Release Date: 5/12/2005 >
__________________________________