cancel
Showing results for 
Search instead for 
Did you mean: 

Hello, I am using STM32F407ZGT6 and have the issue with time of RTC peripheral which resets to initial value after power down the board while VBAT pin is connected to CR1220 battery and LSE is used as crystal. How can I solve it?

Aasda.3
Associate II
51 REPLIES 51

I create new project with all considerations but time is reset after unplugging.

Also I put "hrtc.Instance = RTC" before MX_RTC_Init() and comment out MX_RTC_Init() but nothing change in time. I think this is because of commenting out HAL_RTC_Init inside MX_RTC_Init.

However, I am putting the program code here and I would appreciate it if you could help me.

Thanks Peter.

As I told previous, I have problem only when unplugging the board.

However, I am putting the program code here and I would appreciate it if you could help me

Aasda.3
Associate II

#include "main.h"

/* Private includes ----------------------------------------------------------*/

/* USER CODE BEGIN Includes */

#include "lcd.h"

#include "stdio.h"

#include "string.h"

#include "stdlib.h"

#include "math.h"

/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/

/* USER CODE BEGIN PTD */

#define Lcd_backlight  HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13,GPIO_PIN_SET)

#define Lcd_backlightoff  HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13,GPIO_PIN_RESET)

/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/

/* USER CODE BEGIN PD */

uint8_t Hour=0,Minute=0,Second=0;

uint8_t Month=0,Day=0;

char BUF[4]={0};

/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/

/* USER CODE BEGIN PM */

void swap(char *x, char *y) {

  char t = *x; *x = *y; *y = t;

}

char* reverse1(char *buffer, int i, int j)

{

  while (i < j) {

    swap(&buffer[i++], &buffer[j--]);

  }

  return buffer;

}

char* itoa(int value, char* buffer, int base)

{

  if (base < 2 || base > 32) {

    return buffer;

  }

  int n = abs(value);

  int i = 0;

  while (n)

  {

    int r = n % base;

    if (r >= 10) {

      buffer[i++] = 65 + (r - 10);

    }

    else {

      buffer[i++] = 48 + r;

    }

    n = n / base;

  }

  if (i == 0) {

    buffer[i++] = '0';

  }

  if (value < 0 && base == 10) {

    buffer[i++] = '-';

  }

  buffer[i] = '\0'; 

  return reverse1(buffer, 0, i - 1);

}

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/

 RTC_HandleTypeDef hrtc;

/* USER CODE BEGIN PV */

RTC_TimeTypeDef Time;

RTC_DateTypeDef date;

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

static void MX_RTC_Init(void);

/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/

/* USER CODE BEGIN 0 */

/* USER CODE END 0 */

/**

 * @brief The application entry point.

 * @retval int

 */

int main(void)

{

 /* USER CODE BEGIN 1 */

 /* USER CODE END 1 */

 /* MCU Configuration--------------------------------------------------------*/

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

 HAL_Init();

 /* USER CODE BEGIN Init */

__BKPSRAM_CLK_ENABLE();

 HAL_PWR_EnableBkUpAccess();

 __HAL_RCC_RTC_ENABLE();

 __HAL_RCC_BKPSRAM_CLK_ENABLE(); 

 HAL_PWREx_EnableBkUpReg();

 /* USER CODE END Init */

 /* Configure the system clock */

 SystemClock_Config();

 /* USER CODE BEGIN SysInit */

 /* USER CODE END SysInit */

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

hrtc.Instance = RTC;

 MX_RTC_Init();

 /* USER CODE BEGIN 2 */

Lcd_PortType ports[] = {

 D4_GPIO_Port, D5_GPIO_Port, D6_GPIO_Port, D7_GPIO_Port

 };

 Lcd_PinType pins[] = {D4_Pin, D5_Pin, D6_Pin, D7_Pin};

 Lcd_HandleTypeDef lcd = Lcd_create(ports, pins, RS_GPIO_Port, RS_Pin, EN_GPIO_Port, EN_Pin, LCD_4_BIT_MODE);

void Lcd_init();

Lcd_backlight;

 /* USER CODE END 2 */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

  /* USER CODE END WHILE */

  /* USER CODE BEGIN 3 */

HAL_RTC_GetTime(&hrtc,&Time,RTC_FORMAT_BIN);

HAL_RTC_GetDate(&hrtc,&date ,RTC_FORMAT_BIN);

Month = date.Month;

Day =date.Date;

Hour =Time.Hours;

Minute =Time.Minutes;

Second = Time.Seconds;

HAL_Delay(1000);

itoa(Hour , &BUF[2], 10);

Lcd_cursor(&lcd, 1,0);

Lcd_string(&lcd," ");

Lcd_cursor(&lcd, 1,0);

Lcd_string(&lcd,&BUF[2]);

itoa(Minute , &BUF[3], 10);

Lcd_cursor(&lcd, 1,4);

Lcd_string(&lcd,"   ");

Lcd_cursor(&lcd, 1,4);

Lcd_string(&lcd,&BUF[3]);

itoa(Second , &BUF[4], 10);

Lcd_cursor(&lcd, 1,10);

Lcd_string(&lcd," ");

Lcd_cursor(&lcd, 1,10);

Lcd_string(&lcd,&BUF[4]);

 }

 /* USER CODE END 3 */

}

