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.
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.
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.
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. */
/*lint -restore Enable MISRA rule (6.3) checking. */
/* Write your local variable definition here */
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
/*** End of Processor Expert internal initialization. ***/
/* Write your code here */
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);
the same code works if the VBAT is connected 3.3V.
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.
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?
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:
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.