2022-03-16 04:21 AM
Hi there,
I use backup SRAM and RTC in STM32F407. I have a diode between VDD and VBAT and 2.2u capacitors connected to VCAP_1 and VCAP_2. 3v CR1220 battery is connected to VBAT. Now the issue is that SRAM data are wiped when VDD power is off and battery voltage is above 3V. It not affect RTC registers which keep values. If the voltage is under 3V the issue cannot be reproduced. My init code
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_RCC_BKPSRAM_CLK_ENABLE(); // additional code for Backup RAM enable
HAL_PWR_EnableBkUpAccess(); // additional code for Backup RAM enable
HAL_PWREx_EnableBkUpReg(); // additional code for Backup RAM enable
HAL_PWR_DisableBkUpAccess();
Reading from SRAM
HAL_PWR_EnableBkUpAccess();
BKPSRAM_Read16(addr);
HAL_PWR_DisableBkUpAccess();
Is there any explanation for this? Is anything else I can check or measure?
2022-03-16 05:26 AM
> I have a diode between VDD and VBAT
There is no need for that, unless you want to charge the battery - which with CR1220 you shouldn't.
This probably does not explain your problem, but you should remove it anyway.
JW
2022-03-16 05:27 AM
I have removed the diode but behavior is the same.
2022-03-23 12:02 AM
I think it could be because of charging / disacharging when I remove the source.
2022-03-23 01:53 AM
What charging? You are using a non-rechargable battery (CR1220), am I wrong?
Also, check your VDDA/VSSA connections, they should go up/down together with VDD.
JW
2022-03-23 02:09 AM
Is the tamper disabled?
2022-03-29 04:06 AM
Yes the tamper function is not implemented.
2022-03-29 04:09 AM
Yes I use non-rechargable battery, I ment charging in pins of VDD or VSS when power is plugged on and off. I measured a voltage on VBAT pin and is stable. Maybe this problem has nothing to do with voltage of a battery at all and I am in cul-de-sac. Unfortunatelly I can't figure out why this is happening so I considered to move this data to flash memory instead.
2022-03-29 06:22 AM
I am using battery-backup RAM for quite some time and had no issues whatsoever.
Check your VDDA/VSSA connections, they should go up/down together with VDD. I mean, VDDA should be derived from VDD and VSSA should be connected directly to VSS. Check also for bad solder joints.
Check also with some very simple program, which does not write to the backup RAM.
You may also want to try a "known good" board such as Nucleo or Disco.
JW
2022-03-29 11:14 PM
Good ideas thank you.