void SystemClock_Config(void)

{

 RCC_OscInitTypeDef RCC_OscInitStruct = {0};

 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};

 /** Configure the main internal regulator output voltage

 */

 __HAL_RCC_PWR_CLK_ENABLE();

 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);

 /** Initializes the RCC Oscillators according to the specified parameters

 * in the RCC_OscInitTypeDef structure.

 */

 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;

 RCC_OscInitStruct.HSEState = RCC_HSE_ON;

 RCC_OscInitStruct.LSEState = RCC_LSE_ON;

 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;

 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

 RCC_OscInitStruct.PLL.PLLM = 25;

 RCC_OscInitStruct.PLL.PLLN = 168;

 RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;

 RCC_OscInitStruct.PLL.PLLQ = 4;

 if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

 {

  Error_Handler();

 }

 /** Initializes the CPU, AHB and APB buses clocks

 */

 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

               |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;

 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;

 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;

 if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)

 {

  Error_Handler();

 }

}

static void MX_RTC_Init(void)

{

 /* USER CODE BEGIN RTC_Init 0 */

 /* USER CODE END RTC_Init 0 */

 /* USER CODE BEGIN RTC_Init 1 */

 /* USER CODE END RTC_Init 1 */

 /** Initialize RTC Only

 */

 hrtc.Instance = RTC;

 hrtc.Init.HourFormat = RTC_HOURFORMAT_24;

 hrtc.Init.AsynchPrediv = 127;

 hrtc.Init.SynchPrediv = 255;

 hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;

 hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;

 hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;

 if (HAL_RTC_Init(&hrtc) != HAL_OK)

 {

  Error_Handler();

 }

 /* USER CODE BEGIN Check_RTC_BKUP */

if (HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR0) !=0x32F2)

 {

 /* USER CODE END Check_RTC_BKUP */

 RTC_TimeTypeDef sTime = {0};

 RTC_DateTypeDef sDate = {0};

 /** Initialize RTC and set the Time and Date

 */

 sTime.Hours = 8;

 sTime.Minutes = 8;

 sTime.Seconds = 0;

 sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;

 sTime.StoreOperation = RTC_STOREOPERATION_RESET;

 if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BIN) != HAL_OK)

 {

  Error_Handler();

 }

 sDate.WeekDay = RTC_WEEKDAY_MONDAY;

 sDate.Month = RTC_MONTH_JANUARY;

 sDate.Date = 1;

 sDate.Year = 23;

 if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BIN) != HAL_OK)

 {

  Error_Handler();

 }

 /* USER CODE BEGIN RTC_Init 2 */

HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR0,0x32F2);

}

 /* USER CODE END RTC_Init 2 */

}

static void MX_GPIO_Init(void)

{

}

This may not help you but I test pretty much similar code in F072B discovery with LSE crystal installed and VBAT feed from CR battery. It works well without any additional code except this RTC_BKP_DR0 reading/writing. I can repeat this test with some F4 eval kit next week.

Are you using custom board or some evaluation kit ?

