cancel
Showing results for 
Search instead for 
Did you mean: 

Battery Back up for SRAM

nanuradha
Associate II
Posted on May 17, 2007 at 03:02

Battery Back up for SRAM

6 REPLIES 6
nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hai all,

I want to give battery back up to my SRAM (96K). I've configured the PWR bit in RTC_CR register(bit 3), but it is not working. Is there any thing else I should configure in order to provide battery backup to SRAM. Plz help me, its very urgent.

With regards to all,

Neelima.

Posted on May 17, 2011 at 09:43

hi Neelima,

from st datasheet :

''When a battery is connected to the designated battery backup pin (VBATT), SRAM contents are automatically preserved when the normal operating voltage on VDD pins is lost or sags below threshold. Automatic switchover to SRAM can be disabled by firmware if it is desired that the battery will power only the RTC and not the SRAM during standby.''

So the PWR bit thre should be used to configure the voltage to supply to the sram.

Pay attention that a standard startup code reinitialize the contents of

your data ram!!

Ciao!

nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hi,

Thankyou for the reply. Can we see the code written in the a_main file? So, that I can include the rest of the required functions given in that code to my application code, in order to ensure its proper operation. Any way, I'll check the code and let you tell the progress.

Regards,

Neelima.

nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hai Ciao,

Thankyou for the reply. with ur explanation i went through the str91x.s code and found that only the following segments are concerned with SRAM. They are:

;// System Configuration

;// System Configuration (SCU_SCR0)

;// SRAM_SIZE: SRAM Size

;// Default: 32KB

 

;// 32KB

 

;// 64KB

 

;// 96KB

 

;// EN_PFQBC: PFQBC Unit Enable

 

;//

 

;//

 

SCR0_SETUP EQU 1

 

SCU_SCR0_Val EQU 0x00000196

 

 

; Setup System Configuration (and SRAM Size)

 

IF SCR0_SETUP == 1

 

 

LDR R0, =SCU_BASE

 

LDR R1, =SCU_SCR0_Val

 

STR R1, [R0, #SCU_SCR0_OFS]

 

ORR R1, #0x00000200

 

STR R1, [R0, #SCU_SCR0_OFS]

 

 

ENDIF

 

 

I suppose, bexause it is configuring SRAM every time the controller is reset, the contents of SRAM are reinitialized. but if I comment, SETUP SYSTEM CONFIGURATION part of the code, will I be able to retain the SRAM contents even after reset? Another doubt is whether we can change the startup file and still work normally. Plz answer me soon.

 

With regards,

 

Neelima.

 

 

 

 

 

Posted on May 17, 2011 at 09:43

Hi,

the code you are reporting is not the one

that you have to modify.

This code is related with the hw configuration of internal SRAM.

The code I'm talking about is related with the C or C++ implementation libraries....

For instance IAR at the end of startup.s call a __main:this is library function that initialize the memory and call your main app.

In order to bypass the standard C initialization you can make an explicit

call to your main code (something like b _main) and manage by yourself the variables initialization.

nanuradha
Associate II
Posted on May 17, 2011 at 09:43

Hai Ciao,

When I try to bypass the __main initialization(IMPORT __main) and give the name of my Main code (processor_main), and try to execute the same, controller is going into the reset handler. Can you give me an example code showing how to by-pass the said __main?

Regards,

Neelima.