rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.53k stars 1.26k forks source link

STM32F4 backup domain registers and backup domain sram #850

Closed ag88 closed 1 year ago

ag88 commented 3 years ago

STM32F4: update bkp.h, bkp.c add support for backup registers and backup sram. added example in STM32F4/libraries/RTClock/examples/BkpTest

ag88 commented 3 years ago

the comment about this PR : https://github.com/stevstrong/Arduino_STM32/issues/44#issuecomment-795857671

stevstrong commented 1 year ago

What is actually the status of this PR? Is it safe to merge?

ag88 commented 1 year ago

this is done back then when I'm trying to use the backup registers on stm32f401. The readme.md in this commit is here https://github.com/rogerclarkmelbourne/Arduino_STM32/pull/850/files#diff-5b489eef3ad090c0a5bed41a1f684527533ee35d6300a3ec9e008013bf280689 and the test is here, it is both a test as well as an example codes https://github.com/rogerclarkmelbourne/Arduino_STM32/pull/850/files#diff-afb267cf20737b1168f92a9d093766aab94b0aa65704e08d1a6b2633f796ddac

stm32f401 don't have backup sram but that they do have backup registers and this commit is part of works i'm using in some of my sketches to keep some data in the backup registers as these can be safe kept by VBAT (e.g. a coin cell for the RTC) even if the main VDD 3v3 is powered off. This (the backup registers) has also been used in conjunction with RTClock. Hence, it should not affect the function of RTClock. One of the commit is actually a fix. When RTC is running on LSE and VBAT. The original code causes the RTC reset when powered up, this fix avoids clobbering a running RTC if it is running on LSE. https://github.com/rogerclarkmelbourne/Arduino_STM32/pull/850/commits/48817fab8da62b28c539be58213783b248c85b73 I've done various tests on stm32f401 and is actually using the codes in sketches as described above. I've tested the codes against a stm32f407 back then for backup sram and registers as well.

I think this shouldn't break anything

stevstrong commented 1 year ago

OK, then I will commit this. If somebody will encounter a problem related to this, then I will revert it. Thank you for contributing!

ag88 commented 1 year ago

thanks ! I'd monitor issues here and in www.stm32duino.com and would respond just in case someone is after all using it