Peter BENSCH
ST Employee

If you only insert code as text, it is very difficult to read. Please use the </> button below the text input field, because the code is then formatted and inserted with a line number like the following example snippet from your code:

/*USER CODE BEGIN PM */
void swap(char *x, char *y)
{
  char t = *x; *x = *y; *y = t;
}
[...]
/*USER CODE END PM */

I see from your code that you have created it slightly differently, so my previous assumption is not correct.

But anyway, now it boils down to debugging, because you've already inserted quite a bit of your own code, probably from some examples. It looks like

  • HAL_RTCEx_BKUPWrite() did not write the flag 0x32F2 or
  • HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR0) !=0x32F2) always returns true, i.e. the flag is never read as 032F2.

Please check this once in the single stepping.

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Aasda.3
Associate II

I add nearly 2-3 lines to the project created by cubemx including :

if (HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR0) !=0x32F2)

and HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR0,0x32F2);

However if there any other code to resolve this issue, I accept it ?

when unplugging, RTC_BKP_DR0 is reset and MCU set time and date again. This event never occur when resetting and time continue to executing

Aasda.3
Associate II
#include "main.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "lcd.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
#define Lcd_backlight   HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13,GPIO_PIN_SET)
#define Lcd_backlightoff   HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13,GPIO_PIN_RESET)
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
uint8_t  Hour=0,Minute=0,Second=0;
uint8_t Month=0,Day=0;
char BUF[4]={0};
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
 
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
 RTC_HandleTypeDef hrtc;
 
/* USER CODE BEGIN PV */
RTC_TimeTypeDef  Time;
RTC_DateTypeDef date;
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_RTC_Init(void);
/* USER CODE BEGIN PFP *
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
 
int main(void)
{
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
	__BKPSRAM_CLK_ENABLE();
 HAL_PWR_EnableBkUpAccess();
 __HAL_RCC_RTC_ENABLE();
 __HAL_RCC_BKPSRAM_CLK_ENABLE(); 
 HAL_PWREx_EnableBkUpReg();
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
	hrtc.Instance = RTC;
  MX_RTC_Init();
  /* USER CODE BEGIN 2 */
Lcd_PortType ports[] = {
		  D4_GPIO_Port, D5_GPIO_Port, D6_GPIO_Port, D7_GPIO_Port
  };
  Lcd_PinType pins[] = {D4_Pin, D5_Pin, D6_Pin, D7_Pin};
  Lcd_HandleTypeDef lcd = Lcd_create(ports, pins, RS_GPIO_Port, RS_Pin, EN_GPIO_Port, EN_Pin, LCD_4_BIT_MODE);
 
void Lcd_init();
 Lcd_clear(&lcd);
Lcd_backlight;
  /* USER CODE END 2 */
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
		HAL_RTC_GetTime(&hrtc,&Time,RTC_FORMAT_BIN);
HAL_RTC_GetDate(&hrtc,&date ,RTC_FORMAT_BIN);
		Month = date.Month;
	Day =date.Date;
	Hour =Time.Hours;
	Minute =Time.Minutes;
		Second = Time.Seconds;
			HAL_Delay(1000);
	
