cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4xx Internal RTC not Updating when Power is Off.

jay1991
Associate II
Posted on May 11, 2016 at 12:43

I am using Internal RTC of STM32F411RCT6. It's working Perfectly but I cant update it when Power is off. I want to say that i have connected 3 v DC supply with VBAT pin and Run my RTC program, it works good but when i turn off the Power then RTC is not Updating. If i check after some minutes, it starts from where we left it before. I have checked my program. It does not set the time every time we run the program. It just Get the time. Any Help?

Thank you...

#stm32f4-rtc #stm32f4xx #internal-rtc
14 REPLIES 14
Posted on May 11, 2016 at 14:33

You have an external LSE crystal? You place the chip in STANDBY?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jay1991
Associate II
Posted on May 11, 2016 at 15:12

No external crystal used. i want to use internal crystal. I use LSI mode. i am turning off the device but when it turn off the device VBAT pin will get 3 v immediately.

Walid FTITI_O
Senior II
Posted on May 11, 2016 at 16:21

Hi tira.jay,

Are you putting the device into standby mode correctly before turn off the main supply. It will better you share code.

-Hannibal-
Posted on May 11, 2016 at 17:18

No external crystal used. i want to use internal crystal. I use LSI mode. i am turning off the device but when it turn off the device VBAT pin will get 3 v immediately.

Last I checked the LSI isn't in the low power domain.

http://www2.st.com/content/ccc/resource/technical/document/reference_manual/9b/53/39/1c/f7/01/4a/79/DM00119316.pdf/files/DM00119316.pdf/jcr:content/translations/en.DM00119316.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jay1991
Associate II
Posted on May 12, 2016 at 07:25

Hey Hannibal, the device is not in standby Mode. It continuously updating RTC and do other IOs On and Off as requirements.

jay1991
Associate II
Posted on May 12, 2016 at 07:32

Hey clive1, Is it required that we need external crystal for Internal RTC working? Means for LSE mode is must for Internal RTC drive, when Power is not available?

jay1991
Associate II
Posted on May 12, 2016 at 07:54

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6kA&d=%2Fa%2F0X0000000buR%2FZD97MqP_fXmmrx4sUD6j17LR0lifG9uojpVwwdiVIwk&asPdf=false
jay1991
Associate II
Posted on May 12, 2016 at 08:07

Here i have shared my code. I enable RTc Using RTC_Initialize function. One more Query that If i use NVIC priority for USART1 and USART6 then why its not working? I want to say that if i Use IRQ handler for both USARTS 1 and 6 , then its not showing USART6 received data to USART1. If i disable the USART1 IRQ handler then it will show the USART6 received data to USART1 .

Here is stm32f4xx_it.c file i use.

#include ''stm32f4xx_it.h''
/******************************************************************************/
/* Cortex-M3 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void
NMI_Handler(
void
)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void
HardFault_Handler(
void
)
{
/* Go to infinite loop when Hard Fault exception occurs */
while
(1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void
MemManage_Handler(
void
)
{
/* Go to infinite loop when Memory Manage exception occurs */
while
(1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void
BusFault_Handler(
void
)
{
/* Go to infinite loop when Bus Fault exception occurs */
while
(1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void
UsageFault_Handler(
void
)
{
/* Go to infinite loop when Usage Fault exception occurs */
while
(1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void
SVC_Handler(
void
)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void
DebugMon_Handler(
void
)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void
PendSV_Handler(
void
)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
__IO uint32_t TimmingDelay;
void
SysTick_Handler(
void
)
{
if
(TimmingDelay !=0)
{
TimmingDelay --;
}
} 
/******************************************************************************/
/* STM32Fxxx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32fxxx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @brief This function handles EXTI0_IRQ Handler.
* @param None
* @retval None
*/
int
cnt1, cnt2, cnt_neww ;
extern
int
PWM_period, hh, decrem,cnt_nmbr,Nmbr_turns,Sampling,macro, limites,steps,test;
void
TIM2_IRQHandler(
void
)
{
}
void
TIM3_IRQHandler(
void
)
{
}
void
TIM4_IRQHandler(
void
)
{
}
void
TIM1_CC_IRQHandler(
void
)
{
} 
/*
#define max_wordlen1 18000
extern void Delay(__IO uint32_t nCount);
volatile char received_str1[max_wordlen1+1];
volatile char ascii_of_char1[1024];
extern void USART_puts(USART_TypeDef *USARTx, volatile char *str);
//volatile char a[20][100];
void USART1_IRQHandler(){
while (USART_GetITStatus(USART1, USART_IT_RXNE)) {
static int cnt1=0;
char ch1;
ch1= USART_ReceiveData(USART1);
received_str1[cnt1] = ch1;
USART_SendData(USART1, received_str1[cnt1]);
cnt1=cnt1+1;
if(received_str1[cnt1] == '
')
{
cnt1=0;
}
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
}
}
*/
extern
int
e;
#define max_wordlen6 18000
extern
void
Delay(__IO uint32_t nCount);
volatile 
char
received_str6[max_wordlen6+1];
volatile 
char
ascii_of_char6[1024];
volatile 
char
p[1024];
extern
void
USART_puts(USART_TypeDef *USARTx, volatile 
char
*str);
volatile 
char
a[20][100];
void
USART6_IRQHandler(){
while
(USART_GetITStatus(USART6, USART_IT_RXNE)){
static
int
cnt6=0;
static
int
m=0;
char
ch6;
ch6= USART_ReceiveData(USART6);
USART_SendData(USART1, ch6);
/*//received_str6[cnt6] = ch6;
//memset( p, '\0', sizeof(p) );
//if((e>=9)){
//p[m]= received_str6[cnt6];
//USART_SendData(USART1, received_str6[cnt6]);*/
cnt6=cnt6+1;
//m=m+1;
if
(received_str6[cnt6] == 
'
'
) {
//strcpy(ascii_of_char6,p);
cnt6=0;
//m=0;
}
//}
}
}
/**
* @brief This function handles EXTI15_10_IRQ Handler.
* @param None
* @retval None
*/
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/

Help with this also.
Posted on May 12, 2016 at 19:26

Is it required that we need external crystal for Internal RTC working? Means for LSE mode is must for Internal RTC drive, when Power is not available?

When the primary power is removed the LSI will stop, only the LSE is in the low power domain provided by the battery. This is why my first question was are you using the external clock.

This could be due to the higher consumption of the LSI, or it's generally lack of stability for timing application, even with stable voltage and temperature.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..