How to detect if VBAT supply is present for RTC to work?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to detect if VBAT supply is present for RTC to work?

4,713件の閲覧回数
Amit_Kumar1
Senior Contributor II

Hi

I am using K60 custom made board with cw10.6. In my application I have to time stamp the data. for that I am using RTC. If VBAT pin is given a supply of 3.6V through a coin cell and then the program is dumped, my code is works fine . Suppose my battery is dead, my programs hangs and keeps restarting. Is there any way to find out if VBAT supply is present?

During Initialization I want to check if VBAT supply is present only then I will initiate the RTC else I will use some other clk source i.e from different uc. I also wanted to know what will happen if  VBAT pin is left open? Will my entire program hang or will the rest of the program work excluding RTC?  I will be using PE component for RTC.

Kind Regards

Amit Kumar

タグ(5)
8 返答(返信)

3,065件の閲覧回数
Paul_Tian
NXP Employee
NXP Employee

Hi, Amit

Do you use external 32.768KHz for RTC module? If yes, you can check 32.768KHz has been setup? If setup is OK, battery is no problem.

Best Regards

Paul

0 件の賞賛
返信

3,065件の閲覧回数
Amit_Kumar1
Senior Contributor II

Hi Zhe

Thanks for the quick reply. I am using external 32.768KHz for RTC module. My program was working fine until I took out the coin cell, i did POR but still the issue was there. even after inserting it back and doing POR the issue still persist.

Kind Regards

Amit Kumar

0 件の賞賛
返信

3,065件の閲覧回数
egoodii
Senior Contributor III

What you've got DIRECTLY to work with is TIF (Time Invalid Flag) in RTC_SR as set by VBAT_POR, and procedures must ensue to restart the RTC when this gets set (including long oscillator startup, if used).

You should also be aware of dV/dT limitations in the chip relative to instantaneous battery-connect, especially in early silicon.

3,065件の閲覧回数
Amit_Kumar1
Senior Contributor II

Hi Earl

I tried reading all the registers. If the VBAT is connected to 3.3 v source, it gives the o/p. In case if it is floating then my program enters in hard fault. I am using the following code

/*lint -save -e970 Disable MISRA rule (6.3) checking. */

int main(void)

/*lint -restore Enable MISRA rule (6.3) checking. */

{

/* Write your local variable definition here */


/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

PE_low_level_init();

/*** End of Processor Expert internal initialization. ***/

printf("testing starts\n");


/* Write your code here */

for(;;)

{

printf("%0X,%0X,%0X,%0X,%0X,%0X,%0X,%0X,%0X,%0X\n",RTC_TSR, RTC_TPR, RTC_TAR, RTC_TCR,RTC_CR, RTC_SR, RTC_LR,RTC_IER, RTC_WAR,RTC_RAR);

WAIT1_Waitms(2000);

}


the same code works if the VBAT is connected 3.3V.


Kind Regards

Amit Kumar

0 件の賞賛
返信

3,065件の閲覧回数
egoodii
Senior Contributor III

I am not surprised that the RTC subsystem must be powered-up to access the registers.  The 'normal connection' is a BAT54C to VDD and coin-cell, thence 100ohms surge-limiter to the VBAT pin.  If, when you power it up 'so connected' but if no/invalid coin-cell voltage came 'previously' you should get the VBAT_POR (Power On Reset) indication.

pastedImage_0.png

0 件の賞賛
返信

3,065件の閲覧回数
Amit_Kumar1
Senior Contributor II

HI Earl

Thanks for the schematic. I went through the schematic of the TWR board which had this type of setup. I wanted complete isolated setup for the RTC.

In the reference manual I found hat some access control register is there which can be read. I wanted to know where is that?

1.jpg

Kind Regards

Amit Kumar

0 件の賞賛
返信

3,065件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Amit:

Just in case you did not find the answer to your last question:

Access control registers refers to RTC_RAR and RTC_WAR registers. As you can read in the manual, these registers are not powered by VBAT:

RTC_Access.png

Regards!

Jorge Gonzalez

3,065件の閲覧回数
Amit_Kumar1
Senior Contributor II

Hi Jorge

Thanks for your valuable reply. I tried reading all the register one at a time. In that process I tried reading the above 2 registers which you mentioned. But when Vbat is not powered, The program hangs at the reading statement. If VBAT is powered then I am able to read all the registers. But this won't solve my issue.

Kind Regards

Amit Kumar