itoa(Hour , &BUF[2], 10);		
	Lcd_cursor(&lcd, 1,0);
		Lcd_string(&lcd,"  ");
				Lcd_cursor(&lcd, 1,0);
	Lcd_string(&lcd,&BUF[2]);
	
		itoa(Minute , &BUF[3], 10);
		Lcd_cursor(&lcd, 1,4);
		Lcd_string(&lcd,"     ");
				Lcd_cursor(&lcd, 1,4);
	Lcd_string(&lcd,&BUF[3]);
		
		itoa(Second , &BUF[4], 10);
		Lcd_cursor(&lcd, 1,10);
		Lcd_string(&lcd,"  ");
	Lcd_cursor(&lcd, 1,10);
	Lcd_string(&lcd,&BUF[4]);
  }
  /* USER CODE END 3 */
}
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 
  /** Configure the main internal regulator output voltage
  */
  __HAL_RCC_PWR_CLK_ENABLE();
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
 
  /** Initializes the RCC Oscillators according to the specified parameters
  * in the RCC_OscInitTypeDef structure.
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = 25;
  RCC_OscInitStruct.PLL.PLLN = 168;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = 4;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
 
  /** Initializes the CPU, AHB and APB buses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
 
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
  {
    Error_Handler();
  }
}
 
static void MX_RTC_Init(void)
{
  /* USER CODE BEGIN RTC_Init 0 */
  /* USER CODE END RTC_Init 0 */
  /* USER CODE BEGIN RTC_Init 1 */
  /* USER CODE END RTC_Init 1 */
  /** Initialize RTC Only
  */
  hrtc.Instance = RTC;
  hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
  hrtc.Init.AsynchPrediv = 127;
  hrtc.Init.SynchPrediv = 255;
  hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
  hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
  hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
  if (HAL_RTC_Init(&hrtc) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN Check_RTC_BKUP */
if (HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR0) !=0x32F2)
  {
  /* USER CODE END Check_RTC_BKUP */
 
  RTC_TimeTypeDef sTime = {0};
  RTC_DateTypeDef sDate = {0};
  /** Initialize RTC and set the Time and Date
  */
  sTime.Hours = 8;
  sTime.Minutes = 8;
  sTime.Seconds = 0;
  sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
  sTime.StoreOperation = RTC_STOREOPERATION_RESET;
  if (HAL_RTC_SetTime(&hrtc, &sTime, RTC_FORMAT_BIN) != HAL_OK)
  {
    Error_Handler();
  }
  sDate.WeekDay = RTC_WEEKDAY_MONDAY;
  sDate.Month = RTC_MONTH_JANUARY;
  sDate.Date = 1;
  sDate.Year = 23;
 
  if (HAL_RTC_SetDate(&hrtc, &sDate, RTC_FORMAT_BIN) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN RTC_Init 2 */
HAL_RTCEx_BKUPWrite(&hrtc,RTC_BKP_DR0,0x32F2);
	}
  /* USER CODE END RTC_Init 2 */
}
static void MX_GPIO_Init(void)
{
  GPIO_InitTypeDef GPIO_InitStruct = {0};
 
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOE_CLK_ENABLE();
  __HAL_RCC_GPIOC_CLK_ENABLE();
  __HAL_RCC_GPIOH_CLK_ENABLE();
  __HAL_RCC_GPIOA_CLK_ENABLE();
  __HAL_RCC_GPIOG_CLK_ENABLE();
  __HAL_RCC_GPIOB_CLK_ENABLE();
  /*Configure GPIO pin Output Level */
  HAL_GPIO_WritePin(GPIOE, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|RS_Pin
                          |RW_Pin, GPIO_PIN_RESET);
 
  /*Configure GPIO pin Output Level */
  HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15, GPIO_PIN_RESET);
 
  /*Configure GPIO pin Output Level */
  HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, GPIO_PIN_RESET);
 
  /*Configure GPIO pins : PE3 PE4 PE5 PE0
                           PE1 */
  GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|RS_Pin
                          |RW_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
 
  /*Configure GPIO pins : PG13 PG14 PG15 */
  GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);
 
  /*Configure GPIO pins : PB3 PB4 PB5 */
  GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5;
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
}
/* USER CODE BEGIN 4 */
/* USER CODE END 4 */
void Error_Handler(void)
{
  /* USER CODE BEGIN Error_Handler_Debug */
  /* User can add his own implementation to report the HAL error return state */
  __disable_irq();
  while (1)
  {
  }
  /* USER CODE END Error_Handler_Debug */
}
#ifdef  USE_FULL_ASSERT
void assert_failed(uint8_t *file, uint32_t line)
{
  /* USER CODE BEGIN 6 */
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

Hello. I now tested it with F407-Discovery board. Works like a charm, tested with V1.27.0 and V1.27.1 F4 firmware package. Did you got your project working ?

I'm using custom board and even delete RTC_BKP_DR0 reading/writing and nothing changed.

Hello.

Thanks for your consideration.

Unfortunately I couldn't solve it. If all things are ok when unplugging and plugging again without any pausing and resetting time Is it possible to share your code ?