Skip to content

Instantly share code, notes, and snippets.

View kendegemaro's full-sized avatar

Kende Gömöri kendegemaro

  • Bosch Rexroth AG
  • Lohr am Main
  • 17:24 (UTC +01:00)
View GitHub Profile
@hasenbanck
hasenbanck / gist:1e40681b7d74e942a0dd21de8d97bc5e
Created August 8, 2018 06:53
How to use the Backup SRAM of a STM32F7 / STM32
This might also work for other STM32 chips. I use the HAL, so it also might be supported by your chip.
To use the Backup SRAM (most of the time 4 Kb), you need to add a backup power source (like a battery or a supercap)
to the VBAT pin of your STM32. I use a simple CR2032 battery.
Use following code to get access to the Backup SRAM:
__HAL_RCC_PWR_CLK_ENABLE();
HAL_PWR_EnableBkUpAccess();
__HAL_RCC_BKPSRAM_CLK_ENABLE();