cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 RTC with SuperCap

gokhannsahin
Associate II
Posted on January 14, 2018 at 10:34

Hi everyone,

Should I connect a any series resistor to the super capacitor while using a super capacitor that is 1F 5.5V instead of a battery? Or I can connect directly the capacitor to VBat pin?

#power-backup-supercapacitor-rtc #rtc
30 REPLIES 30
T J
Lead
Posted on January 14, 2018 at 21:37

Turvey.Clive.002

is right to say we avoid batteries. with the extra handling issues since they are live 24/7

Sahin.Gokhan

is right to ask if a cap would do, great solution

Bonnes.Uwe

is quite right to suggest the CR2032 style lithium. also good solution

Aircraft / delivery are always an issue with batteries. this is a big issue

The best solution is to use a cap, but you must use a high quality cap.

Our simple experiment.

one Friday afternoon,I decided to test this very same question.

I mustered up three different brand caps.

SUNTAN 2000u 25V

Nichon 2200V 10V

some noname rubbish

Leakage test:

Simply I charged them all to 5V and left them on the bench disconnected from everything for the weekend.

Results:

the no name and SUNTAN caps were close to 1 volt. internal resistance has discharged the cap.

the Nichon was still over 4V. to lose 1 V in 2 days, 2000uF is not enough for this question.

So Yes a super cap would work if its a good quality brand. but they suck current hard.

Don't charge it from the pin. I suggest a diode from the 3V reg with 100R in series to reduce the current

Avoid any battery if possible,

I don't think that CR2032 series batteries are a danger to the airline industry since the delivery of current is very low, maximum 10-100mA roughly. depending on size

how many days do you want the cap to hold up the ram ?

In my last design, I used the biggest CR2032 for the RTC, it should run for 10 years without external power.

Posted on January 14, 2018 at 21:25

I would consider a series resistance to limit charging current when first powered on.

JW

Posted on January 14, 2018 at 21:52

We had a bright glow coming from a test board in 1985, it was a tantalum cap on fire.

We don't use tants for that reason alone.

gokhannsahin
Associate II
Posted on January 22, 2018 at 06:54

Thank you for your answers.

After charging 3.3V, the systemclockconfig can't pass the LSE ready.

After removing the capacitor in the circuit, then it has passed this condition.

Then, I have connected it the VBAT pin again, it can't pass again.

gokhannsahin
Associate II
Posted on January 23, 2018 at 18:10

I haven't found any solution yet, anybody has a solution?

Posted on January 23, 2018 at 18:24

 can't pass the LSE ready.

Show code, where does it stuck?

JW

Posted on January 23, 2018 at 22:26

As long as you connect them differently than capacitors. You should not charge them.

By the way T J, testing lytics may not be so simple. They well may have high leakage at first. Especially if they are stored for a long time. You have to keep power on for a while..

Posted on January 24, 2018 at 10:36

After removing the capacitor, it can pass 

HAL_RCC_OscConfig(&RCC_OscInitStruct), otherwise it can't.

void SystemClock_Config(void)

{

RCC_OscInitTypeDef RCC_OscInitStruct;

RCC_ClkInitTypeDef RCC_ClkInitStruct;

RCC_PeriphCLKInitTypeDef PeriphClkInit;

/**Configure LSE Drive Capability

*/

__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

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

*/

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE|RCC_OSCILLATORTYPE_MSI;

RCC_OscInitStruct.LSEState = RCC_LSE_ON;

RCC_OscInitStruct.MSIState = RCC_MSI_ON;

RCC_OscInitStruct.MSICalibrationValue = 0;

RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_6;

RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;

if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

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

*/

RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK

|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;

RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;

RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;

RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;

RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

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

{

_Error_Handler(__FILE__, __LINE__);

}

PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC;

PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;

if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

/**Enables the Clock Security System

*/

HAL_RCCEx_EnableLSECSS();

/**Configure the main internal regulator output voltage

*/

if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

/**Configure the Systick interrupt time

*/

HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);

/**Configure the Systick

*/

HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/**Enable MSI Auto calibration

*/

HAL_RCCEx_EnableMSIPLLMode();

/* SysTick_IRQn interrupt configuration */

HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

}
Posted on January 24, 2018 at 19:09

One big difference between a capacitor and a battery is that a battery has a nominally constant output voltage, whereas a capacitor's terminal voltage drops linearly to zero as it discharges.

Remember: Q = CV ...

Posted on January 24, 2018 at 20:54

__HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);

Try high.

After removing the capacitor, it can pass 

HAL_RCC_OscConfig(&RCC_OscInitStruct), otherwise it can't.

Please step through the HAL_RCC_OscConfig() and observe where particularly is the problem.

JW